Skip to content

Commit 3d6bc9a

Browse files
committed
test(intid): scope Base58Check round-trips to Erlang target
1 parent 042d501 commit 3d6bc9a

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

test/intid_test.gleam

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,12 +410,21 @@ pub fn decode_int_base32_crockford_check_bounded_above_cap_test() -> Nil {
410410
}
411411

412412
// === Issue #73: Base58Check ===
413+
//
414+
// The Base58Check round-trip tests below are `@target(erlang)` because
415+
// `yabase/base58check`'s round-trip is itself only exercised on Erlang
416+
// in this repo (see `test/base58check_test.gleam`); the JS-side
417+
// SHA-256 divergence is pre-existing scope and tracked separately. The
418+
// `decode_int_base58check_empty_test` runs on both targets because
419+
// empty-input rejection short-circuits before any hashing.
413420

421+
@target(erlang)
414422
pub fn encode_int_base58check_zero_roundtrips_test() -> Nil {
415423
let encoded = intid.encode_int_base58check(0)
416424
assert intid.decode_int_base58check(encoded) == Ok(0)
417425
}
418426

427+
@target(erlang)
419428
pub fn decode_int_base58check_roundtrip_test() -> Nil {
420429
let encoded = intid.encode_int_base58check(9_999_999_999)
421430
assert intid.decode_int_base58check(encoded) == Ok(9_999_999_999)
@@ -425,6 +434,7 @@ pub fn decode_int_base58check_empty_test() -> Nil {
425434
assert intid.decode_int_base58check("") == Error(InvalidLength(0))
426435
}
427436

437+
@target(erlang)
428438
pub fn decode_int_base58check_detects_typo_test() -> Nil {
429439
// Mutate the first checksum-bearing position. Base58Check's 4-byte
430440
// SHA-256 suffix means this *must* fail — that is the property the
@@ -434,6 +444,7 @@ pub fn decode_int_base58check_detects_typo_test() -> Nil {
434444
assert intid.decode_int_base58check(mutated) == Error(InvalidChecksum)
435445
}
436446

447+
@target(erlang)
437448
pub fn decode_int_base58check_bounded_within_test() -> Nil {
438449
let encoded = intid.encode_int_base58check(1234)
439450
assert intid.decode_int_base58check_bounded(

0 commit comments

Comments
 (0)