Skip to content

Commit 4dc72cb

Browse files
rodrigoioyzclaude
andcommitted
Add burn direction tests for compute_expected_synth_amount
4 tests covering negative ADA values (Burn case): burn_1_ada, burn_2_ada, burn_1_5_ada and mint_burn_symmetry. All 25 tests passing. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 9167153 commit 4dc72cb

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

on-chain/lib/utils.ak

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,3 +201,27 @@ test synth_amount_round_trip() {
201201
let synth = compute_expected_synth_amount(lovelaces, 70_000_000, -8)
202202
synth == 700_000
203203
}
204+
205+
// compute_expected_synth_amount (Burn — valor negativo) -----------------------
206+
207+
// Burn 1 ADA: -1_000_000 lovelaces → -700_000 micro-USD (synth a quemar)
208+
test synth_amount_burn_1_ada() {
209+
compute_expected_synth_amount(-1_000_000, 70_000_000, -8) == -700_000
210+
}
211+
212+
// Burn 2 ADA: -2_000_000 lovelaces → -1_400_000 micro-USD
213+
test synth_amount_burn_2_ada() {
214+
compute_expected_synth_amount(-2_000_000, 70_000_000, -8) == -1_400_000
215+
}
216+
217+
// Burn 1.5 ADA: -1_500_000 lovelaces → -1_050_000 micro-USD
218+
test synth_amount_burn_1_5_ada() {
219+
compute_expected_synth_amount(-1_500_000, 70_000_000, -8) == -1_050_000
220+
}
221+
222+
// Simetría: mint y burn deben ser exactamente opuestos
223+
test synth_amount_mint_burn_symmetry() {
224+
let mint = compute_expected_synth_amount(1_000_000, 70_000_000, -8)
225+
let burn = compute_expected_synth_amount(-1_000_000, 70_000_000, -8)
226+
mint == -burn
227+
}

0 commit comments

Comments
 (0)