Skip to content

Commit 3d973b2

Browse files
Use assertNotThrown
1 parent f7c6b3e commit 3d973b2

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

examples/stdlib/binstream.effekt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,23 @@ def main() = {
1212
test("int back-and-forth (17), explicit BE"){ assert(x"${17.BE}", 17) }
1313
test("int back-and-forth (17), explicit LE"){ assert(x"${17.LE}", 17 * 256 * 256 * 256) }
1414
test("byte 00101010"){
15-
with on[MissingValue].default{ assert(true, false) }
15+
with on[MissingValue].assertNotThrown
1616
assert(first[Byte]{groupBytesBE{ bit"00101010${()}" }}.toInt, 42)
1717
}
1818
test("to bits and back LE bitorder"){
19-
with on[MissingValue].default{ assert(true, false) }
19+
with on[MissingValue].assertNotThrown
2020
[42.toByte, 12.toByte, 113.toByte, 0.toByte, 255.toByte].foreach{ v =>
2121
assert(first[Byte]{ groupBytesLE{ bitsLE(v) } }, v)
2222
}
2323
}
2424
test("to bits and back BE bitorder"){
25-
with on[MissingValue].default{ assert(true, false) }
25+
with on[MissingValue].assertNotThrown
2626
[42.toByte, 12.toByte, 113.toByte, 0.toByte, 255.toByte].foreach{ v =>
2727
assert(first[Byte]{ groupBytesBE{ bitsBE(v) } }, v)
2828
}
2929
}
3030
test("append 0 means *2"){
31-
with on[MissingValue].default{ assert(true, false) }
31+
with on[MissingValue].assertNotThrown
3232
[42.toByte, 12.toByte, 127.toByte].foreach{ v =>
3333
assert(nth[Byte](1){ groupBytesBE{ repeat(7){ do emit(B0()) }; bitsBE(v); do emit(B0()) } }, (v.toInt * 2).toByte)
3434
}
@@ -37,11 +37,11 @@ def main() = {
3737
assert(pow(2,5), pow(2.0,5).toInt)
3838
}
3939
test("LE 2s-complement"){
40-
with on[MissingValue].default{ assert(true, false) }
40+
with on[MissingValue].assertNotThrown
4141
assert(first[Byte]{ groupBytesLE{ twoscomplementLE{ bitsLE(6.toByte) } } }, 250.toByte)
4242
}
4343
test("BE 2s-complement"){
44-
with on[MissingValue].default{ assert(true, false) }
44+
with on[MissingValue].assertNotThrown
4545
assert(first[Byte]{ groupBytesBE{ bit"${-6.Signed.BE.OfWidth(8)}" } }, 250.toByte)
4646
}
4747
}

0 commit comments

Comments
 (0)