@@ -12,23 +12,23 @@ def main() = {
12
12
test("int back-and-forth (17), explicit BE"){ assert(x"${17.BE}", 17) }
13
13
test("int back-and-forth (17), explicit LE"){ assert(x"${17.LE}", 17 * 256 * 256 * 256) }
14
14
test("byte 00101010"){
15
- with on[MissingValue].default{ assert(true, false) }
15
+ with on[MissingValue].assertNotThrown
16
16
assert(first[Byte]{groupBytesBE{ bit"00101010${()}" }}.toInt, 42)
17
17
}
18
18
test("to bits and back LE bitorder"){
19
- with on[MissingValue].default{ assert(true, false) }
19
+ with on[MissingValue].assertNotThrown
20
20
[42.toByte, 12.toByte, 113.toByte, 0.toByte, 255.toByte].foreach{ v =>
21
21
assert(first[Byte]{ groupBytesLE{ bitsLE(v) } }, v)
22
22
}
23
23
}
24
24
test("to bits and back BE bitorder"){
25
- with on[MissingValue].default{ assert(true, false) }
25
+ with on[MissingValue].assertNotThrown
26
26
[42.toByte, 12.toByte, 113.toByte, 0.toByte, 255.toByte].foreach{ v =>
27
27
assert(first[Byte]{ groupBytesBE{ bitsBE(v) } }, v)
28
28
}
29
29
}
30
30
test("append 0 means *2"){
31
- with on[MissingValue].default{ assert(true, false) }
31
+ with on[MissingValue].assertNotThrown
32
32
[42.toByte, 12.toByte, 127.toByte].foreach{ v =>
33
33
assert(nth[Byte](1){ groupBytesBE{ repeat(7){ do emit(B0()) }; bitsBE(v); do emit(B0()) } }, (v.toInt * 2).toByte)
34
34
}
@@ -37,11 +37,11 @@ def main() = {
37
37
assert(pow(2,5), pow(2.0,5).toInt)
38
38
}
39
39
test("LE 2s-complement"){
40
- with on[MissingValue].default{ assert(true, false) }
40
+ with on[MissingValue].assertNotThrown
41
41
assert(first[Byte]{ groupBytesLE{ twoscomplementLE{ bitsLE(6.toByte) } } }, 250.toByte)
42
42
}
43
43
test("BE 2s-complement"){
44
- with on[MissingValue].default{ assert(true, false) }
44
+ with on[MissingValue].assertNotThrown
45
45
assert(first[Byte]{ groupBytesBE{ bit"${-6.Signed.BE.OfWidth(8)}" } }, 250.toByte)
46
46
}
47
47
}
0 commit comments