Skip to content

Commit

Permalink
fix: Devise rate: EUR and CAD take value over time against MGA, not t…
Browse files Browse the repository at this point in the history
…he converse
  • Loading branch information
hei-teacher committed Nov 3, 2024
1 parent daefbc8 commit 9169eae
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/main/java/school/hei/patrimoine/modele/Devise.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ public record Devise(
implements Serializable {
public static final Devise MGA = new Devise("ARIARY", "Ar", LocalDate.MIN, 1, 0.0);
public static final Devise EUR =
new Devise("EURO", "€", LocalDate.of(2024, JULY, 3), 4_821, -0.1);
new Devise("EURO", "€", LocalDate.of(2024, JULY, 3), 4_821, 0.03);
public static final Devise CAD =
new Devise("CAD", "CAD", LocalDate.of(2024, JULY, 8), 3_286, -0.1);
new Devise("CAD", "CAD", LocalDate.of(2024, JULY, 8), 3_286, 0.03);

public double valeurEnAriary(LocalDate now) {
var joursEcoules = DAYS.between(t, now);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,6 @@ void zety_part_en_Allemagne() {
var patrimoineDeZetyLe14Fevrier2025 =
patrimoineDeZetyLe26Octobre2025().projectionFuture(AU_26_OCTOBRE_2025);

assertEquals(euro(-9_964), patrimoineDeZetyLe14Fevrier2025.getValeurComptable(EUR));
assertEquals(euro(-9_477), patrimoineDeZetyLe14Fevrier2025.getValeurComptable(EUR));
}
}
9 changes: 5 additions & 4 deletions src/test/java/school/hei/patrimoine/modele/ArgentTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ class ArgentTest {
void eur_to_mga() {
var t = LocalDate.of(2024, SEPTEMBER, 1);

assertEquals(ariary(4_741), euro(1).convertir(MGA, t));
assertEquals(ariary(9_482), euro(2).convertir(MGA, t));
assertEquals(ariary(7_554), euro(2).convertir(MGA, t.plusYears(2)));
assertEquals(ariary(11_414), euro(2).convertir(MGA, t.minusYears(2)));
assertEquals(ariary(4_844), euro(1).convertir(MGA, t));
assertEquals(ariary(4_989), euro(1).convertir(MGA, t.plusYears(1)));
assertEquals(ariary(9_688), euro(2).convertir(MGA, t));
assertEquals(ariary(10_268), euro(2).convertir(MGA, t.plusYears(2)));
assertEquals(ariary(9_110), euro(2).convertir(MGA, t.minusYears(2)));
}

@Test
Expand Down

0 comments on commit 9169eae

Please sign in to comment.