diff --git a/builder/nim_builder.rb b/builder/nim_builder.rb new file mode 100644 index 000000000..e69de29bb diff --git a/spec/nim/auxiliary/test_utils.nim b/spec/nim/auxiliary/test_utils.nim index 51fbeebe4..c953de38b 100644 --- a/spec/nim/auxiliary/test_utils.nim +++ b/spec/nim/auxiliary/test_utils.nim @@ -4,6 +4,7 @@ export kaitai_struct_nim_runtime.`-` proc `-`*(n: uint64): int64 = -int64(n - 1) - 1 +## Loose equality proc `==`*(actual: seq[byte], expected: seq[SomeInteger]|string): bool = if actual.len != expected.len: return false @@ -11,3 +12,9 @@ proc `==`*(actual: seq[byte], expected: seq[SomeInteger]|string): bool = if actual[i] != expected[i].byte: return false return true + +proc `==`*[S: SomeSignedInt, U: SomeUnsignedInt](x: S, y: U): bool = + x == S(y) + +proc `==`*[S: SomeSignedInt, U: SomeUnsignedInt](x: U, y: S): bool = + S(x) == y \ No newline at end of file diff --git a/spec/nim/tbcd_user_type_be.nim b/spec/nim/tbcd_user_type_be.nim index d0adbd900..c161f3c53 100644 --- a/spec/nim/tbcd_user_type_be.nim +++ b/spec/nim/tbcd_user_type_be.nim @@ -6,9 +6,9 @@ import auxiliary/test_utils let r = BcdUserTypeBe.fromFile("src/bcd_user_type_be.bin") -assert r.ltr.asInt == int(12345678) -assert r.ltr.asStr == string("12345678") -assert r.rtl.asInt == int(87654321) -assert r.rtl.asStr == string("87654321") -assert r.leadingZeroLtr.asInt == int(123456) -assert r.leadingZeroLtr.asStr == string("00123456") +assert r.ltr.asInt == 12345678 +assert r.ltr.asStr == "12345678" +assert r.rtl.asInt == 87654321 +assert r.rtl.asStr == "87654321" +assert r.leadingZeroLtr.asInt == 123456 +assert r.leadingZeroLtr.asStr == "00123456" diff --git a/spec/nim/tbcd_user_type_le.nim b/spec/nim/tbcd_user_type_le.nim index 09b740974..83c840be3 100644 --- a/spec/nim/tbcd_user_type_le.nim +++ b/spec/nim/tbcd_user_type_le.nim @@ -6,9 +6,9 @@ import auxiliary/test_utils let r = BcdUserTypeLe.fromFile("src/bcd_user_type_le.bin") -assert r.ltr.asInt == int(12345678) -assert r.ltr.asStr == string("12345678") -assert r.rtl.asInt == int(87654321) -assert r.rtl.asStr == string("87654321") -assert r.leadingZeroLtr.asInt == int(123456) -assert r.leadingZeroLtr.asStr == string("00123456") +assert r.ltr.asInt == 12345678 +assert r.ltr.asStr == "12345678" +assert r.rtl.asInt == 87654321 +assert r.rtl.asStr == "87654321" +assert r.leadingZeroLtr.asInt == 123456 +assert r.leadingZeroLtr.asStr == "00123456" diff --git a/spec/nim/tbits_byte_aligned.nim b/spec/nim/tbits_byte_aligned.nim index 4faa05df9..dc9d56f18 100644 --- a/spec/nim/tbits_byte_aligned.nim +++ b/spec/nim/tbits_byte_aligned.nim @@ -6,12 +6,12 @@ import auxiliary/test_utils let r = BitsByteAligned.fromFile("src/fixed_struct.bin") -assert r.one == uint64(20) -assert r.byte1 == uint8(65) -assert r.two == uint64(2) -assert r.three == bool(false) -assert r.byte2 == uint8(75) -assert r.four == uint64(2892) +assert r.one == 20 +assert r.byte1 == 65 +assert r.two == 2 +assert r.three == false +assert r.byte2 == 75 +assert r.four == 2892 assert r.byte3 == @[255'u8] -assert r.fullByte == uint64(255) -assert r.byte4 == uint8(80) +assert r.fullByte == 255 +assert r.byte4 == 80 diff --git a/spec/nim/tbits_seq_endian_combo.nim b/spec/nim/tbits_seq_endian_combo.nim index 28fa8a852..e379d9ea2 100644 --- a/spec/nim/tbits_seq_endian_combo.nim +++ b/spec/nim/tbits_seq_endian_combo.nim @@ -6,11 +6,11 @@ import auxiliary/test_utils let r = BitsSeqEndianCombo.fromFile("src/process_xor_4.bin") -assert r.be1 == uint64(59) -assert r.be2 == uint64(187) -assert r.le3 == uint64(163) -assert r.be4 == uint64(20) -assert r.le5 == uint64(10) -assert r.le6 == uint64(36) -assert r.le7 == uint64(26) -assert r.be8 == bool(true) +assert r.be1 == 59 +assert r.be2 == 187 +assert r.le3 == 163 +assert r.be4 == 20 +assert r.le5 == 10 +assert r.le6 == 36 +assert r.le7 == 26 +assert r.be8 == true diff --git a/spec/nim/tbits_signed_b32_le.nim b/spec/nim/tbits_signed_b32_le.nim index 5fd672cbc..afafc2b24 100644 --- a/spec/nim/tbits_signed_b32_le.nim +++ b/spec/nim/tbits_signed_b32_le.nim @@ -6,7 +6,7 @@ import auxiliary/test_utils let r = BitsSignedB32Le.fromFile("src/bits_signed_b32_le.bin") -assert r.aNum == uint64(0) -assert r.aBit == bool(true) -assert r.bNum == uint64(2147483647) -assert r.bBit == bool(false) +assert r.aNum == 0 +assert r.aBit == true +assert r.bNum == 2147483647 +assert r.bBit == false diff --git a/spec/nim/tbits_signed_b64_le.nim b/spec/nim/tbits_signed_b64_le.nim index 2f9582954..7bdb8ac25 100644 --- a/spec/nim/tbits_signed_b64_le.nim +++ b/spec/nim/tbits_signed_b64_le.nim @@ -6,7 +6,7 @@ import auxiliary/test_utils let r = BitsSignedB64Le.fromFile("src/bits_signed_b64_le.bin") -assert r.aNum == uint64(0) -assert r.aBit == bool(true) -assert r.bNum == uint64(9223372036854775807'i64) -assert r.bBit == bool(false) +assert r.aNum == 0 +assert r.aBit == true +assert r.bNum == 9223372036854775807'i64 +assert r.bBit == false diff --git a/spec/nim/tbits_simple.nim b/spec/nim/tbits_simple.nim index 1fb21c090..912be361a 100644 --- a/spec/nim/tbits_simple.nim +++ b/spec/nim/tbits_simple.nim @@ -6,17 +6,17 @@ import auxiliary/test_utils let r = BitsSimple.fromFile("src/fixed_struct.bin") -assert r.byte1 == uint64(80) -assert r.byte2 == uint64(65) -assert r.bitsA == bool(false) -assert r.bitsB == uint64(4) -assert r.bitsC == uint64(3) -assert r.largeBits1 == uint64(300) -assert r.spacer == uint64(5) -assert r.largeBits2 == uint64(1329) -assert r.normalS2 == int16(-1) -assert r.byte8910 == uint64(5259587) -assert r.byte11To14 == uint64(1261262125) -assert r.byte15To19 == uint64(293220057087'i64) -assert r.byte20To27 == uint64(18446744073709551615'u64) -assert r.testIfB1 == int8(123) +assert r.byte1 == 80 +assert r.byte2 == 65 +assert r.bitsA == false +assert r.bitsB == 4 +assert r.bitsC == 3 +assert r.largeBits1 == 300 +assert r.spacer == 5 +assert r.largeBits2 == 1329 +assert r.normalS2 == -1 +assert r.byte8910 == 5259587 +assert r.byte11To14 == 1261262125 +assert r.byte15To19 == 293220057087'i64 +assert r.byte20To27 == 18446744073709551615'u64 +assert r.testIfB1 == 123 diff --git a/spec/nim/tbits_simple_le.nim b/spec/nim/tbits_simple_le.nim index b2dcff219..3a214982f 100644 --- a/spec/nim/tbits_simple_le.nim +++ b/spec/nim/tbits_simple_le.nim @@ -6,17 +6,17 @@ import auxiliary/test_utils let r = BitsSimpleLe.fromFile("src/fixed_struct.bin") -assert r.byte1 == uint64(80) -assert r.byte2 == uint64(65) -assert r.bitsA == bool(true) -assert r.bitsB == uint64(1) -assert r.bitsC == uint64(4) -assert r.largeBits1 == uint64(331) -assert r.spacer == uint64(3) -assert r.largeBits2 == uint64(393) -assert r.normalS2 == int16(-1) -assert r.byte8910 == uint64(4407632) -assert r.byte11To14 == uint64(760556875) -assert r.byte15To19 == uint64(1099499455812'i64) -assert r.byte20To27 == uint64(18446744073709551615'u64) -assert r.testIfB1 == int8(123) +assert r.byte1 == 80 +assert r.byte2 == 65 +assert r.bitsA == true +assert r.bitsB == 1 +assert r.bitsC == 4 +assert r.largeBits1 == 331 +assert r.spacer == 3 +assert r.largeBits2 == 393 +assert r.normalS2 == -1 +assert r.byte8910 == 4407632 +assert r.byte11To14 == 760556875 +assert r.byte15To19 == 1099499455812'i64 +assert r.byte20To27 == 18446744073709551615'u64 +assert r.testIfB1 == 123 diff --git a/spec/nim/tbuffered_struct.nim b/spec/nim/tbuffered_struct.nim index f3eec45d4..9075be2fe 100644 --- a/spec/nim/tbuffered_struct.nim +++ b/spec/nim/tbuffered_struct.nim @@ -6,10 +6,10 @@ import auxiliary/test_utils let r = BufferedStruct.fromFile("src/buffered_struct.bin") -assert r.len1 == uint32(16) -assert r.block1.number1 == uint32(66) -assert r.block1.number2 == uint32(67) -assert r.len2 == uint32(8) -assert r.block2.number1 == uint32(68) -assert r.block2.number2 == uint32(69) -assert r.finisher == uint32(238) +assert r.len1 == 16 +assert r.block1.number1 == 66 +assert r.block1.number2 == 67 +assert r.len2 == 8 +assert r.block2.number1 == 68 +assert r.block2.number2 == 69 +assert r.finisher == 238 diff --git a/spec/nim/tcast_nested.nim b/spec/nim/tcast_nested.nim index 279aa6d83..403a12310 100644 --- a/spec/nim/tcast_nested.nim +++ b/spec/nim/tcast_nested.nim @@ -6,7 +6,7 @@ import auxiliary/test_utils let r = CastNested.fromFile("src/switch_opcodes.bin") -assert r.opcodes0Str.value == string("foobar") -assert r.opcodes0StrValue == string("foobar") -assert r.opcodes1Int.value == uint8(66) -assert r.opcodes1IntValue == uint8(66) +assert r.opcodes0Str.value == "foobar" +assert r.opcodes0StrValue == "foobar" +assert r.opcodes1Int.value == 66 +assert r.opcodes1IntValue == 66 diff --git a/spec/nim/tcast_to_imported.nim b/spec/nim/tcast_to_imported.nim index fcd610901..f0d592de9 100644 --- a/spec/nim/tcast_to_imported.nim +++ b/spec/nim/tcast_to_imported.nim @@ -7,5 +7,5 @@ import auxiliary/test_utils let r = CastToImported.fromFile("src/fixed_struct.bin") -assert r.one.one == uint8(80) -assert r.oneCasted.one == uint8(80) +assert r.one.one == 80 +assert r.oneCasted.one == 80 diff --git a/spec/nim/tcast_to_top.nim b/spec/nim/tcast_to_top.nim index 0b841d9ce..0b6ded919 100644 --- a/spec/nim/tcast_to_top.nim +++ b/spec/nim/tcast_to_top.nim @@ -6,6 +6,6 @@ import auxiliary/test_utils let r = CastToTop.fromFile("src/fixed_struct.bin") -assert r.code == uint8(80) -assert r.header.code == uint8(65) -assert r.headerCasted.code == uint8(65) +assert r.code == 80 +assert r.header.code == 65 +assert r.headerCasted.code == 65 diff --git a/spec/nim/tcombine_bool.nim b/spec/nim/tcombine_bool.nim index 36690f35a..ed086d532 100644 --- a/spec/nim/tcombine_bool.nim +++ b/spec/nim/tcombine_bool.nim @@ -6,5 +6,5 @@ import auxiliary/test_utils let r = CombineBool.fromFile("src/enum_negative.bin") -assert r.boolBit == bool(true) -assert r.boolCalcBit == bool(false) +assert r.boolBit == true +assert r.boolCalcBit == false diff --git a/spec/nim/tcombine_str.nim b/spec/nim/tcombine_str.nim index 96f54b355..f65362f10 100644 --- a/spec/nim/tcombine_str.nim +++ b/spec/nim/tcombine_str.nim @@ -6,18 +6,18 @@ import auxiliary/test_utils let r = CombineStr.fromFile("src/term_strz.bin") -assert r.strTerm == string("foo") -assert r.strLimit == string("bar|") -assert r.strEos == string("baz@") -assert r.strCalc == string("bar") -assert r.strCalcBytes == string("baz") -assert r.termOrLimit == string("foo") -assert r.termOrEos == string("baz@") -assert r.termOrCalc == string("foo") -assert r.termOrCalcBytes == string("baz") -assert r.limitOrEos == string("bar|") -assert r.limitOrCalc == string("bar") -assert r.limitOrCalcBytes == string("bar|") -assert r.eosOrCalc == string("bar") -assert r.eosOrCalcBytes == string("baz@") -assert r.calcOrCalcBytes == string("baz") +assert r.strTerm == "foo" +assert r.strLimit == "bar|" +assert r.strEos == "baz@" +assert r.strCalc == "bar" +assert r.strCalcBytes == "baz" +assert r.termOrLimit == "foo" +assert r.termOrEos == "baz@" +assert r.termOrCalc == "foo" +assert r.termOrCalcBytes == "baz" +assert r.limitOrEos == "bar|" +assert r.limitOrCalc == "bar" +assert r.limitOrCalcBytes == "bar|" +assert r.eosOrCalc == "bar" +assert r.eosOrCalcBytes == "baz@" +assert r.calcOrCalcBytes == "baz" diff --git a/spec/nim/tdebug_switch_user.nim b/spec/nim/tdebug_switch_user.nim index 5a541cb3d..360678018 100644 --- a/spec/nim/tdebug_switch_user.nim +++ b/spec/nim/tdebug_switch_user.nim @@ -6,5 +6,5 @@ import auxiliary/test_utils let r = DebugSwitchUser.fromFile("src/nav_parent_switch.bin") -assert r.code == uint8(1) -assert (DebugSwitchUser_One(r.data)).val == int16(-190) +assert r.code == 1 +assert (DebugSwitchUser_One(r.data)).val == -190 diff --git a/spec/nim/tdefault_big_endian.nim b/spec/nim/tdefault_big_endian.nim index c781027ae..8296e11e3 100644 --- a/spec/nim/tdefault_big_endian.nim +++ b/spec/nim/tdefault_big_endian.nim @@ -6,4 +6,4 @@ import auxiliary/test_utils let r = DefaultBigEndian.fromFile("src/enum_0.bin") -assert r.one == uint32(117440512) +assert r.one == 117440512 diff --git a/spec/nim/tdefault_bit_endian_mod.nim b/spec/nim/tdefault_bit_endian_mod.nim index 53402c725..76f3363ed 100644 --- a/spec/nim/tdefault_bit_endian_mod.nim +++ b/spec/nim/tdefault_bit_endian_mod.nim @@ -6,7 +6,7 @@ import auxiliary/test_utils let r = DefaultBitEndianMod.fromFile("src/fixed_struct.bin") -assert r.main.one == uint64(336) -assert r.main.two == uint64(8608) -assert r.main.nest.two == uint64(11595) -assert r.main.nestBe.two == uint64(12799) +assert r.main.one == 336 +assert r.main.two == 8608 +assert r.main.nest.two == 11595 +assert r.main.nestBe.two == 12799 diff --git a/spec/nim/tdefault_endian_expr_inherited.nim b/spec/nim/tdefault_endian_expr_inherited.nim index 5e1c14baa..a4ae55d41 100644 --- a/spec/nim/tdefault_endian_expr_inherited.nim +++ b/spec/nim/tdefault_endian_expr_inherited.nim @@ -7,17 +7,17 @@ import auxiliary/test_utils let r = DefaultEndianExprInherited.fromFile("src/endian_expr.bin") assert r.docs[0].indicator == @[73'u8, 73'u8] -assert r.docs[0].main.insides.someInt == uint32(66) -assert r.docs[0].main.insides.more.someInt1 == uint16(16896) -assert r.docs[0].main.insides.more.someInt2 == uint16(66) -assert r.docs[0].main.insides.more.someInst == uint32(66) +assert r.docs[0].main.insides.someInt == 66 +assert r.docs[0].main.insides.more.someInt1 == 16896 +assert r.docs[0].main.insides.more.someInt2 == 66 +assert r.docs[0].main.insides.more.someInst == 66 assert r.docs[1].indicator == @[77'u8, 77'u8] -assert r.docs[1].main.insides.someInt == uint32(66) -assert r.docs[1].main.insides.more.someInt1 == uint16(66) -assert r.docs[1].main.insides.more.someInt2 == uint16(16896) -assert r.docs[1].main.insides.more.someInst == uint32(1107296256) +assert r.docs[1].main.insides.someInt == 66 +assert r.docs[1].main.insides.more.someInt1 == 66 +assert r.docs[1].main.insides.more.someInt2 == 16896 +assert r.docs[1].main.insides.more.someInst == 1107296256 assert r.docs[2].indicator == @[88'u8, 88'u8] -assert r.docs[2].main.insides.someInt == uint32(66) -assert r.docs[2].main.insides.more.someInt1 == uint16(66) -assert r.docs[2].main.insides.more.someInt2 == uint16(16896) -assert r.docs[2].main.insides.more.someInst == uint32(1107296256) +assert r.docs[2].main.insides.someInt == 66 +assert r.docs[2].main.insides.more.someInt1 == 66 +assert r.docs[2].main.insides.more.someInt2 == 16896 +assert r.docs[2].main.insides.more.someInst == 1107296256 diff --git a/spec/nim/tdefault_endian_expr_is_be.nim b/spec/nim/tdefault_endian_expr_is_be.nim index 3cba7d8d0..68e5b00f7 100644 --- a/spec/nim/tdefault_endian_expr_is_be.nim +++ b/spec/nim/tdefault_endian_expr_is_be.nim @@ -7,20 +7,20 @@ import auxiliary/test_utils let r = DefaultEndianExprIsBe.fromFile("src/endian_expr.bin") assert r.docs[0].indicator == @[73'u8, 73'u8] -assert r.docs[0].main.someInt == uint32(66) -assert r.docs[0].main.someIntBe == uint16(66) -assert r.docs[0].main.someIntLe == uint16(66) -assert r.docs[0].main.instInt == uint32(66) -assert r.docs[0].main.instSub.foo == uint32(66) +assert r.docs[0].main.someInt == 66 +assert r.docs[0].main.someIntBe == 66 +assert r.docs[0].main.someIntLe == 66 +assert r.docs[0].main.instInt == 66 +assert r.docs[0].main.instSub.foo == 66 assert r.docs[1].indicator == @[77'u8, 77'u8] -assert r.docs[1].main.someInt == uint32(66) -assert r.docs[1].main.someIntBe == uint16(66) -assert r.docs[1].main.someIntLe == uint16(66) -assert r.docs[1].main.instInt == uint32(1107296256) -assert r.docs[1].main.instSub.foo == uint32(1107296256) +assert r.docs[1].main.someInt == 66 +assert r.docs[1].main.someIntBe == 66 +assert r.docs[1].main.someIntLe == 66 +assert r.docs[1].main.instInt == 1107296256 +assert r.docs[1].main.instSub.foo == 1107296256 assert r.docs[2].indicator == @[88'u8, 88'u8] -assert r.docs[2].main.someInt == uint32(1107296256) -assert r.docs[2].main.someIntBe == uint16(66) -assert r.docs[2].main.someIntLe == uint16(66) -assert r.docs[2].main.instInt == uint32(66) -assert r.docs[2].main.instSub.foo == uint32(66) +assert r.docs[2].main.someInt == 1107296256 +assert r.docs[2].main.someIntBe == 66 +assert r.docs[2].main.someIntLe == 66 +assert r.docs[2].main.instInt == 66 +assert r.docs[2].main.instSub.foo == 66 diff --git a/spec/nim/tdefault_endian_expr_is_le.nim b/spec/nim/tdefault_endian_expr_is_le.nim index 42d0e013d..7a2ff26ae 100644 --- a/spec/nim/tdefault_endian_expr_is_le.nim +++ b/spec/nim/tdefault_endian_expr_is_le.nim @@ -7,14 +7,14 @@ import auxiliary/test_utils let r = DefaultEndianExprIsLe.fromFile("src/endian_expr.bin") assert r.docs[0].indicator == @[73'u8, 73'u8] -assert r.docs[0].main.someInt == uint32(66) -assert r.docs[0].main.someIntBe == uint16(66) -assert r.docs[0].main.someIntLe == uint16(66) +assert r.docs[0].main.someInt == 66 +assert r.docs[0].main.someIntBe == 66 +assert r.docs[0].main.someIntLe == 66 assert r.docs[1].indicator == @[77'u8, 77'u8] -assert r.docs[1].main.someInt == uint32(66) -assert r.docs[1].main.someIntBe == uint16(66) -assert r.docs[1].main.someIntLe == uint16(66) +assert r.docs[1].main.someInt == 66 +assert r.docs[1].main.someIntBe == 66 +assert r.docs[1].main.someIntLe == 66 assert r.docs[2].indicator == @[88'u8, 88'u8] -assert r.docs[2].main.someInt == uint32(66) -assert r.docs[2].main.someIntBe == uint16(66) -assert r.docs[2].main.someIntLe == uint16(66) +assert r.docs[2].main.someInt == 66 +assert r.docs[2].main.someIntBe == 66 +assert r.docs[2].main.someIntLe == 66 diff --git a/spec/nim/tdefault_endian_mod.nim b/spec/nim/tdefault_endian_mod.nim index bdf73aa79..abbe7165f 100644 --- a/spec/nim/tdefault_endian_mod.nim +++ b/spec/nim/tdefault_endian_mod.nim @@ -6,6 +6,6 @@ import auxiliary/test_utils let r = DefaultEndianMod.fromFile("src/fixed_struct.bin") -assert r.main.one == int32(1262698832) -assert r.main.nest.two == int32(-52947) -assert r.main.nestBe.two == int32(1346454347) +assert r.main.one == 1262698832 +assert r.main.nest.two == -52947 +assert r.main.nestBe.two == 1346454347 diff --git a/spec/nim/tenum_deep_literals.nim b/spec/nim/tenum_deep_literals.nim index 27ba04ea4..4d0172240 100644 --- a/spec/nim/tenum_deep_literals.nim +++ b/spec/nim/tenum_deep_literals.nim @@ -6,5 +6,5 @@ import auxiliary/test_utils let r = EnumDeepLiterals.fromFile("src/enum_0.bin") -assert r.isPet1Ok == bool(true) -assert r.isPet2Ok == bool(true) +assert r.isPet1Ok == true +assert r.isPet2Ok == true diff --git a/spec/nim/tenum_if.nim b/spec/nim/tenum_if.nim index c726469c5..0f1c74d40 100644 --- a/spec/nim/tenum_if.nim +++ b/spec/nim/tenum_if.nim @@ -7,9 +7,9 @@ import auxiliary/test_utils let r = EnumIf.fromFile("src/if_struct.bin") assert r.op1.opcode == enum_if.a_string -assert r.op1.argStr.str == string("foo") +assert r.op1.argStr.str == "foo" assert r.op2.opcode == enum_if.a_tuple -assert r.op2.argTuple.num1 == uint8(66) -assert r.op2.argTuple.num2 == uint8(67) +assert r.op2.argTuple.num1 == 66 +assert r.op2.argTuple.num2 == 67 assert r.op3.opcode == enum_if.a_string -assert r.op3.argStr.str == string("bar") +assert r.op3.argStr.str == "bar" diff --git a/spec/nim/tenum_invalid.nim b/spec/nim/tenum_invalid.nim index 603abaf96..e0b089bb9 100644 --- a/spec/nim/tenum_invalid.nim +++ b/spec/nim/tenum_invalid.nim @@ -7,4 +7,4 @@ import auxiliary/test_utils let r = EnumInvalid.fromFile("src/term_strz.bin") assert r.pet1 == enum_invalid.dog -assert r.pet2 == EnumInvalid_Animal(111) +assert r.pet2 == 111 diff --git a/spec/nim/tenum_to_i.nim b/spec/nim/tenum_to_i.nim index 911f6d99a..395fd3fad 100644 --- a/spec/nim/tenum_to_i.nim +++ b/spec/nim/tenum_to_i.nim @@ -8,8 +8,8 @@ let r = EnumToI.fromFile("src/enum_0.bin") assert r.pet1 == enum_to_i.cat assert r.pet2 == enum_to_i.chicken -assert r.pet1I == int(7) -assert r.pet1Mod == int(32775) -assert r.oneLtTwo == bool(true) -assert r.pet1EqInt == bool(true) -assert r.pet2EqInt == bool(false) +assert r.pet1I == 7 +assert r.pet1Mod == 32775 +assert r.oneLtTwo == true +assert r.pet1EqInt == true +assert r.pet2EqInt == false diff --git a/spec/nim/tenum_to_i_class_border_1.nim b/spec/nim/tenum_to_i_class_border_1.nim index 4eb8c056c..7a7b8e01e 100644 --- a/spec/nim/tenum_to_i_class_border_1.nim +++ b/spec/nim/tenum_to_i_class_border_1.nim @@ -9,4 +9,4 @@ let r = EnumToIClassBorder1.fromFile("src/enum_0.bin") assert r.pet1 == enum_to_i_class_border_1.cat assert r.pet2 == enum_to_i_class_border_1.chicken -assert r.checker.isDog == bool(true) +assert r.checker.isDog == true diff --git a/spec/nim/texpr_0.nim b/spec/nim/texpr_0.nim index ea8b4051d..55a581639 100644 --- a/spec/nim/texpr_0.nim +++ b/spec/nim/texpr_0.nim @@ -6,5 +6,5 @@ import auxiliary/test_utils let r = Expr0.fromFile("src/str_encodings.bin") -assert r.mustBeF7 == int(247) -assert r.mustBeAbc123 == string("abc123") +assert r.mustBeF7 == 247 +assert r.mustBeAbc123 == "abc123" diff --git a/spec/nim/texpr_1.nim b/spec/nim/texpr_1.nim index dea2a9225..98e5cbe28 100644 --- a/spec/nim/texpr_1.nim +++ b/spec/nim/texpr_1.nim @@ -6,7 +6,7 @@ import auxiliary/test_utils let r = Expr1.fromFile("src/str_encodings.bin") -assert r.lenOf1 == uint16(10) -assert r.lenOf1Mod == int(8) -assert r.str1 == string("Some ASC") -assert r.str1Len == int(8) +assert r.lenOf1 == 10 +assert r.lenOf1Mod == 8 +assert r.str1 == "Some ASC" +assert r.str1Len == 8 diff --git a/spec/nim/texpr_2.nim b/spec/nim/texpr_2.nim index 6258b03ca..75e5869c6 100644 --- a/spec/nim/texpr_2.nim +++ b/spec/nim/texpr_2.nim @@ -6,20 +6,20 @@ import auxiliary/test_utils let r = Expr2.fromFile("src/str_encodings.bin") -assert r.str1.lenOrig == uint16(10) -assert r.str1.lenMod == int(7) -assert r.str1.str == string("Some AS") -assert r.str1Len == int(7) -assert r.str1LenMod == int(7) -assert r.str1Byte1 == uint8(73) -assert r.str1Avg == int(73) -assert r.str1Char5 == string("e") -assert r.str1Tuple5.byte0 == uint8(101) -assert r.str1Tuple5.byte0 == uint8(101) -assert r.str1Tuple5.byte1 == uint8(32) -assert r.str1Tuple5.byte2 == uint8(65) -assert r.str1Tuple5.avg == int(48) -assert r.str2Tuple5.byte0 == uint8(101) -assert r.str2Tuple5.byte1 == uint8(32) -assert r.str2Tuple5.byte2 == uint8(65) -assert r.str2Tuple5.avg == int(48) +assert r.str1.lenOrig == 10 +assert r.str1.lenMod == 7 +assert r.str1.str == "Some AS" +assert r.str1Len == 7 +assert r.str1LenMod == 7 +assert r.str1Byte1 == 73 +assert r.str1Avg == 73 +assert r.str1Char5 == "e" +assert r.str1Tuple5.byte0 == 101 +assert r.str1Tuple5.byte0 == 101 +assert r.str1Tuple5.byte1 == 32 +assert r.str1Tuple5.byte2 == 65 +assert r.str1Tuple5.avg == 48 +assert r.str2Tuple5.byte0 == 101 +assert r.str2Tuple5.byte1 == 32 +assert r.str2Tuple5.byte2 == 65 +assert r.str2Tuple5.avg == 48 diff --git a/spec/nim/texpr_3.nim b/spec/nim/texpr_3.nim index 6df9fe43c..1c025cf7e 100644 --- a/spec/nim/texpr_3.nim +++ b/spec/nim/texpr_3.nim @@ -6,15 +6,15 @@ import auxiliary/test_utils let r = Expr3.fromFile("src/fixed_struct.bin") -assert r.one == uint8(80) -assert r.two == string("ACK") -assert r.three == string("@ACK") -assert r.four == string("_ACK_") -assert r.isStrEq == bool(true) -assert r.isStrNe == bool(false) -assert r.isStrLt == bool(true) -assert r.isStrGt == bool(false) -assert r.isStrLe == bool(true) -assert r.isStrGe == bool(false) -assert r.isStrLt2 == bool(true) -assert r.testNot == bool(true) +assert r.one == 80 +assert r.two == "ACK" +assert r.three == "@ACK" +assert r.four == "_ACK_" +assert r.isStrEq == true +assert r.isStrNe == false +assert r.isStrLt == true +assert r.isStrGt == false +assert r.isStrLe == true +assert r.isStrGe == false +assert r.isStrLt2 == true +assert r.testNot == true diff --git a/spec/nim/texpr_array.nim b/spec/nim/texpr_array.nim index 3936855fc..a8f821285 100644 --- a/spec/nim/texpr_array.nim +++ b/spec/nim/texpr_array.nim @@ -6,18 +6,18 @@ import auxiliary/test_utils let r = ExprArray.fromFile("src/expr_array.bin") -assert r.aintSize == int(4) -assert r.aintFirst == uint32(7657765) -assert r.aintLast == uint32(16272640) -assert r.aintMin == uint32(49185) -assert r.aintMax == uint32(1123362332) -assert r.afloatSize == int(3) -assert r.afloatFirst == float64(-2.6839530254859364E-121) -assert r.afloatLast == float64(-1.1103359815095273E-175) -assert r.afloatMin == float64(-8.754689149998834E+288) -assert r.afloatMax == float64(-1.1103359815095273E-175) -assert r.astrSize == int(3) -assert r.astrFirst == string("foo") -assert r.astrLast == string("baz") -assert r.astrMin == string("bar") -assert r.astrMax == string("foo") +assert r.aintSize == 4 +assert r.aintFirst == 7657765 +assert r.aintLast == 16272640 +assert r.aintMin == 49185 +assert r.aintMax == 1123362332 +assert r.afloatSize == 3 +assert r.afloatFirst == -2.6839530254859364E-121 +assert r.afloatLast == -1.1103359815095273E-175 +assert r.afloatMin == -8.754689149998834E+288 +assert r.afloatMax == -1.1103359815095273E-175 +assert r.astrSize == 3 +assert r.astrFirst == "foo" +assert r.astrLast == "baz" +assert r.astrMin == "bar" +assert r.astrMax == "foo" diff --git a/spec/nim/texpr_bits.nim b/spec/nim/texpr_bits.nim index 7e5bf603a..10aa2e264 100644 --- a/spec/nim/texpr_bits.nim +++ b/spec/nim/texpr_bits.nim @@ -6,13 +6,13 @@ import auxiliary/test_utils let r = ExprBits.fromFile("src/switch_opcodes.bin") -assert r.a == uint64(2) +assert r.a == 2 assert r.enumSeq == expr_bits.foo assert r.byteSize == @[102'u8, 111'u8] -assert len(r.repeatExpr) == int(2) -assert r.repeatExpr[0] == int8(111) -assert r.repeatExpr[1] == int8(98) -assert r.switchOnType == int8(97) -assert r.switchOnEndian.foo == int16(29184) +assert len(r.repeatExpr) == 2 +assert r.repeatExpr[0] == 111 +assert r.repeatExpr[1] == 98 +assert r.switchOnType == 97 +assert r.switchOnEndian.foo == 29184 assert r.enumInst == expr_bits.bar -assert r.instPos == int8(111) +assert r.instPos == 111 diff --git a/spec/nim/texpr_bytes_cmp.nim b/spec/nim/texpr_bytes_cmp.nim index d2d0b2b0a..0efc4bc93 100644 --- a/spec/nim/texpr_bytes_cmp.nim +++ b/spec/nim/texpr_bytes_cmp.nim @@ -8,11 +8,11 @@ let r = ExprBytesCmp.fromFile("src/fixed_struct.bin") assert r.one == @[80'u8] assert r.two == @[65'u8, 67'u8, 75'u8] -assert r.isEq == bool(true) -assert r.isNe == bool(false) -assert r.isLt == bool(true) -assert r.isGt == bool(false) -assert r.isLe == bool(true) -assert r.isGe == bool(false) -assert r.isLt2 == bool(false) -assert r.isGt2 == bool(true) +assert r.isEq == true +assert r.isNe == false +assert r.isLt == true +assert r.isGt == false +assert r.isLe == true +assert r.isGe == false +assert r.isLt2 == false +assert r.isGt2 == true diff --git a/spec/nim/texpr_bytes_literal.nim b/spec/nim/texpr_bytes_literal.nim index 6b7ae2bc4..8ca656e2b 100644 --- a/spec/nim/texpr_bytes_literal.nim +++ b/spec/nim/texpr_bytes_literal.nim @@ -6,6 +6,6 @@ import auxiliary/test_utils let r = ExprBytesLiteral.fromFile("src/enum_negative.bin") -assert len(r.literal) == int(2) -assert r.literal[0] == uint8(-1) -assert r.literal[1] == uint8(1) +assert len(r.literal) == 2 +assert r.literal[0] == -1 +assert r.literal[1] == 1 diff --git a/spec/nim/texpr_bytes_ops.nim b/spec/nim/texpr_bytes_ops.nim index 9278ec72b..01545d50f 100644 --- a/spec/nim/texpr_bytes_ops.nim +++ b/spec/nim/texpr_bytes_ops.nim @@ -7,19 +7,19 @@ import strutils let r = ExprBytesOps.fromFile("src/nav_parent_switch.bin") -assert r.oneSize == int(3) -assert r.oneFirst == uint8(1) -assert r.oneMid == uint8(66) -assert r.oneLast == uint8(255) -assert intToStr(int(r.oneLast)) == string("255") -assert r.oneMin == uint8(1) -assert r.oneMax == uint8(255) -assert intToStr(int(r.oneMax)) == string("255") -assert r.twoSize == int(3) -assert r.twoFirst == uint8(65) -assert r.twoMid == uint8(255) -assert intToStr(int(r.twoMid)) == string("255") -assert r.twoLast == uint8(75) -assert r.twoMin == uint8(65) -assert r.twoMax == uint8(255) -assert intToStr(int(r.twoMax)) == string("255") +assert r.oneSize == 3 +assert r.oneFirst == 1 +assert r.oneMid == 66 +assert r.oneLast == 255 +assert intToStr(int(r.oneLast)) == "255" +assert r.oneMin == 1 +assert r.oneMax == 255 +assert intToStr(int(r.oneMax)) == "255" +assert r.twoSize == 3 +assert r.twoFirst == 65 +assert r.twoMid == 255 +assert intToStr(int(r.twoMid)) == "255" +assert r.twoLast == 75 +assert r.twoMin == 65 +assert r.twoMax == 255 +assert intToStr(int(r.twoMax)) == "255" diff --git a/spec/nim/texpr_calc_array_ops.nim b/spec/nim/texpr_calc_array_ops.nim index 5fcdea29f..241f90996 100644 --- a/spec/nim/texpr_calc_array_ops.nim +++ b/spec/nim/texpr_calc_array_ops.nim @@ -6,21 +6,21 @@ import auxiliary/test_utils let r = ExprCalcArrayOps.fromFile("src/fixed_struct.bin") -assert r.intArraySize == int(7) -assert r.intArrayFirst == int(10) -assert r.intArrayMid == int(25) -assert r.intArrayLast == int(1000) -assert r.intArrayMin == int(10) -assert r.intArrayMax == int(1000) -assert r.doubleArraySize == int(5) -assert r.doubleArrayFirst == float64(10.0) -assert r.doubleArrayMid == float64(25.0) -assert r.doubleArrayLast == float64(3.14159) -assert r.doubleArrayMin == float64(3.14159) -assert r.doubleArrayMax == float64(100.0) -assert r.strArraySize == int(4) -assert r.strArrayFirst == string("un") -assert r.strArrayMid == string("deux") -assert r.strArrayLast == string("quatre") -assert r.strArrayMin == string("deux") -assert r.strArrayMax == string("un") +assert r.intArraySize == 7 +assert r.intArrayFirst == 10 +assert r.intArrayMid == 25 +assert r.intArrayLast == 1000 +assert r.intArrayMin == 10 +assert r.intArrayMax == 1000 +assert r.doubleArraySize == 5 +assert r.doubleArrayFirst == 10.0 +assert r.doubleArrayMid == 25.0 +assert r.doubleArrayLast == 3.14159 +assert r.doubleArrayMin == 3.14159 +assert r.doubleArrayMax == 100.0 +assert r.strArraySize == 4 +assert r.strArrayFirst == "un" +assert r.strArrayMid == "deux" +assert r.strArrayLast == "quatre" +assert r.strArrayMin == "deux" +assert r.strArrayMax == "un" diff --git a/spec/nim/texpr_if_int_ops.nim b/spec/nim/texpr_if_int_ops.nim index f77793842..b60112b28 100644 --- a/spec/nim/texpr_if_int_ops.nim +++ b/spec/nim/texpr_if_int_ops.nim @@ -6,5 +6,5 @@ import auxiliary/test_utils let r = ExprIfIntOps.fromFile("src/process_coerce_switch.bin") -assert r.isEqPrim == bool(true) -assert r.isEqBoxed == bool(true) +assert r.isEqPrim == true +assert r.isEqBoxed == true diff --git a/spec/nim/texpr_int_div.nim b/spec/nim/texpr_int_div.nim index 223834295..c4371d860 100644 --- a/spec/nim/texpr_int_div.nim +++ b/spec/nim/texpr_int_div.nim @@ -6,9 +6,9 @@ import auxiliary/test_utils let r = ExprIntDiv.fromFile("src/fixed_struct.bin") -assert r.intU == uint32(1262698832) -assert r.intS == int32(-52947) -assert r.divPosConst == int(756) -assert r.divNegConst == int(-757) -assert r.divPosSeq == int(97130679) -assert r.divNegSeq == int(-4073) +assert r.intU == 1262698832 +assert r.intS == -52947 +assert r.divPosConst == 756 +assert r.divNegConst == -757 +assert r.divPosSeq == 97130679 +assert r.divNegSeq == -4073 diff --git a/spec/nim/texpr_io_eof.nim b/spec/nim/texpr_io_eof.nim index 8b0b48b1c..f53d1f23f 100644 --- a/spec/nim/texpr_io_eof.nim +++ b/spec/nim/texpr_io_eof.nim @@ -6,7 +6,7 @@ import auxiliary/test_utils let r = ExprIoEof.fromFile("src/fixed_struct.bin") -assert r.substream1.one == uint32(1262698832) +assert r.substream1.one == 1262698832 assert r.substream1.two == 0'u32 -assert r.substream2.one == uint32(4294914349'i64) -assert r.substream2.two == uint32(1262698832) +assert r.substream2.one == 4294914349'i64 +assert r.substream2.two == 1262698832 diff --git a/spec/nim/texpr_io_pos.nim b/spec/nim/texpr_io_pos.nim index 3f6c84c5a..17038411f 100644 --- a/spec/nim/texpr_io_pos.nim +++ b/spec/nim/texpr_io_pos.nim @@ -6,9 +6,9 @@ import auxiliary/test_utils let r = ExprIoPos.fromFile("src/expr_io_pos.bin") -assert r.substream1.myStr == string("CURIOSITY") +assert r.substream1.myStr == "CURIOSITY" assert r.substream1.body == @[17'u8, 34'u8, 51'u8, 68'u8] -assert r.substream1.number == uint16(66) -assert r.substream2.myStr == string("KILLED") +assert r.substream1.number == 66 +assert r.substream2.myStr == "KILLED" assert r.substream2.body == @[97'u8, 32'u8, 99'u8, 97'u8, 116'u8] -assert r.substream2.number == uint16(103) +assert r.substream2.number == 103 diff --git a/spec/nim/texpr_mod.nim b/spec/nim/texpr_mod.nim index 4e425ca19..40b306823 100644 --- a/spec/nim/texpr_mod.nim +++ b/spec/nim/texpr_mod.nim @@ -6,9 +6,9 @@ import auxiliary/test_utils let r = ExprMod.fromFile("src/fixed_struct.bin") -assert r.intU == uint32(1262698832) -assert r.intS == int32(-52947) -assert r.modPosConst == int(9) -assert r.modNegConst == int(4) -assert r.modPosSeq == int(5) -assert r.modNegSeq == int(2) +assert r.intU == 1262698832 +assert r.intS == -52947 +assert r.modPosConst == 9 +assert r.modNegConst == 4 +assert r.modPosSeq == 5 +assert r.modNegSeq == 2 diff --git a/spec/nim/texpr_ops_parens.nim b/spec/nim/texpr_ops_parens.nim index 68d1c84c8..438006e4b 100644 --- a/spec/nim/texpr_ops_parens.nim +++ b/spec/nim/texpr_ops_parens.nim @@ -6,12 +6,12 @@ import auxiliary/test_utils let r = ExprOpsParens.fromFile("src/enum_negative.bin") -assert r.iSumToStr == string("29") -assert r.fSumToInt == int(9) -assert r.strConcatLen == int(10) -assert r.strConcatRev == string("9876543210") -assert r.strConcatSubstr2To7 == string("23456") -assert r.strConcatToI == int(123456789) -assert r.boolEq == int(0) -assert r.boolAnd == int(0) -assert r.boolOr == int(1) +assert r.iSumToStr == "29" +assert r.fSumToInt == 9 +assert r.strConcatLen == 10 +assert r.strConcatRev == "9876543210" +assert r.strConcatSubstr2To7 == "23456" +assert r.strConcatToI == 123456789 +assert r.boolEq == 0 +assert r.boolAnd == 0 +assert r.boolOr == 1 diff --git a/spec/nim/texpr_sizeof_type_0.nim b/spec/nim/texpr_sizeof_type_0.nim index fcfeef276..1d42ef792 100644 --- a/spec/nim/texpr_sizeof_type_0.nim +++ b/spec/nim/texpr_sizeof_type_0.nim @@ -6,4 +6,4 @@ import auxiliary/test_utils let r = ExprSizeofType0.fromFile("src/fixed_struct.bin") -assert r.sizeofBlock == int(((1 + 4) + 2)) +assert r.sizeofBlock == ((1 + 4) + 2) diff --git a/spec/nim/texpr_sizeof_type_1.nim b/spec/nim/texpr_sizeof_type_1.nim index 982686b1a..73bd99a83 100644 --- a/spec/nim/texpr_sizeof_type_1.nim +++ b/spec/nim/texpr_sizeof_type_1.nim @@ -6,5 +6,5 @@ import auxiliary/test_utils let r = ExprSizeofType1.fromFile("src/fixed_struct.bin") -assert r.sizeofBlock == int((((1 + 4) + 2) + 4)) -assert r.sizeofSubblock == int(4) +assert r.sizeofBlock == (((1 + 4) + 2) + 4) +assert r.sizeofSubblock == 4 diff --git a/spec/nim/texpr_sizeof_value_0.nim b/spec/nim/texpr_sizeof_value_0.nim index 16118afbe..1fd275682 100644 --- a/spec/nim/texpr_sizeof_value_0.nim +++ b/spec/nim/texpr_sizeof_value_0.nim @@ -6,8 +6,8 @@ import auxiliary/test_utils let r = ExprSizeofValue0.fromFile("src/fixed_struct.bin") -assert r.selfSizeof == int((((1 + 4) + 2) + 2)) -assert r.sizeofBlock == int(((1 + 4) + 2)) -assert r.sizeofBlockA == int(1) -assert r.sizeofBlockB == int(4) -assert r.sizeofBlockC == int(2) +assert r.selfSizeof == (((1 + 4) + 2) + 2) +assert r.sizeofBlock == ((1 + 4) + 2) +assert r.sizeofBlockA == 1 +assert r.sizeofBlockB == 4 +assert r.sizeofBlockC == 2 diff --git a/spec/nim/texpr_sizeof_value_sized.nim b/spec/nim/texpr_sizeof_value_sized.nim index ad2ea0f0d..d8516766b 100644 --- a/spec/nim/texpr_sizeof_value_sized.nim +++ b/spec/nim/texpr_sizeof_value_sized.nim @@ -6,8 +6,8 @@ import auxiliary/test_utils let r = ExprSizeofValueSized.fromFile("src/fixed_struct.bin") -assert r.selfSizeof == int((12 + 2)) -assert r.sizeofBlock == int(12) -assert r.sizeofBlockA == int(1) -assert r.sizeofBlockB == int(4) -assert r.sizeofBlockC == int(2) +assert r.selfSizeof == (12 + 2) +assert r.sizeofBlock == 12 +assert r.sizeofBlockA == 1 +assert r.sizeofBlockB == 4 +assert r.sizeofBlockC == 2 diff --git a/spec/nim/texpr_str_encodings.nim b/spec/nim/texpr_str_encodings.nim index 29ad7c543..90cbd6a2d 100644 --- a/spec/nim/texpr_str_encodings.nim +++ b/spec/nim/texpr_str_encodings.nim @@ -6,10 +6,10 @@ import auxiliary/test_utils let r = ExprStrEncodings.fromFile("src/str_encodings.bin") -assert r.str1Eq == bool(true) -assert r.str2Eq == bool(true) -assert r.str3Eq == bool(true) -assert r.str3EqStr2 == bool(true) -assert r.str4Eq == bool(true) -assert r.str4GtStrCalc == bool(true) -assert r.str4GtStrFromBytes == bool(true) +assert r.str1Eq == true +assert r.str2Eq == true +assert r.str3Eq == true +assert r.str3EqStr2 == true +assert r.str4Eq == true +assert r.str4GtStrCalc == true +assert r.str4GtStrFromBytes == true diff --git a/spec/nim/texpr_str_ops.nim b/spec/nim/texpr_str_ops.nim index 8c59d413b..b530e23ab 100644 --- a/spec/nim/texpr_str_ops.nim +++ b/spec/nim/texpr_str_ops.nim @@ -6,20 +6,20 @@ import auxiliary/test_utils let r = ExprStrOps.fromFile("src/term_strz.bin") -assert r.one == string("foo|b") -assert r.oneLen == int(5) -assert r.oneRev == string("b|oof") -assert r.oneSubstr0To3 == string("foo") -assert r.oneSubstr2To5 == string("o|b") -assert r.oneSubstr3To3 == string("") -assert r.two == string("0123456789") -assert r.twoLen == int(10) -assert r.twoRev == string("9876543210") -assert r.twoSubstr0To7 == string("0123456") -assert r.twoSubstr4To10 == string("456789") -assert r.twoSubstr0To10 == string("0123456789") -assert r.toIAttr == int(9173) -assert r.toIR10 == int(-72) -assert r.toIR2 == int(86) -assert r.toIR8 == int(465) -assert r.toIR16 == int(18383) +assert r.one == "foo|b" +assert r.oneLen == 5 +assert r.oneRev == "b|oof" +assert r.oneSubstr0To3 == "foo" +assert r.oneSubstr2To5 == "o|b" +assert r.oneSubstr3To3 == "" +assert r.two == "0123456789" +assert r.twoLen == 10 +assert r.twoRev == "9876543210" +assert r.twoSubstr0To7 == "0123456" +assert r.twoSubstr4To10 == "456789" +assert r.twoSubstr0To10 == "0123456789" +assert r.toIAttr == 9173 +assert r.toIR10 == -72 +assert r.toIR2 == 86 +assert r.toIR8 == 465 +assert r.toIR16 == 18383 diff --git a/spec/nim/tfixed_struct.nim b/spec/nim/tfixed_struct.nim index a724e192a..234f28201 100644 --- a/spec/nim/tfixed_struct.nim +++ b/spec/nim/tfixed_struct.nim @@ -6,23 +6,23 @@ import auxiliary/test_utils let r = FixedStruct.fromFile("src/fixed_struct.bin") -assert r.hdr.uint8 == uint8(255) -assert r.hdr.uint16 == uint16(65535) -assert r.hdr.uint32 == uint32(4294967295'i64) -assert r.hdr.uint64 == uint64(18446744073709551615'u64) -assert r.hdr.sint8 == int8(-1) -assert r.hdr.sint16 == int16(-1) -assert r.hdr.sint32 == int32(-1) -assert r.hdr.sint64 == int64(-1) -assert r.hdr.uint16le == uint16(66) -assert r.hdr.uint32le == uint32(66) -assert r.hdr.uint64le == uint64(66) -assert r.hdr.sint16le == int16(-66) -assert r.hdr.sint32le == int32(-66) -assert r.hdr.sint64le == int64(-66) -assert r.hdr.uint16be == uint16(66) -assert r.hdr.uint32be == uint32(66) -assert r.hdr.uint64be == uint64(66) -assert r.hdr.sint16be == int16(-66) -assert r.hdr.sint32be == int32(-66) -assert r.hdr.sint64be == int64(-66) +assert r.hdr.uint8 == 255 +assert r.hdr.uint16 == 65535 +assert r.hdr.uint32 == 4294967295'i64 +assert r.hdr.uint64 == 18446744073709551615'u64 +assert r.hdr.sint8 == -1 +assert r.hdr.sint16 == -1 +assert r.hdr.sint32 == -1 +assert r.hdr.sint64 == -1 +assert r.hdr.uint16le == 66 +assert r.hdr.uint32le == 66 +assert r.hdr.uint64le == 66 +assert r.hdr.sint16le == -66 +assert r.hdr.sint32le == -66 +assert r.hdr.sint64le == -66 +assert r.hdr.uint16be == 66 +assert r.hdr.uint32be == 66 +assert r.hdr.uint64be == 66 +assert r.hdr.sint16be == -66 +assert r.hdr.sint32be == -66 +assert r.hdr.sint64be == -66 diff --git a/spec/nim/tfloat_to_i.nim b/spec/nim/tfloat_to_i.nim index 6ca299752..629a20f3c 100644 --- a/spec/nim/tfloat_to_i.nim +++ b/spec/nim/tfloat_to_i.nim @@ -6,11 +6,11 @@ import auxiliary/test_utils let r = FloatToI.fromFile("src/floating_points.bin") -assert r.singleValue == float32(0.5) -assert r.doubleValue == float64(0.25) -assert r.singleI == int(0) -assert r.doubleI == int(0) -assert r.float1I == int(1) -assert r.float2I == int(1) -assert r.float3I == int(1) -assert r.float4I == int(-2) +assert r.singleValue == 0.5 +assert r.doubleValue == 0.25 +assert r.singleI == 0 +assert r.doubleI == 0 +assert r.float1I == 1 +assert r.float2I == 1 +assert r.float3I == 1 +assert r.float4I == -2 diff --git a/spec/nim/tfloating_points.nim b/spec/nim/tfloating_points.nim index ff99b22ff..61976ed99 100644 --- a/spec/nim/tfloating_points.nim +++ b/spec/nim/tfloating_points.nim @@ -6,11 +6,11 @@ import auxiliary/test_utils let r = FloatingPoints.fromFile("src/floating_points.bin") -assert r.singleValue == float32((float32(0.5))) -assert r.singleValueBe == float32((float32(0.5))) -assert r.doubleValue == float64(0.25) -assert r.doubleValueBe == float64(0.25) -assert r.approximateValue == float32(1.2345) -assert r.singleValuePlusInt == float64(1.5) -assert r.singleValuePlusFloat == float64(1.0) -assert r.doubleValuePlusFloat == float64(0.3) +assert r.singleValue == (float32(0.5)) +assert r.singleValueBe == (float32(0.5)) +assert r.doubleValue == 0.25 +assert r.doubleValueBe == 0.25 +assert r.approximateValue == 1.2345 +assert r.singleValuePlusInt == 1.5 +assert r.singleValuePlusFloat == 1.0 +assert r.doubleValuePlusFloat == 0.3 diff --git a/spec/nim/thello_world.nim b/spec/nim/thello_world.nim index 7b5700f2b..ca3a6cfaf 100644 --- a/spec/nim/thello_world.nim +++ b/spec/nim/thello_world.nim @@ -6,4 +6,4 @@ import auxiliary/test_utils let r = HelloWorld.fromFile("src/fixed_struct.bin") -assert r.one == uint8(80) +assert r.one == 80 diff --git a/spec/nim/tif_struct.nim b/spec/nim/tif_struct.nim index d79b18c71..42fd043ae 100644 --- a/spec/nim/tif_struct.nim +++ b/spec/nim/tif_struct.nim @@ -6,10 +6,10 @@ import auxiliary/test_utils let r = IfStruct.fromFile("src/if_struct.bin") -assert r.op1.opcode == uint8(83) -assert r.op1.argStr.str == string("foo") -assert r.op2.opcode == uint8(84) -assert r.op2.argTuple.num1 == uint8(66) -assert r.op2.argTuple.num2 == uint8(67) -assert r.op3.opcode == uint8(83) -assert r.op3.argStr.str == string("bar") +assert r.op1.opcode == 83 +assert r.op1.argStr.str == "foo" +assert r.op2.opcode == 84 +assert r.op2.argTuple.num1 == 66 +assert r.op2.argTuple.num2 == 67 +assert r.op3.opcode == 83 +assert r.op3.argStr.str == "bar" diff --git a/spec/nim/tif_values.nim b/spec/nim/tif_values.nim index cd931fc09..8984e037a 100644 --- a/spec/nim/tif_values.nim +++ b/spec/nim/tif_values.nim @@ -6,9 +6,9 @@ import auxiliary/test_utils let r = IfValues.fromFile("src/fixed_struct.bin") -assert r.codes[0].opcode == uint8(80) -assert r.codes[0].halfOpcode == int(40) -assert r.codes[1].opcode == uint8(65) +assert r.codes[0].opcode == 80 +assert r.codes[0].halfOpcode == 40 +assert r.codes[1].opcode == 65 assert r.codes[1].halfOpcode == 0 -assert r.codes[2].opcode == uint8(67) +assert r.codes[2].opcode == 67 assert r.codes[2].halfOpcode == 0 diff --git a/spec/nim/timports0.nim b/spec/nim/timports0.nim index 1f6985af1..5db6320d5 100644 --- a/spec/nim/timports0.nim +++ b/spec/nim/timports0.nim @@ -7,6 +7,6 @@ import auxiliary/test_utils let r = Imports0.fromFile("src/fixed_struct.bin") -assert r.two == uint8(80) -assert r.hw.one == uint8(65) -assert r.hwOne == uint8(65) +assert r.two == 80 +assert r.hw.one == 65 +assert r.hwOne == 65 diff --git a/spec/nim/timports_abs.nim b/spec/nim/timports_abs.nim index 5d1a15b0e..d41c3349e 100644 --- a/spec/nim/timports_abs.nim +++ b/spec/nim/timports_abs.nim @@ -7,5 +7,5 @@ import auxiliary/test_utils let r = ImportsAbs.fromFile("src/fixed_struct.bin") -assert r.len.value == int(80) -assert len(r.body) == int(80) +assert r.len.value == 80 +assert len(r.body) == 80 diff --git a/spec/nim/timports_circular_a.nim b/spec/nim/timports_circular_a.nim index 4f13cfa3d..0fdacd0a2 100644 --- a/spec/nim/timports_circular_a.nim +++ b/spec/nim/timports_circular_a.nim @@ -7,8 +7,8 @@ import auxiliary/test_utils let r = ImportsCircularA.fromFile("src/fixed_struct.bin") -assert r.code == uint8(80) -assert r.two.initial == uint8(65) -assert r.two.backRef.code == uint8(67) -assert r.two.backRef.two.initial == uint8(75) +assert r.code == 80 +assert r.two.initial == 65 +assert r.two.backRef.code == 67 +assert r.two.backRef.two.initial == 75 assert r.two.backRef.two.backRef == nil diff --git a/spec/nim/timports_rel_1.nim b/spec/nim/timports_rel_1.nim index 630e63d0c..dc14d959d 100644 --- a/spec/nim/timports_rel_1.nim +++ b/spec/nim/timports_rel_1.nim @@ -8,6 +8,6 @@ import auxiliary/test_utils let r = ImportsRel1.fromFile("src/fixed_struct.bin") -assert r.one == uint8(80) -assert r.two.one == uint8(65) -assert r.two.two.one == uint8(67) +assert r.one == 80 +assert r.two.one == 65 +assert r.two.two.one == 67 diff --git a/spec/nim/tindex_sizes.nim b/spec/nim/tindex_sizes.nim index 9addaaf5e..1207203d7 100644 --- a/spec/nim/tindex_sizes.nim +++ b/spec/nim/tindex_sizes.nim @@ -6,10 +6,10 @@ import auxiliary/test_utils let r = IndexSizes.fromFile("src/index_sizes.bin") -assert r.qty == uint32(3) -assert r.sizes[0] == uint32(1) -assert r.sizes[1] == uint32(8) -assert r.sizes[2] == uint32(4) -assert r.bufs[0] == string("A") -assert r.bufs[1] == string("BBBBBBBB") -assert r.bufs[2] == string("CCCC") +assert r.qty == 3 +assert r.sizes[0] == 1 +assert r.sizes[1] == 8 +assert r.sizes[2] == 4 +assert r.bufs[0] == "A" +assert r.bufs[1] == "BBBBBBBB" +assert r.bufs[2] == "CCCC" diff --git a/spec/nim/tindex_to_param_eos.nim b/spec/nim/tindex_to_param_eos.nim index 15c9e1c39..c4aea35ae 100644 --- a/spec/nim/tindex_to_param_eos.nim +++ b/spec/nim/tindex_to_param_eos.nim @@ -6,10 +6,10 @@ import auxiliary/test_utils let r = IndexToParamEos.fromFile("src/index_sizes.bin") -assert r.qty == uint32(3) -assert r.sizes[0] == uint32(1) -assert r.sizes[1] == uint32(8) -assert r.sizes[2] == uint32(4) -assert r.blocks[0].buf == string("A") -assert r.blocks[1].buf == string("BBBBBBBB") -assert r.blocks[2].buf == string("CCCC") +assert r.qty == 3 +assert r.sizes[0] == 1 +assert r.sizes[1] == 8 +assert r.sizes[2] == 4 +assert r.blocks[0].buf == "A" +assert r.blocks[1].buf == "BBBBBBBB" +assert r.blocks[2].buf == "CCCC" diff --git a/spec/nim/tindex_to_param_expr.nim b/spec/nim/tindex_to_param_expr.nim index 8ef987152..650459b87 100644 --- a/spec/nim/tindex_to_param_expr.nim +++ b/spec/nim/tindex_to_param_expr.nim @@ -6,10 +6,10 @@ import auxiliary/test_utils let r = IndexToParamExpr.fromFile("src/index_sizes.bin") -assert r.qty == uint32(3) -assert r.sizes[0] == uint32(1) -assert r.sizes[1] == uint32(8) -assert r.sizes[2] == uint32(4) -assert r.blocks[0].buf == string("A") -assert r.blocks[1].buf == string("BBBBBBBB") -assert r.blocks[2].buf == string("CCCC") +assert r.qty == 3 +assert r.sizes[0] == 1 +assert r.sizes[1] == 8 +assert r.sizes[2] == 4 +assert r.blocks[0].buf == "A" +assert r.blocks[1].buf == "BBBBBBBB" +assert r.blocks[2].buf == "CCCC" diff --git a/spec/nim/tindex_to_param_until.nim b/spec/nim/tindex_to_param_until.nim index 2450f9e9f..e6cbb1e12 100644 --- a/spec/nim/tindex_to_param_until.nim +++ b/spec/nim/tindex_to_param_until.nim @@ -6,10 +6,10 @@ import auxiliary/test_utils let r = IndexToParamUntil.fromFile("src/index_sizes.bin") -assert r.qty == uint32(3) -assert r.sizes[0] == uint32(1) -assert r.sizes[1] == uint32(8) -assert r.sizes[2] == uint32(4) -assert r.blocks[0].buf == string("A") -assert r.blocks[1].buf == string("BBBBBBBB") -assert r.blocks[2].buf == string("CCCC") +assert r.qty == 3 +assert r.sizes[0] == 1 +assert r.sizes[1] == 8 +assert r.sizes[2] == 4 +assert r.blocks[0].buf == "A" +assert r.blocks[1].buf == "BBBBBBBB" +assert r.blocks[2].buf == "CCCC" diff --git a/spec/nim/tinstance_io_user.nim b/spec/nim/tinstance_io_user.nim index 26c48084c..0d51797f4 100644 --- a/spec/nim/tinstance_io_user.nim +++ b/spec/nim/tinstance_io_user.nim @@ -6,7 +6,7 @@ import auxiliary/test_utils let r = InstanceIoUser.fromFile("src/instance_io.bin") -assert r.qtyEntries == uint32(3) -assert r.entries[0].name == string("the") -assert r.entries[1].name == string("rainy") -assert r.entries[2].name == string("day it is") +assert r.qtyEntries == 3 +assert r.entries[0].name == "the" +assert r.entries[1].name == "rainy" +assert r.entries[2].name == "day it is" diff --git a/spec/nim/tinstance_std.nim b/spec/nim/tinstance_std.nim index 214b5fd1c..b3faea21f 100644 --- a/spec/nim/tinstance_std.nim +++ b/spec/nim/tinstance_std.nim @@ -6,4 +6,4 @@ import auxiliary/test_utils let r = InstanceStd.fromFile("src/str_encodings.bin") -assert r.header == string("Some ") +assert r.header == "Some " diff --git a/spec/nim/tinstance_std_array.nim b/spec/nim/tinstance_std_array.nim index d6373d227..4792d7f12 100644 --- a/spec/nim/tinstance_std_array.nim +++ b/spec/nim/tinstance_std_array.nim @@ -6,10 +6,10 @@ import auxiliary/test_utils let r = InstanceStdArray.fromFile("src/instance_std_array.bin") -assert r.ofs == uint32(16) -assert r.qtyEntries == uint32(3) -assert r.entrySize == uint32(4) -assert len(r.entries) == int(3) +assert r.ofs == 16 +assert r.qtyEntries == 3 +assert r.entrySize == 4 +assert len(r.entries) == 3 assert r.entries[0] == @[17'u8, 17'u8, 17'u8, 17'u8] assert r.entries[1] == @[34'u8, 34'u8, 34'u8, 34'u8] assert r.entries[2] == @[51'u8, 51'u8, 51'u8, 51'u8] diff --git a/spec/nim/tinstance_user_array.nim b/spec/nim/tinstance_user_array.nim index 1f5aa6144..215ec27d4 100644 --- a/spec/nim/tinstance_user_array.nim +++ b/spec/nim/tinstance_user_array.nim @@ -6,13 +6,13 @@ import auxiliary/test_utils let r = InstanceUserArray.fromFile("src/instance_std_array.bin") -assert r.ofs == uint32(16) -assert r.qtyEntries == uint32(3) -assert r.entrySize == uint32(4) -assert len(r.userEntries) == int(3) -assert r.userEntries[0].word1 == uint16(4369) -assert r.userEntries[0].word2 == uint16(4369) -assert r.userEntries[1].word1 == uint16(8738) -assert r.userEntries[1].word2 == uint16(8738) -assert r.userEntries[2].word1 == uint16(13107) -assert r.userEntries[2].word2 == uint16(13107) +assert r.ofs == 16 +assert r.qtyEntries == 3 +assert r.entrySize == 4 +assert len(r.userEntries) == 3 +assert r.userEntries[0].word1 == 4369 +assert r.userEntries[0].word2 == 4369 +assert r.userEntries[1].word1 == 8738 +assert r.userEntries[1].word2 == 8738 +assert r.userEntries[2].word1 == 13107 +assert r.userEntries[2].word2 == 13107 diff --git a/spec/nim/tintegers.nim b/spec/nim/tintegers.nim index 5c52a7d6e..4a2c57928 100644 --- a/spec/nim/tintegers.nim +++ b/spec/nim/tintegers.nim @@ -6,23 +6,23 @@ import auxiliary/test_utils let r = Integers.fromFile("src/fixed_struct.bin") -assert r.uint8 == uint8(255) -assert r.uint16 == uint16(65535) -assert r.uint32 == uint32(4294967295'i64) -assert r.uint64 == uint64(18446744073709551615'u64) -assert r.sint8 == int8(-1) -assert r.sint16 == int16(-1) -assert r.sint32 == int32(-1) -assert r.sint64 == int64(-1) -assert r.uint16le == uint16(66) -assert r.uint32le == uint32(66) -assert r.uint64le == uint64(66) -assert r.sint16le == int16(-66) -assert r.sint32le == int32(-66) -assert r.sint64le == int64(-66) -assert r.uint16be == uint16(66) -assert r.uint32be == uint32(66) -assert r.uint64be == uint64(66) -assert r.sint16be == int16(-66) -assert r.sint32be == int32(-66) -assert r.sint64be == int64(-66) +assert r.uint8 == 255 +assert r.uint16 == 65535 +assert r.uint32 == 4294967295'i64 +assert r.uint64 == 18446744073709551615'u64 +assert r.sint8 == -1 +assert r.sint16 == -1 +assert r.sint32 == -1 +assert r.sint64 == -1 +assert r.uint16le == 66 +assert r.uint32le == 66 +assert r.uint64le == 66 +assert r.sint16le == -66 +assert r.sint32le == -66 +assert r.sint64le == -66 +assert r.uint16be == 66 +assert r.uint32be == 66 +assert r.uint64be == 66 +assert r.sint16be == -66 +assert r.sint32be == -66 +assert r.sint64be == -66 diff --git a/spec/nim/tintegers_double_overflow.nim b/spec/nim/tintegers_double_overflow.nim index 3b53dff30..89d47936c 100644 --- a/spec/nim/tintegers_double_overflow.nim +++ b/spec/nim/tintegers_double_overflow.nim @@ -7,11 +7,11 @@ import strutils let r = IntegersDoubleOverflow.fromFile("src/integers_double_overflow.bin") -assert r.signedSafeMinBe == int64(-9007199254740991'i64) -assert r.signedSafeMinLe == int64(-9007199254740991'i64) -assert r.signedSafeMaxBe == int64(9007199254740991'i64) -assert r.signedSafeMaxLe == int64(9007199254740991'i64) -assert intToStr(int(r.signedUnsafeNegBe)) == string("-9007199254740993") -assert intToStr(int(r.signedUnsafeNegLe)) == string("-9007199254740993") -assert intToStr(int(r.signedUnsafePosBe)) == string("9007199254740993") -assert intToStr(int(r.signedUnsafePosBe)) == string("9007199254740993") +assert r.signedSafeMinBe == -9007199254740991'i64 +assert r.signedSafeMinLe == -9007199254740991'i64 +assert r.signedSafeMaxBe == 9007199254740991'i64 +assert r.signedSafeMaxLe == 9007199254740991'i64 +assert intToStr(int(r.signedUnsafeNegBe)) == "-9007199254740993" +assert intToStr(int(r.signedUnsafeNegLe)) == "-9007199254740993" +assert intToStr(int(r.signedUnsafePosBe)) == "9007199254740993" +assert intToStr(int(r.signedUnsafePosBe)) == "9007199254740993" diff --git a/spec/nim/tintegers_min_max.nim b/spec/nim/tintegers_min_max.nim index f0e158dd9..16b396745 100644 --- a/spec/nim/tintegers_min_max.nim +++ b/spec/nim/tintegers_min_max.nim @@ -6,31 +6,31 @@ import auxiliary/test_utils let r = IntegersMinMax.fromFile("src/integers_min_max.bin") -assert r.unsignedMin.u1 == uint8(0) -assert r.unsignedMin.u2le == uint16(0) -assert r.unsignedMin.u4le == uint32(0) -assert r.unsignedMin.u8le == uint64(0) -assert r.unsignedMin.u2be == uint16(0) -assert r.unsignedMin.u4be == uint32(0) -assert r.unsignedMin.u8be == uint64(0) -assert r.unsignedMax.u1 == uint8(255) -assert r.unsignedMax.u2le == uint16(65535) -assert r.unsignedMax.u4le == uint32(4294967295'i64) -assert r.unsignedMax.u8le == uint64(18446744073709551615'u64) -assert r.unsignedMax.u2be == uint16(65535) -assert r.unsignedMax.u4be == uint32(4294967295'i64) -assert r.unsignedMax.u8be == uint64(18446744073709551615'u64) -assert r.signedMin.s1 == int8(-128) -assert r.signedMin.s2le == int16(-32768) -assert r.signedMin.s4le == int32(-2147483648'i64) -assert r.signedMin.s8le == int64(-9223372036854775808'u64) -assert r.signedMin.s2be == int16(-32768) -assert r.signedMin.s4be == int32(-2147483648'i64) -assert r.signedMin.s8be == int64(-9223372036854775808'u64) -assert r.signedMax.s1 == int8(127) -assert r.signedMax.s2le == int16(32767) -assert r.signedMax.s4le == int32(2147483647) -assert r.signedMax.s8le == int64(9223372036854775807'i64) -assert r.signedMax.s2be == int16(32767) -assert r.signedMax.s4be == int32(2147483647) -assert r.signedMax.s8be == int64(9223372036854775807'i64) +assert r.unsignedMin.u1 == 0 +assert r.unsignedMin.u2le == 0 +assert r.unsignedMin.u4le == 0 +assert r.unsignedMin.u8le == 0 +assert r.unsignedMin.u2be == 0 +assert r.unsignedMin.u4be == 0 +assert r.unsignedMin.u8be == 0 +assert r.unsignedMax.u1 == 255 +assert r.unsignedMax.u2le == 65535 +assert r.unsignedMax.u4le == 4294967295'i64 +assert r.unsignedMax.u8le == 18446744073709551615'u64 +assert r.unsignedMax.u2be == 65535 +assert r.unsignedMax.u4be == 4294967295'i64 +assert r.unsignedMax.u8be == 18446744073709551615'u64 +assert r.signedMin.s1 == -128 +assert r.signedMin.s2le == -32768 +assert r.signedMin.s4le == -2147483648'i64 +assert r.signedMin.s8le == -9223372036854775808'u64 +assert r.signedMin.s2be == -32768 +assert r.signedMin.s4be == -2147483648'i64 +assert r.signedMin.s8be == -9223372036854775808'u64 +assert r.signedMax.s1 == 127 +assert r.signedMax.s2le == 32767 +assert r.signedMax.s4le == 2147483647 +assert r.signedMax.s8le == 9223372036854775807'i64 +assert r.signedMax.s2be == 32767 +assert r.signedMax.s4be == 2147483647 +assert r.signedMax.s8be == 9223372036854775807'i64 diff --git a/spec/nim/tio_local_var.nim b/spec/nim/tio_local_var.nim index 83a1cef61..50bbe6754 100644 --- a/spec/nim/tio_local_var.nim +++ b/spec/nim/tio_local_var.nim @@ -7,4 +7,4 @@ import auxiliary/test_utils let r = IoLocalVar.fromFile("src/full256.bin") assert r.skip == @[0'u8, 1'u8, 2'u8, 3'u8, 4'u8, 5'u8, 6'u8, 7'u8, 8'u8, 9'u8, 10'u8, 11'u8, 12'u8, 13'u8, 14'u8, 15'u8, 16'u8, 17'u8, 18'u8, 19'u8] -assert r.followup == uint8(20) +assert r.followup == 20 diff --git a/spec/nim/tjs_signed_right_shift.nim b/spec/nim/tjs_signed_right_shift.nim index 1f37d5354..7da5c644f 100644 --- a/spec/nim/tjs_signed_right_shift.nim +++ b/spec/nim/tjs_signed_right_shift.nim @@ -6,5 +6,5 @@ import auxiliary/test_utils let r = JsSignedRightShift.fromFile("src/fixed_struct.bin") -assert r.shouldBe40000000 == int(1073741824) -assert r.shouldBeA00000 == int(10485760) +assert r.shouldBe40000000 == 1073741824 +assert r.shouldBeA00000 == 10485760 diff --git a/spec/nim/tmultiple_use.nim b/spec/nim/tmultiple_use.nim index afb219c0b..7602a40df 100644 --- a/spec/nim/tmultiple_use.nim +++ b/spec/nim/tmultiple_use.nim @@ -6,5 +6,5 @@ import auxiliary/test_utils let r = MultipleUse.fromFile("src/position_abs.bin") -assert r.t1.firstUse.value == int32(32) -assert r.t2.secondUse.value == int32(32) +assert r.t1.firstUse.value == 32 +assert r.t2.secondUse.value == 32 diff --git a/spec/nim/tnav_parent.nim b/spec/nim/tnav_parent.nim index bf7c90190..e46720175 100644 --- a/spec/nim/tnav_parent.nim +++ b/spec/nim/tnav_parent.nim @@ -6,8 +6,8 @@ import auxiliary/test_utils let r = NavParent.fromFile("src/nav.bin") -assert r.header.qtyEntries == uint32(2) -assert r.header.filenameLen == uint32(8) -assert len(r.index.entries) == int(2) -assert r.index.entries[0].filename == string("FIRST___") -assert r.index.entries[1].filename == string("SECOND__") +assert r.header.qtyEntries == 2 +assert r.header.filenameLen == 8 +assert len(r.index.entries) == 2 +assert r.index.entries[0].filename == "FIRST___" +assert r.index.entries[1].filename == "SECOND__" diff --git a/spec/nim/tnav_parent2.nim b/spec/nim/tnav_parent2.nim index 70639ac12..690ab686d 100644 --- a/spec/nim/tnav_parent2.nim +++ b/spec/nim/tnav_parent2.nim @@ -6,13 +6,13 @@ import auxiliary/test_utils let r = NavParent2.fromFile("src/nav_parent2.bin") -assert r.ofsTags == uint32(8) -assert r.numTags == uint32(2) -assert r.tags[0].name == string("RAHC") -assert r.tags[0].ofs == uint32(32) -assert r.tags[0].numItems == uint32(3) -assert r.tags[0].tagContent.content == string("foo") -assert r.tags[1].name == string("RAHC") -assert r.tags[1].ofs == uint32(35) -assert r.tags[1].numItems == uint32(6) -assert r.tags[1].tagContent.content == string("barbaz") +assert r.ofsTags == 8 +assert r.numTags == 2 +assert r.tags[0].name == "RAHC" +assert r.tags[0].ofs == 32 +assert r.tags[0].numItems == 3 +assert r.tags[0].tagContent.content == "foo" +assert r.tags[1].name == "RAHC" +assert r.tags[1].ofs == 35 +assert r.tags[1].numItems == 6 +assert r.tags[1].tagContent.content == "barbaz" diff --git a/spec/nim/tnav_parent3.nim b/spec/nim/tnav_parent3.nim index 073b068e0..716b6154a 100644 --- a/spec/nim/tnav_parent3.nim +++ b/spec/nim/tnav_parent3.nim @@ -6,13 +6,13 @@ import auxiliary/test_utils let r = NavParent3.fromFile("src/nav_parent2.bin") -assert r.ofsTags == uint32(8) -assert r.numTags == uint32(2) -assert r.tags[0].name == string("RAHC") -assert r.tags[0].ofs == uint32(32) -assert r.tags[0].numItems == uint32(3) -assert r.tags[0].tagContent.content == string("foo") -assert r.tags[1].name == string("RAHC") -assert r.tags[1].ofs == uint32(35) -assert r.tags[1].numItems == uint32(6) -assert r.tags[1].tagContent.content == string("barbaz") +assert r.ofsTags == 8 +assert r.numTags == 2 +assert r.tags[0].name == "RAHC" +assert r.tags[0].ofs == 32 +assert r.tags[0].numItems == 3 +assert r.tags[0].tagContent.content == "foo" +assert r.tags[1].name == "RAHC" +assert r.tags[1].ofs == 35 +assert r.tags[1].numItems == 6 +assert r.tags[1].tagContent.content == "barbaz" diff --git a/spec/nim/tnav_parent_false.nim b/spec/nim/tnav_parent_false.nim index 9e357cf94..9c765bb06 100644 --- a/spec/nim/tnav_parent_false.nim +++ b/spec/nim/tnav_parent_false.nim @@ -6,8 +6,8 @@ import auxiliary/test_utils let r = NavParentFalse.fromFile("src/nav_parent_codes.bin") -assert r.childSize == uint8(3) -assert r.elementA.foo.code == uint8(73) +assert r.childSize == 3 +assert r.elementA.foo.code == 73 assert r.elementA.foo.more == @[49'u8, 50'u8, 51'u8] -assert r.elementA.bar.foo.code == uint8(66) -assert r.elementB.foo.code == uint8(98) +assert r.elementA.bar.foo.code == 66 +assert r.elementB.foo.code == 98 diff --git a/spec/nim/tnav_parent_false2.nim b/spec/nim/tnav_parent_false2.nim index b8437f5d6..c7698cf2a 100644 --- a/spec/nim/tnav_parent_false2.nim +++ b/spec/nim/tnav_parent_false2.nim @@ -6,4 +6,4 @@ import auxiliary/test_utils let r = NavParentFalse2.fromFile("src/fixed_struct.bin") -assert r.parentless.foo == uint8(80) +assert r.parentless.foo == 80 diff --git a/spec/nim/tnav_parent_override.nim b/spec/nim/tnav_parent_override.nim index ce8cb8d21..52c0b12f5 100644 --- a/spec/nim/tnav_parent_override.nim +++ b/spec/nim/tnav_parent_override.nim @@ -6,6 +6,6 @@ import auxiliary/test_utils let r = NavParentOverride.fromFile("src/nav_parent_codes.bin") -assert r.childSize == uint8(3) +assert r.childSize == 3 assert r.child1.data == @[73'u8, 49'u8, 50'u8] assert r.mediator2.child2.data == @[51'u8, 66'u8, 98'u8] diff --git a/spec/nim/tnav_parent_switch.nim b/spec/nim/tnav_parent_switch.nim index 90e61ee54..2f8905e45 100644 --- a/spec/nim/tnav_parent_switch.nim +++ b/spec/nim/tnav_parent_switch.nim @@ -6,6 +6,6 @@ import auxiliary/test_utils let r = NavParentSwitch.fromFile("src/nav_parent_switch.bin") -assert r.category == uint8(1) -assert (NavParentSwitch_Element1(r.content)).foo == uint8(66) -assert (NavParentSwitch_Element1(r.content)).subelement.bar == uint8(255) +assert r.category == 1 +assert (NavParentSwitch_Element1(r.content)).foo == 66 +assert (NavParentSwitch_Element1(r.content)).subelement.bar == 255 diff --git a/spec/nim/tnav_parent_switch_cast.nim b/spec/nim/tnav_parent_switch_cast.nim index 0240622d5..2fbece8e7 100644 --- a/spec/nim/tnav_parent_switch_cast.nim +++ b/spec/nim/tnav_parent_switch_cast.nim @@ -6,6 +6,6 @@ import auxiliary/test_utils let r = NavParentSwitchCast.fromFile("src/switch_integers.bin") -assert r.main.bufType == uint8(1) -assert r.main.flag == uint8(7) -assert (NavParentSwitchCast_Foo_One(r.main.buf)).branch.flag == uint8(7) +assert r.main.bufType == 1 +assert r.main.flag == 7 +assert (NavParentSwitchCast_Foo_One(r.main.buf)).branch.flag == 7 diff --git a/spec/nim/tnav_parent_vs_value_inst.nim b/spec/nim/tnav_parent_vs_value_inst.nim index bb7be2726..aaa9a2919 100644 --- a/spec/nim/tnav_parent_vs_value_inst.nim +++ b/spec/nim/tnav_parent_vs_value_inst.nim @@ -6,4 +6,4 @@ import auxiliary/test_utils let r = NavParentVsValueInst.fromFile("src/term_strz.bin") -assert r.s1 == string("foo") +assert r.s1 == "foo" diff --git a/spec/nim/tnav_root.nim b/spec/nim/tnav_root.nim index da1f799e3..f0ea6ad21 100644 --- a/spec/nim/tnav_root.nim +++ b/spec/nim/tnav_root.nim @@ -6,8 +6,8 @@ import auxiliary/test_utils let r = NavRoot.fromFile("src/nav.bin") -assert r.header.qtyEntries == uint32(2) -assert r.header.filenameLen == uint32(8) -assert len(r.index.entries) == int(2) -assert r.index.entries[0].filename == string("FIRST___") -assert r.index.entries[1].filename == string("SECOND__") +assert r.header.qtyEntries == 2 +assert r.header.filenameLen == 8 +assert len(r.index.entries) == 2 +assert r.index.entries[0].filename == "FIRST___" +assert r.index.entries[1].filename == "SECOND__" diff --git a/spec/nim/tnested_same_name.nim b/spec/nim/tnested_same_name.nim index fdc440e1c..95d51c240 100644 --- a/spec/nim/tnested_same_name.nim +++ b/spec/nim/tnested_same_name.nim @@ -6,5 +6,5 @@ import auxiliary/test_utils let r = NestedSameName.fromFile("src/repeat_n_struct.bin") -assert r.mainData.mainSize == int32(2) +assert r.mainData.mainSize == 2 assert r.mainData.foo.data == @[16'u8, 0'u8, 0'u8, 0'u8] diff --git a/spec/nim/tnested_same_name2.nim b/spec/nim/tnested_same_name2.nim index a357a1db2..b39076953 100644 --- a/spec/nim/tnested_same_name2.nim +++ b/spec/nim/tnested_same_name2.nim @@ -6,8 +6,8 @@ import auxiliary/test_utils let r = NestedSameName2.fromFile("src/nested_same_name2.bin") -assert r.version == uint32(66) -assert r.mainData.mainSize == int32(2) +assert r.version == 66 +assert r.mainData.mainSize == 2 assert r.mainData.foo.data1 == @[17'u8, 17'u8, 17'u8, 17'u8] -assert r.dummy.dummySize == int32(3) +assert r.dummy.dummySize == 3 assert r.dummy.foo.data2 == @[34'u8, 34'u8, 34'u8, 34'u8, 34'u8, 34'u8] diff --git a/spec/nim/tnested_type_param.nim b/spec/nim/tnested_type_param.nim index d93eb639a..60db5fbc2 100644 --- a/spec/nim/tnested_type_param.nim +++ b/spec/nim/tnested_type_param.nim @@ -6,5 +6,5 @@ import auxiliary/test_utils let r = NestedTypeParam.fromFile("src/term_strz.bin") -assert r.mainSeq.myLen == uint32(5) -assert r.mainSeq.body == string("foo|b") +assert r.mainSeq.myLen == 5 +assert r.mainSeq.body == "foo|b" diff --git a/spec/nim/tnested_types.nim b/spec/nim/tnested_types.nim index 5443a6742..cfdb8ceaf 100644 --- a/spec/nim/tnested_types.nim +++ b/spec/nim/tnested_types.nim @@ -6,6 +6,6 @@ import auxiliary/test_utils let r = NestedTypes.fromFile("src/fixed_struct.bin") -assert r.one.typedAtRoot.valueB == int8(80) -assert r.one.typedHere.valueC == int8(65) -assert r.two.valueB == int8(67) +assert r.one.typedAtRoot.valueB == 80 +assert r.one.typedHere.valueC == 65 +assert r.two.valueB == 67 diff --git a/spec/nim/tnested_types2.nim b/spec/nim/tnested_types2.nim index 4c8d41a77..d0eb71836 100644 --- a/spec/nim/tnested_types2.nim +++ b/spec/nim/tnested_types2.nim @@ -6,10 +6,10 @@ import auxiliary/test_utils let r = NestedTypes2.fromFile("src/fixed_struct.bin") -assert r.one.typedAtRoot.valueB == int8(80) -assert r.one.typedHere1.valueC == int8(65) -assert r.one.typedHere1.typedHere.valueD == int8(67) -assert r.one.typedHere1.typedParent.valueCc == int8(75) -assert r.one.typedHere1.typedRoot.valueB == int8(45) -assert r.one.typedHere2.valueCc == int8(49) -assert r.two.valueB == int8(-1) +assert r.one.typedAtRoot.valueB == 80 +assert r.one.typedHere1.valueC == 65 +assert r.one.typedHere1.typedHere.valueD == 67 +assert r.one.typedHere1.typedParent.valueCc == 75 +assert r.one.typedHere1.typedRoot.valueB == 45 +assert r.one.typedHere2.valueCc == 49 +assert r.two.valueB == -1 diff --git a/spec/nim/tnested_types3.nim b/spec/nim/tnested_types3.nim index 0d81f08d0..683e21baa 100644 --- a/spec/nim/tnested_types3.nim +++ b/spec/nim/tnested_types3.nim @@ -6,8 +6,8 @@ import auxiliary/test_utils let r = NestedTypes3.fromFile("src/fixed_struct.bin") -assert r.aCc.valueCc == int8(80) -assert r.aCD.valueD == int8(65) -assert r.b.valueB == int8(67) -assert r.b.aCc.valueCc == int8(75) -assert r.b.aCD.valueD == int8(45) +assert r.aCc.valueCc == 80 +assert r.aCD.valueD == 65 +assert r.b.valueB == 67 +assert r.b.aCc.valueCc == 75 +assert r.b.aCD.valueD == 45 diff --git a/spec/nim/tnon_standard.nim b/spec/nim/tnon_standard.nim index 6db2915f7..a8aa3c005 100644 --- a/spec/nim/tnon_standard.nim +++ b/spec/nim/tnon_standard.nim @@ -6,4 +6,4 @@ import auxiliary/test_utils let r = NonStandard.fromFile("src/fixed_struct.bin") -assert r.foo == uint8(80) +assert r.foo == 80 diff --git a/spec/nim/tparams_call_extra_parens.nim b/spec/nim/tparams_call_extra_parens.nim index 89ae157c5..afe973a13 100644 --- a/spec/nim/tparams_call_extra_parens.nim +++ b/spec/nim/tparams_call_extra_parens.nim @@ -6,4 +6,4 @@ import auxiliary/test_utils let r = ParamsCallExtraParens.fromFile("src/term_strz.bin") -assert r.buf1.body == string("foo|b") +assert r.buf1.body == "foo|b" diff --git a/spec/nim/tparams_call_short.nim b/spec/nim/tparams_call_short.nim index 9eac6647b..d62f533bf 100644 --- a/spec/nim/tparams_call_short.nim +++ b/spec/nim/tparams_call_short.nim @@ -6,6 +6,6 @@ import auxiliary/test_utils let r = ParamsCallShort.fromFile("src/term_strz.bin") -assert r.buf1.body == string("foo|b") -assert r.buf2.body == string("ar|ba") -assert r.buf2.trailer == uint8(122) +assert r.buf1.body == "foo|b" +assert r.buf2.body == "ar|ba" +assert r.buf2.trailer == 122 diff --git a/spec/nim/tparams_enum.nim b/spec/nim/tparams_enum.nim index 15534bc9b..98847ad82 100644 --- a/spec/nim/tparams_enum.nim +++ b/spec/nim/tparams_enum.nim @@ -7,4 +7,4 @@ import auxiliary/test_utils let r = ParamsEnum.fromFile("src/enum_0.bin") assert r.one == params_enum.cat -assert r.invokeWithParam.isCat == bool(true) +assert r.invokeWithParam.isCat == true diff --git a/spec/nim/tparams_pass_array_int.nim b/spec/nim/tparams_pass_array_int.nim index a76c297ba..cf5b64726 100644 --- a/spec/nim/tparams_pass_array_int.nim +++ b/spec/nim/tparams_pass_array_int.nim @@ -6,10 +6,10 @@ import auxiliary/test_utils let r = ParamsPassArrayInt.fromFile("src/position_to_end.bin") -assert len(r.passInts.nums) == int(3) -assert r.passInts.nums[0] == uint16(513) -assert r.passInts.nums[1] == uint16(1027) -assert r.passInts.nums[2] == uint16(1541) -assert len(r.passIntsCalc.nums) == int(2) -assert r.passIntsCalc.nums[0] == uint16(27643) -assert r.passIntsCalc.nums[1] == uint16(7) +assert len(r.passInts.nums) == 3 +assert r.passInts.nums[0] == 513 +assert r.passInts.nums[1] == 1027 +assert r.passInts.nums[2] == 1541 +assert len(r.passIntsCalc.nums) == 2 +assert r.passIntsCalc.nums[0] == 27643 +assert r.passIntsCalc.nums[1] == 7 diff --git a/spec/nim/tparams_pass_array_str.nim b/spec/nim/tparams_pass_array_str.nim index 420f5ee44..c729fca01 100644 --- a/spec/nim/tparams_pass_array_str.nim +++ b/spec/nim/tparams_pass_array_str.nim @@ -6,10 +6,10 @@ import auxiliary/test_utils let r = ParamsPassArrayStr.fromFile("src/term_strz.bin") -assert len(r.passStrArray.strs) == int(3) -assert r.passStrArray.strs[0] == string("fo") -assert r.passStrArray.strs[1] == string("o|") -assert r.passStrArray.strs[2] == string("ba") -assert len(r.passStrArrayCalc.strs) == int(2) -assert r.passStrArrayCalc.strs[0] == string("aB") -assert r.passStrArrayCalc.strs[1] == string("Cd") +assert len(r.passStrArray.strs) == 3 +assert r.passStrArray.strs[0] == "fo" +assert r.passStrArray.strs[1] == "o|" +assert r.passStrArray.strs[2] == "ba" +assert len(r.passStrArrayCalc.strs) == 2 +assert r.passStrArrayCalc.strs[0] == "aB" +assert r.passStrArrayCalc.strs[1] == "Cd" diff --git a/spec/nim/tparams_pass_array_struct.nim b/spec/nim/tparams_pass_array_struct.nim index 1a26ea98a..5f62dd2d5 100644 --- a/spec/nim/tparams_pass_array_struct.nim +++ b/spec/nim/tparams_pass_array_struct.nim @@ -6,6 +6,6 @@ import auxiliary/test_utils let r = ParamsPassArrayStruct.fromFile("src/position_to_end.bin") -assert len(r.passStructs.structs) == int(2) -assert (ParamsPassArrayStruct_Foo(r.passStructs.structs[0])).f == uint8(1) -assert (ParamsPassArrayStruct_Bar(r.passStructs.structs[1])).b == uint8(2) +assert len(r.passStructs.structs) == 2 +assert (ParamsPassArrayStruct_Foo(r.passStructs.structs[0])).f == 1 +assert (ParamsPassArrayStruct_Bar(r.passStructs.structs[1])).b == 2 diff --git a/spec/nim/tparams_pass_array_usertype.nim b/spec/nim/tparams_pass_array_usertype.nim index 6ab219cdb..ae7a550d8 100644 --- a/spec/nim/tparams_pass_array_usertype.nim +++ b/spec/nim/tparams_pass_array_usertype.nim @@ -6,8 +6,8 @@ import auxiliary/test_utils let r = ParamsPassArrayUsertype.fromFile("src/position_to_end.bin") -assert len(r.passBlocks.bar) == int(2) -assert r.passBlocks.bar[0].foo == uint8(1) -assert r.passBlocks.bar[1].foo == uint8(2) +assert len(r.passBlocks.bar) == 2 +assert r.passBlocks.bar[0].foo == 1 +assert r.passBlocks.bar[1].foo == 2 assert r.passBlocks.one == @[3'u8] assert r.passBlocks.two == @[4'u8, 5'u8] diff --git a/spec/nim/tparams_pass_bool.nim b/spec/nim/tparams_pass_bool.nim index 8e8723b44..3afd04979 100644 --- a/spec/nim/tparams_pass_bool.nim +++ b/spec/nim/tparams_pass_bool.nim @@ -6,17 +6,17 @@ import auxiliary/test_utils let r = ParamsPassBool.fromFile("src/term_strz.bin") -assert r.sFalse == bool(false) -assert r.sTrue == bool(true) -assert r.seqB1.arg == bool(true) -assert len(r.seqB1.foo) == int(1) -assert r.seqBool.arg == bool(false) -assert len(r.seqBool.foo) == int(2) -assert r.literalB1.arg == bool(false) -assert len(r.literalB1.foo) == int(2) -assert r.literalBool.arg == bool(true) -assert len(r.literalBool.foo) == int(1) -assert r.instB1.arg == bool(true) -assert len(r.instB1.foo) == int(1) -assert r.instBool.arg == bool(false) -assert len(r.instBool.foo) == int(2) +assert r.sFalse == false +assert r.sTrue == true +assert r.seqB1.arg == true +assert len(r.seqB1.foo) == 1 +assert r.seqBool.arg == false +assert len(r.seqBool.foo) == 2 +assert r.literalB1.arg == false +assert len(r.literalB1.foo) == 2 +assert r.literalBool.arg == true +assert len(r.literalBool.foo) == 1 +assert r.instB1.arg == true +assert len(r.instB1.foo) == 1 +assert r.instBool.arg == false +assert len(r.instBool.foo) == 2 diff --git a/spec/nim/tparams_pass_struct.nim b/spec/nim/tparams_pass_struct.nim index e8ed521a7..e8abdd71a 100644 --- a/spec/nim/tparams_pass_struct.nim +++ b/spec/nim/tparams_pass_struct.nim @@ -6,7 +6,7 @@ import auxiliary/test_utils let r = ParamsPassStruct.fromFile("src/enum_negative.bin") -assert r.first.foo == uint8(255) -assert r.one.bar.qux == uint8(1) -assert (ParamsPassStruct_Block(r.one.foo)).foo == uint8(255) -assert (ParamsPassStruct_Block(r.one.bar.foo)).foo == uint8(255) +assert r.first.foo == 255 +assert r.one.bar.qux == 1 +assert (ParamsPassStruct_Block(r.one.foo)).foo == 255 +assert (ParamsPassStruct_Block(r.one.bar.foo)).foo == 255 diff --git a/spec/nim/tparams_pass_usertype.nim b/spec/nim/tparams_pass_usertype.nim index dba909b4c..3298a1bed 100644 --- a/spec/nim/tparams_pass_usertype.nim +++ b/spec/nim/tparams_pass_usertype.nim @@ -6,5 +6,5 @@ import auxiliary/test_utils let r = ParamsPassUsertype.fromFile("src/position_in_seq.bin") -assert r.first.foo == uint8(1) +assert r.first.foo == 1 assert r.one.buf == @[2'u8] diff --git a/spec/nim/tposition_abs.nim b/spec/nim/tposition_abs.nim index 618eb03d2..0760019e2 100644 --- a/spec/nim/tposition_abs.nim +++ b/spec/nim/tposition_abs.nim @@ -6,5 +6,5 @@ import auxiliary/test_utils let r = PositionAbs.fromFile("src/position_abs.bin") -assert r.indexOffset == uint32(32) -assert r.index.entry == string("foo") +assert r.indexOffset == 32 +assert r.index.entry == "foo" diff --git a/spec/nim/tposition_to_end.nim b/spec/nim/tposition_to_end.nim index 35f823150..3a7543266 100644 --- a/spec/nim/tposition_to_end.nim +++ b/spec/nim/tposition_to_end.nim @@ -6,5 +6,5 @@ import auxiliary/test_utils let r = PositionToEnd.fromFile("src/position_to_end.bin") -assert r.index.foo == uint32(66) -assert r.index.bar == uint32(4660) +assert r.index.foo == 66 +assert r.index.bar == 4660 diff --git a/spec/nim/tprocess_coerce_bytes.nim b/spec/nim/tprocess_coerce_bytes.nim index 757147fb9..48b1ca7d0 100644 --- a/spec/nim/tprocess_coerce_bytes.nim +++ b/spec/nim/tprocess_coerce_bytes.nim @@ -6,7 +6,7 @@ import auxiliary/test_utils let r = ProcessCoerceBytes.fromFile("src/process_coerce_bytes.bin") -assert r.records[0].flag == uint8(0) +assert r.records[0].flag == 0 assert r.records[0].buf == @[65'u8, 65'u8, 65'u8, 65'u8] -assert r.records[1].flag == uint8(1) +assert r.records[1].flag == 1 assert r.records[1].buf == @[66'u8, 66'u8, 66'u8, 66'u8] diff --git a/spec/nim/tprocess_coerce_switch.nim b/spec/nim/tprocess_coerce_switch.nim index a96dee331..7ad2c0295 100644 --- a/spec/nim/tprocess_coerce_switch.nim +++ b/spec/nim/tprocess_coerce_switch.nim @@ -6,6 +6,6 @@ import auxiliary/test_utils let r = ProcessCoerceSwitch.fromFile("src/process_coerce_switch.bin") -assert r.bufType == uint8(0) -assert r.flag == uint8(0) +assert r.bufType == 0 +assert r.flag == 0 assert (ProcessCoerceSwitch_Foo(r.buf)).bar == @[65'u8, 65'u8, 65'u8, 65'u8] diff --git a/spec/nim/tprocess_coerce_usertype1.nim b/spec/nim/tprocess_coerce_usertype1.nim index b67f3ac85..a46621359 100644 --- a/spec/nim/tprocess_coerce_usertype1.nim +++ b/spec/nim/tprocess_coerce_usertype1.nim @@ -6,7 +6,7 @@ import auxiliary/test_utils let r = ProcessCoerceUsertype1.fromFile("src/process_coerce_bytes.bin") -assert r.records[0].flag == uint8(0) -assert r.records[0].buf.value == uint32(1094795585) -assert r.records[1].flag == uint8(1) -assert r.records[1].buf.value == uint32(1111638594) +assert r.records[0].flag == 0 +assert r.records[0].buf.value == 1094795585 +assert r.records[1].flag == 1 +assert r.records[1].buf.value == 1111638594 diff --git a/spec/nim/tprocess_coerce_usertype2.nim b/spec/nim/tprocess_coerce_usertype2.nim index ce246926a..58060a840 100644 --- a/spec/nim/tprocess_coerce_usertype2.nim +++ b/spec/nim/tprocess_coerce_usertype2.nim @@ -6,7 +6,7 @@ import auxiliary/test_utils let r = ProcessCoerceUsertype2.fromFile("src/process_coerce_bytes.bin") -assert r.records[0].flag == uint8(0) -assert r.records[0].buf.value == uint32(1094795585) -assert r.records[1].flag == uint8(1) -assert r.records[1].buf.value == uint32(1111638594) +assert r.records[0].flag == 0 +assert r.records[0].buf.value == 1094795585 +assert r.records[1].flag == 1 +assert r.records[1].buf.value == 1111638594 diff --git a/spec/nim/tprocess_repeat_usertype.nim b/spec/nim/tprocess_repeat_usertype.nim index 3e2af3a30..236ab404c 100644 --- a/spec/nim/tprocess_repeat_usertype.nim +++ b/spec/nim/tprocess_repeat_usertype.nim @@ -6,7 +6,7 @@ import auxiliary/test_utils let r = ProcessRepeatUsertype.fromFile("src/process_xor_4.bin") -assert r.blocks[0].a == int32(-1975704206) -assert r.blocks[0].b == int8(20) -assert r.blocks[1].a == int32(279597642) -assert r.blocks[1].b == int8(68) +assert r.blocks[0].a == -1975704206 +assert r.blocks[0].b == 20 +assert r.blocks[1].a == 279597642 +assert r.blocks[1].b == 68 diff --git a/spec/nim/tprocess_to_user.nim b/spec/nim/tprocess_to_user.nim index 80ab5b13a..c1397dea7 100644 --- a/spec/nim/tprocess_to_user.nim +++ b/spec/nim/tprocess_to_user.nim @@ -6,4 +6,4 @@ import auxiliary/test_utils let r = ProcessToUser.fromFile("src/process_rotate.bin") -assert r.buf1.str == string("Hello") +assert r.buf1.str == "Hello" diff --git a/spec/nim/tprocess_xor_const.nim b/spec/nim/tprocess_xor_const.nim index 531d0a766..e8c15be18 100644 --- a/spec/nim/tprocess_xor_const.nim +++ b/spec/nim/tprocess_xor_const.nim @@ -6,5 +6,5 @@ import auxiliary/test_utils let r = ProcessXorConst.fromFile("src/process_xor_1.bin") -assert r.key == uint8(255) +assert r.key == 255 assert r.buf == @[102'u8, 111'u8, 111'u8, 32'u8, 98'u8, 97'u8, 114'u8] diff --git a/spec/nim/tprocess_xor_value.nim b/spec/nim/tprocess_xor_value.nim index 541495bd8..1d149f170 100644 --- a/spec/nim/tprocess_xor_value.nim +++ b/spec/nim/tprocess_xor_value.nim @@ -6,5 +6,5 @@ import auxiliary/test_utils let r = ProcessXorValue.fromFile("src/process_xor_1.bin") -assert r.key == uint8(255) +assert r.key == 255 assert r.buf == @[102'u8, 111'u8, 111'u8, 32'u8, 98'u8, 97'u8, 114'u8] diff --git a/spec/nim/trecursive_one.nim b/spec/nim/trecursive_one.nim index 6f5fdd80b..0e5414a0c 100644 --- a/spec/nim/trecursive_one.nim +++ b/spec/nim/trecursive_one.nim @@ -6,7 +6,7 @@ import auxiliary/test_utils let r = RecursiveOne.fromFile("src/fixed_struct.bin") -assert r.one == uint8(80) -assert (RecursiveOne(r.next)).one == uint8(65) -assert (RecursiveOne((RecursiveOne(r.next)).next)).one == uint8(67) -assert (RecursiveOne_Fini((RecursiveOne((RecursiveOne(r.next)).next)).next)).finisher == uint16(11595) +assert r.one == 80 +assert (RecursiveOne(r.next)).one == 65 +assert (RecursiveOne((RecursiveOne(r.next)).next)).one == 67 +assert (RecursiveOne_Fini((RecursiveOne((RecursiveOne(r.next)).next)).next)).finisher == 11595 diff --git a/spec/nim/trepeat_eos_bit.nim b/spec/nim/trepeat_eos_bit.nim index d30de7cbb..f5c1de2d7 100644 --- a/spec/nim/trepeat_eos_bit.nim +++ b/spec/nim/trepeat_eos_bit.nim @@ -6,4 +6,4 @@ import auxiliary/test_utils let r = RepeatEosBit.fromFile("src/enum_0.bin") -assert len(r.nibbles) == int(16) +assert len(r.nibbles) == 16 diff --git a/spec/nim/trepeat_eos_struct.nim b/spec/nim/trepeat_eos_struct.nim index 2e3ef582d..c610280a6 100644 --- a/spec/nim/trepeat_eos_struct.nim +++ b/spec/nim/trepeat_eos_struct.nim @@ -6,8 +6,8 @@ import auxiliary/test_utils let r = RepeatEosStruct.fromFile("src/repeat_eos_struct.bin") -assert len(r.chunks) == int(2) -assert r.chunks[0].offset == uint32(0) -assert r.chunks[0].len == uint32(66) -assert r.chunks[1].offset == uint32(66) -assert r.chunks[1].len == uint32(2069) +assert len(r.chunks) == 2 +assert r.chunks[0].offset == 0 +assert r.chunks[0].len == 66 +assert r.chunks[1].offset == 66 +assert r.chunks[1].len == 2069 diff --git a/spec/nim/trepeat_n_struct.nim b/spec/nim/trepeat_n_struct.nim index 8546d204a..3a88b189e 100644 --- a/spec/nim/trepeat_n_struct.nim +++ b/spec/nim/trepeat_n_struct.nim @@ -6,8 +6,8 @@ import auxiliary/test_utils let r = RepeatNStruct.fromFile("src/repeat_n_struct.bin") -assert len(r.chunks) == int(2) -assert r.chunks[0].offset == uint32(16) -assert r.chunks[0].len == uint32(8312) -assert r.chunks[1].offset == uint32(8328) -assert r.chunks[1].len == uint32(15) +assert len(r.chunks) == 2 +assert r.chunks[0].offset == 16 +assert r.chunks[0].len == 8312 +assert r.chunks[1].offset == 8328 +assert r.chunks[1].len == 15 diff --git a/spec/nim/trepeat_n_strz.nim b/spec/nim/trepeat_n_strz.nim index 3c98de0ac..17b805dfe 100644 --- a/spec/nim/trepeat_n_strz.nim +++ b/spec/nim/trepeat_n_strz.nim @@ -6,5 +6,5 @@ import auxiliary/test_utils let r = RepeatNStrz.fromFile("src/repeat_n_strz.bin") -assert r.qty == uint32(2) +assert r.qty == 2 assert r.lines == @[string("foo"), "bar"] diff --git a/spec/nim/trepeat_n_strz_double.nim b/spec/nim/trepeat_n_strz_double.nim index c9de502bd..bb1ca749d 100644 --- a/spec/nim/trepeat_n_strz_double.nim +++ b/spec/nim/trepeat_n_strz_double.nim @@ -6,6 +6,6 @@ import auxiliary/test_utils let r = RepeatNStrzDouble.fromFile("src/repeat_n_strz.bin") -assert r.qty == uint32(2) +assert r.qty == 2 assert r.lines1 == @[string("foo"), ] assert r.lines2 == @[string("bar"), ] diff --git a/spec/nim/trepeat_until_calc_array_type.nim b/spec/nim/trepeat_until_calc_array_type.nim index 0fd9f4964..cfc564890 100644 --- a/spec/nim/trepeat_until_calc_array_type.nim +++ b/spec/nim/trepeat_until_calc_array_type.nim @@ -6,10 +6,10 @@ import auxiliary/test_utils let r = RepeatUntilCalcArrayType.fromFile("src/repeat_until_process.bin") -assert len(r.records) == int(3) -assert r.records[0].marker == uint8(232) -assert r.records[0].body == uint32(2863311546'i64) -assert r.records[1].marker == uint8(250) -assert r.records[1].body == uint32(2863315102'i64) -assert r.records[2].marker == uint8(170) -assert r.records[2].body == uint32(1431655765) +assert len(r.records) == 3 +assert r.records[0].marker == 232 +assert r.records[0].body == 2863311546'i64 +assert r.records[1].marker == 250 +assert r.records[1].body == 2863315102'i64 +assert r.records[2].marker == 170 +assert r.records[2].body == 1431655765 diff --git a/spec/nim/trepeat_until_complex.nim b/spec/nim/trepeat_until_complex.nim index ef3f7fa70..e3db52e42 100644 --- a/spec/nim/trepeat_until_complex.nim +++ b/spec/nim/trepeat_until_complex.nim @@ -6,18 +6,18 @@ import auxiliary/test_utils let r = RepeatUntilComplex.fromFile("src/repeat_until_complex.bin") -assert len(r.first) == int(3) -assert r.first[0].count == uint8(4) +assert len(r.first) == 3 +assert r.first[0].count == 4 assert r.first[0].values == @[uint8((0 + 1)), 2, 3, 4] -assert r.first[1].count == uint8(2) +assert r.first[1].count == 2 assert r.first[1].values == @[uint8((0 + 1)), 2] -assert r.first[2].count == uint8(0) -assert len(r.second) == int(4) -assert r.second[0].count == uint16(6) +assert r.first[2].count == 0 +assert len(r.second) == 4 +assert r.second[0].count == 6 assert r.second[0].values == @[uint16((0 + 1)), 2, 3, 4, 5, 6] -assert r.second[1].count == uint16(3) +assert r.second[1].count == 3 assert r.second[1].values == @[uint16((0 + 1)), 2, 3] -assert r.second[2].count == uint16(4) +assert r.second[2].count == 4 assert r.second[2].values == @[uint16((0 + 1)), 2, 3, 4] -assert r.second[3].count == uint16(0) +assert r.second[3].count == 0 assert r.third == @[uint8((0 + 102)), 111, 111, 98, 97, 114, 0] diff --git a/spec/nim/trepeat_until_s4.nim b/spec/nim/trepeat_until_s4.nim index d11bd4d1c..31afa57f6 100644 --- a/spec/nim/trepeat_until_s4.nim +++ b/spec/nim/trepeat_until_s4.nim @@ -7,4 +7,4 @@ import auxiliary/test_utils let r = RepeatUntilS4.fromFile("src/repeat_until_s4.bin") assert r.entries == @[int32(66), 4919, -251658241, -1] -assert r.afterall == string("foobar") +assert r.afterall == "foobar" diff --git a/spec/nim/trepeat_until_sized.nim b/spec/nim/trepeat_until_sized.nim index afe81dc7c..ff90478bd 100644 --- a/spec/nim/trepeat_until_sized.nim +++ b/spec/nim/trepeat_until_sized.nim @@ -6,10 +6,10 @@ import auxiliary/test_utils let r = RepeatUntilSized.fromFile("src/repeat_until_process.bin") -assert len(r.records) == int(3) -assert r.records[0].marker == uint8(232) -assert r.records[0].body == uint32(2863311546'i64) -assert r.records[1].marker == uint8(250) -assert r.records[1].body == uint32(2863315102'i64) -assert r.records[2].marker == uint8(170) -assert r.records[2].body == uint32(1431655765) +assert len(r.records) == 3 +assert r.records[0].marker == 232 +assert r.records[0].body == 2863311546'i64 +assert r.records[1].marker == 250 +assert r.records[1].body == 2863315102'i64 +assert r.records[2].marker == 170 +assert r.records[2].body == 1431655765 diff --git a/spec/nim/tstr_encodings.nim b/spec/nim/tstr_encodings.nim index 3bf3bd253..1937a8969 100644 --- a/spec/nim/tstr_encodings.nim +++ b/spec/nim/tstr_encodings.nim @@ -6,7 +6,7 @@ import auxiliary/test_utils let r = StrEncodings.fromFile("src/str_encodings.bin") -assert r.str1 == string("Some ASCII") -assert r.str2 == string("\u3053\u3093\u306b\u3061\u306f") -assert r.str3 == string("\u3053\u3093\u306b\u3061\u306f") -assert r.str4 == string("\u2591\u2592\u2593") +assert r.str1 == "Some ASCII" +assert r.str2 == "\u3053\u3093\u306b\u3061\u306f" +assert r.str3 == "\u3053\u3093\u306b\u3061\u306f" +assert r.str4 == "\u2591\u2592\u2593" diff --git a/spec/nim/tstr_encodings_default.nim b/spec/nim/tstr_encodings_default.nim index 2ee800661..99f66b87c 100644 --- a/spec/nim/tstr_encodings_default.nim +++ b/spec/nim/tstr_encodings_default.nim @@ -6,7 +6,7 @@ import auxiliary/test_utils let r = StrEncodingsDefault.fromFile("src/str_encodings.bin") -assert r.str1 == string("Some ASCII") -assert r.rest.str2 == string("\u3053\u3093\u306b\u3061\u306f") -assert r.rest.str3 == string("\u3053\u3093\u306b\u3061\u306f") -assert r.rest.str4 == string("\u2591\u2592\u2593") +assert r.str1 == "Some ASCII" +assert r.rest.str2 == "\u3053\u3093\u306b\u3061\u306f" +assert r.rest.str3 == "\u3053\u3093\u306b\u3061\u306f" +assert r.rest.str4 == "\u2591\u2592\u2593" diff --git a/spec/nim/tstr_eos.nim b/spec/nim/tstr_eos.nim index 1ac84ec5b..a49a01edf 100644 --- a/spec/nim/tstr_eos.nim +++ b/spec/nim/tstr_eos.nim @@ -6,4 +6,4 @@ import auxiliary/test_utils let r = StrEos.fromFile("src/term_strz.bin") -assert r.str == string("foo|bar|baz@") +assert r.str == "foo|bar|baz@" diff --git a/spec/nim/tstr_literals2.nim b/spec/nim/tstr_literals2.nim index ff3c84539..6681db494 100644 --- a/spec/nim/tstr_literals2.nim +++ b/spec/nim/tstr_literals2.nim @@ -6,7 +6,7 @@ import auxiliary/test_utils let r = StrLiterals2.fromFile("src/fixed_struct.bin") -assert r.dollar1 == string("$foo") -assert r.dollar2 == string("${foo}") -assert r.hash == string("#{foo}") -assert r.atSign == string("@foo") +assert r.dollar1 == "$foo" +assert r.dollar2 == "${foo}" +assert r.hash == "#{foo}" +assert r.atSign == "@foo" diff --git a/spec/nim/tstr_pad_term.nim b/spec/nim/tstr_pad_term.nim index bba98106c..f8144533a 100644 --- a/spec/nim/tstr_pad_term.nim +++ b/spec/nim/tstr_pad_term.nim @@ -6,7 +6,7 @@ import auxiliary/test_utils let r = StrPadTerm.fromFile("src/str_pad_term.bin") -assert r.strPad == string("str1") -assert r.strTerm == string("str2foo") -assert r.strTermAndPad == string("str+++3bar+++") -assert r.strTermInclude == string("str4baz@") +assert r.strPad == "str1" +assert r.strTerm == "str2foo" +assert r.strTermAndPad == "str+++3bar+++" +assert r.strTermInclude == "str4baz@" diff --git a/spec/nim/tstr_pad_term_empty.nim b/spec/nim/tstr_pad_term_empty.nim index 474995ac8..dc82463de 100644 --- a/spec/nim/tstr_pad_term_empty.nim +++ b/spec/nim/tstr_pad_term_empty.nim @@ -6,7 +6,7 @@ import auxiliary/test_utils let r = StrPadTermEmpty.fromFile("src/str_pad_term_empty.bin") -assert r.strPad == string("") -assert r.strTerm == string("") -assert r.strTermAndPad == string("") -assert r.strTermInclude == string("@") +assert r.strPad == "" +assert r.strTerm == "" +assert r.strTermAndPad == "" +assert r.strTermInclude == "@" diff --git a/spec/nim/tswitch_bytearray.nim b/spec/nim/tswitch_bytearray.nim index 79a6b1002..3d9ce9503 100644 --- a/spec/nim/tswitch_bytearray.nim +++ b/spec/nim/tswitch_bytearray.nim @@ -6,12 +6,12 @@ import auxiliary/test_utils let r = SwitchBytearray.fromFile("src/switch_opcodes.bin") -assert len(r.opcodes) == int(4) +assert len(r.opcodes) == 4 assert r.opcodes[0].code == @[83'u8] -assert (SwitchBytearray_Opcode_Strval(r.opcodes[0].body)).value == string("foobar") +assert (SwitchBytearray_Opcode_Strval(r.opcodes[0].body)).value == "foobar" assert r.opcodes[1].code == @[73'u8] -assert (SwitchBytearray_Opcode_Intval(r.opcodes[1].body)).value == uint8(66) +assert (SwitchBytearray_Opcode_Intval(r.opcodes[1].body)).value == 66 assert r.opcodes[2].code == @[73'u8] -assert (SwitchBytearray_Opcode_Intval(r.opcodes[2].body)).value == uint8(55) +assert (SwitchBytearray_Opcode_Intval(r.opcodes[2].body)).value == 55 assert r.opcodes[3].code == @[83'u8] -assert (SwitchBytearray_Opcode_Strval(r.opcodes[3].body)).value == string("") +assert (SwitchBytearray_Opcode_Strval(r.opcodes[3].body)).value == "" diff --git a/spec/nim/tswitch_else_only.nim b/spec/nim/tswitch_else_only.nim index ee97e8569..f913fa073 100644 --- a/spec/nim/tswitch_else_only.nim +++ b/spec/nim/tswitch_else_only.nim @@ -6,6 +6,6 @@ import auxiliary/test_utils let r = SwitchElseOnly.fromFile("src/switch_opcodes.bin") -assert r.opcode == int8(83) -assert r.primByte == int8(102) +assert r.opcode == 83 +assert r.primByte == 102 assert r.ut.value == @[114'u8, 0'u8, 73'u8, 66'u8] diff --git a/spec/nim/tswitch_integers.nim b/spec/nim/tswitch_integers.nim index 17b37b877..aefd13fb6 100644 --- a/spec/nim/tswitch_integers.nim +++ b/spec/nim/tswitch_integers.nim @@ -6,12 +6,12 @@ import auxiliary/test_utils let r = SwitchIntegers.fromFile("src/switch_integers.bin") -assert len(r.opcodes) == int(4) -assert r.opcodes[0].code == uint8(1) -assert r.opcodes[0].body == uint64(7) -assert r.opcodes[1].code == uint8(2) -assert r.opcodes[1].body == uint64(16448) -assert r.opcodes[2].code == uint8(4) -assert r.opcodes[2].body == uint64(4919) -assert r.opcodes[3].code == uint8(8) -assert r.opcodes[3].body == uint64(4919) +assert len(r.opcodes) == 4 +assert r.opcodes[0].code == 1 +assert r.opcodes[0].body == 7 +assert r.opcodes[1].code == 2 +assert r.opcodes[1].body == 16448 +assert r.opcodes[2].code == 4 +assert r.opcodes[2].body == 4919 +assert r.opcodes[3].code == 8 +assert r.opcodes[3].body == 4919 diff --git a/spec/nim/tswitch_integers2.nim b/spec/nim/tswitch_integers2.nim index 589fc1ac3..960482e4e 100644 --- a/spec/nim/tswitch_integers2.nim +++ b/spec/nim/tswitch_integers2.nim @@ -6,8 +6,8 @@ import auxiliary/test_utils let r = SwitchIntegers2.fromFile("src/switch_integers.bin") -assert r.code == uint8(1) -assert r.len == uint64(7) +assert r.code == 1 +assert r.len == 7 assert r.ham == @[2'u8, 64'u8, 64'u8, 4'u8, 55'u8, 19'u8, 0'u8] -assert r.padding == uint8(0) -assert r.lenModStr == string("13") +assert r.padding == 0 +assert r.lenModStr == "13" diff --git a/spec/nim/tswitch_manual_enum.nim b/spec/nim/tswitch_manual_enum.nim index 30ba24d9d..e8e1c0c9b 100644 --- a/spec/nim/tswitch_manual_enum.nim +++ b/spec/nim/tswitch_manual_enum.nim @@ -6,12 +6,12 @@ import auxiliary/test_utils let r = SwitchManualEnum.fromFile("src/switch_opcodes.bin") -assert len(r.opcodes) == int(4) +assert len(r.opcodes) == 4 assert r.opcodes[0].code == switch_manual_enum.strval -assert (SwitchManualEnum_Opcode_Strval(r.opcodes[0].body)).value == string("foobar") +assert (SwitchManualEnum_Opcode_Strval(r.opcodes[0].body)).value == "foobar" assert r.opcodes[1].code == switch_manual_enum.intval -assert (SwitchManualEnum_Opcode_Intval(r.opcodes[1].body)).value == uint8(66) +assert (SwitchManualEnum_Opcode_Intval(r.opcodes[1].body)).value == 66 assert r.opcodes[2].code == switch_manual_enum.intval -assert (SwitchManualEnum_Opcode_Intval(r.opcodes[2].body)).value == uint8(55) +assert (SwitchManualEnum_Opcode_Intval(r.opcodes[2].body)).value == 55 assert r.opcodes[3].code == switch_manual_enum.strval -assert (SwitchManualEnum_Opcode_Strval(r.opcodes[3].body)).value == string("") +assert (SwitchManualEnum_Opcode_Strval(r.opcodes[3].body)).value == "" diff --git a/spec/nim/tswitch_manual_enum_invalid.nim b/spec/nim/tswitch_manual_enum_invalid.nim index 197a3e3b8..54c96e519 100644 --- a/spec/nim/tswitch_manual_enum_invalid.nim +++ b/spec/nim/tswitch_manual_enum_invalid.nim @@ -6,8 +6,8 @@ import auxiliary/test_utils let r = SwitchManualEnumInvalid.fromFile("src/enum_negative.bin") -assert len(r.opcodes) == int(2) -assert r.opcodes[0].code == SwitchManualEnumInvalid_Opcode_CodeEnum(255) +assert len(r.opcodes) == 2 +assert r.opcodes[0].code == 255 assert r.opcodes[0].body == nil -assert r.opcodes[1].code == SwitchManualEnumInvalid_Opcode_CodeEnum(1) +assert r.opcodes[1].code == 1 assert r.opcodes[1].body == nil diff --git a/spec/nim/tswitch_manual_enum_invalid_else.nim b/spec/nim/tswitch_manual_enum_invalid_else.nim index 0d3250047..7a2ea3aa0 100644 --- a/spec/nim/tswitch_manual_enum_invalid_else.nim +++ b/spec/nim/tswitch_manual_enum_invalid_else.nim @@ -6,8 +6,8 @@ import auxiliary/test_utils let r = SwitchManualEnumInvalidElse.fromFile("src/enum_negative.bin") -assert len(r.opcodes) == int(2) -assert r.opcodes[0].code == SwitchManualEnumInvalidElse_Opcode_CodeEnum(255) -assert (SwitchManualEnumInvalidElse_Opcode_Defval(r.opcodes[0].body)).value == int8(123) -assert r.opcodes[1].code == SwitchManualEnumInvalidElse_Opcode_CodeEnum(1) -assert (SwitchManualEnumInvalidElse_Opcode_Defval(r.opcodes[1].body)).value == int8(123) +assert len(r.opcodes) == 2 +assert r.opcodes[0].code == 255 +assert (SwitchManualEnumInvalidElse_Opcode_Defval(r.opcodes[0].body)).value == 123 +assert r.opcodes[1].code == 1 +assert (SwitchManualEnumInvalidElse_Opcode_Defval(r.opcodes[1].body)).value == 123 diff --git a/spec/nim/tswitch_manual_int.nim b/spec/nim/tswitch_manual_int.nim index 9eb9cffff..996c64c77 100644 --- a/spec/nim/tswitch_manual_int.nim +++ b/spec/nim/tswitch_manual_int.nim @@ -6,12 +6,12 @@ import auxiliary/test_utils let r = SwitchManualInt.fromFile("src/switch_opcodes.bin") -assert len(r.opcodes) == int(4) -assert r.opcodes[0].code == uint8(83) -assert (SwitchManualInt_Opcode_Strval(r.opcodes[0].body)).value == string("foobar") -assert r.opcodes[1].code == uint8(73) -assert (SwitchManualInt_Opcode_Intval(r.opcodes[1].body)).value == uint8(66) -assert r.opcodes[2].code == uint8(73) -assert (SwitchManualInt_Opcode_Intval(r.opcodes[2].body)).value == uint8(55) -assert r.opcodes[3].code == uint8(83) -assert (SwitchManualInt_Opcode_Strval(r.opcodes[3].body)).value == string("") +assert len(r.opcodes) == 4 +assert r.opcodes[0].code == 83 +assert (SwitchManualInt_Opcode_Strval(r.opcodes[0].body)).value == "foobar" +assert r.opcodes[1].code == 73 +assert (SwitchManualInt_Opcode_Intval(r.opcodes[1].body)).value == 66 +assert r.opcodes[2].code == 73 +assert (SwitchManualInt_Opcode_Intval(r.opcodes[2].body)).value == 55 +assert r.opcodes[3].code == 83 +assert (SwitchManualInt_Opcode_Strval(r.opcodes[3].body)).value == "" diff --git a/spec/nim/tswitch_manual_int_else.nim b/spec/nim/tswitch_manual_int_else.nim index 2c615d01c..648ce27b5 100644 --- a/spec/nim/tswitch_manual_int_else.nim +++ b/spec/nim/tswitch_manual_int_else.nim @@ -6,12 +6,12 @@ import auxiliary/test_utils let r = SwitchManualIntElse.fromFile("src/switch_opcodes2.bin") -assert len(r.opcodes) == int(4) -assert r.opcodes[0].code == uint8(83) -assert (SwitchManualIntElse_Opcode_Strval(r.opcodes[0].body)).value == string("foo") -assert r.opcodes[1].code == uint8(88) -assert (SwitchManualIntElse_Opcode_Noneval(r.opcodes[1].body)).filler == uint32(66) -assert r.opcodes[2].code == uint8(89) -assert (SwitchManualIntElse_Opcode_Noneval(r.opcodes[2].body)).filler == uint32(51966) -assert r.opcodes[3].code == uint8(73) -assert (SwitchManualIntElse_Opcode_Intval(r.opcodes[3].body)).value == uint8(7) +assert len(r.opcodes) == 4 +assert r.opcodes[0].code == 83 +assert (SwitchManualIntElse_Opcode_Strval(r.opcodes[0].body)).value == "foo" +assert r.opcodes[1].code == 88 +assert (SwitchManualIntElse_Opcode_Noneval(r.opcodes[1].body)).filler == 66 +assert r.opcodes[2].code == 89 +assert (SwitchManualIntElse_Opcode_Noneval(r.opcodes[2].body)).filler == 51966 +assert r.opcodes[3].code == 73 +assert (SwitchManualIntElse_Opcode_Intval(r.opcodes[3].body)).value == 7 diff --git a/spec/nim/tswitch_manual_int_size.nim b/spec/nim/tswitch_manual_int_size.nim index f10a41de2..e49d6fd4f 100644 --- a/spec/nim/tswitch_manual_int_size.nim +++ b/spec/nim/tswitch_manual_int_size.nim @@ -6,13 +6,13 @@ import auxiliary/test_utils let r = SwitchManualIntSize.fromFile("src/switch_tlv.bin") -assert len(r.chunks) == int(4) -assert r.chunks[0].code == uint8(17) -assert (SwitchManualIntSize_Chunk_ChunkMeta(r.chunks[0].body)).title == string("Stuff") -assert (SwitchManualIntSize_Chunk_ChunkMeta(r.chunks[0].body)).author == string("Me") -assert r.chunks[1].code == uint8(34) +assert len(r.chunks) == 4 +assert r.chunks[0].code == 17 +assert (SwitchManualIntSize_Chunk_ChunkMeta(r.chunks[0].body)).title == "Stuff" +assert (SwitchManualIntSize_Chunk_ChunkMeta(r.chunks[0].body)).author == "Me" +assert r.chunks[1].code == 34 assert (SwitchManualIntSize_Chunk_ChunkDir(r.chunks[1].body)).entries == @[string("AAAA"), "BBBB", "CCCC"] -assert r.chunks[2].code == uint8(51) +assert r.chunks[2].code == 51 assert (seq[byte](r.chunks[2].body)) == @[16'u8, 32'u8, 48'u8, 64'u8, 80'u8, 96'u8, 112'u8, 128'u8] -assert r.chunks[3].code == uint8(255) +assert r.chunks[3].code == 255 assert (seq[byte](r.chunks[3].body)) == @[] diff --git a/spec/nim/tswitch_manual_int_size_else.nim b/spec/nim/tswitch_manual_int_size_else.nim index 6a1d26bd3..aa74f00f3 100644 --- a/spec/nim/tswitch_manual_int_size_else.nim +++ b/spec/nim/tswitch_manual_int_size_else.nim @@ -6,13 +6,13 @@ import auxiliary/test_utils let r = SwitchManualIntSizeElse.fromFile("src/switch_tlv.bin") -assert len(r.chunks) == int(4) -assert r.chunks[0].code == uint8(17) -assert (SwitchManualIntSizeElse_Chunk_ChunkMeta(r.chunks[0].body)).title == string("Stuff") -assert (SwitchManualIntSizeElse_Chunk_ChunkMeta(r.chunks[0].body)).author == string("Me") -assert r.chunks[1].code == uint8(34) +assert len(r.chunks) == 4 +assert r.chunks[0].code == 17 +assert (SwitchManualIntSizeElse_Chunk_ChunkMeta(r.chunks[0].body)).title == "Stuff" +assert (SwitchManualIntSizeElse_Chunk_ChunkMeta(r.chunks[0].body)).author == "Me" +assert r.chunks[1].code == 34 assert (SwitchManualIntSizeElse_Chunk_ChunkDir(r.chunks[1].body)).entries == @[string("AAAA"), "BBBB", "CCCC"] -assert r.chunks[2].code == uint8(51) +assert r.chunks[2].code == 51 assert (SwitchManualIntSizeElse_Chunk_Dummy(r.chunks[2].body)).rest == @[16'u8, 32'u8, 48'u8, 64'u8, 80'u8, 96'u8, 112'u8, 128'u8] -assert r.chunks[3].code == uint8(255) +assert r.chunks[3].code == 255 assert (SwitchManualIntSizeElse_Chunk_Dummy(r.chunks[3].body)).rest == @[] diff --git a/spec/nim/tswitch_manual_str.nim b/spec/nim/tswitch_manual_str.nim index 84cf3f652..78a678fcb 100644 --- a/spec/nim/tswitch_manual_str.nim +++ b/spec/nim/tswitch_manual_str.nim @@ -6,12 +6,12 @@ import auxiliary/test_utils let r = SwitchManualStr.fromFile("src/switch_opcodes.bin") -assert len(r.opcodes) == int(4) -assert r.opcodes[0].code == string("S") -assert (SwitchManualStr_Opcode_Strval(r.opcodes[0].body)).value == string("foobar") -assert r.opcodes[1].code == string("I") -assert (SwitchManualStr_Opcode_Intval(r.opcodes[1].body)).value == uint8(66) -assert r.opcodes[2].code == string("I") -assert (SwitchManualStr_Opcode_Intval(r.opcodes[2].body)).value == uint8(55) -assert r.opcodes[3].code == string("S") -assert (SwitchManualStr_Opcode_Strval(r.opcodes[3].body)).value == string("") +assert len(r.opcodes) == 4 +assert r.opcodes[0].code == "S" +assert (SwitchManualStr_Opcode_Strval(r.opcodes[0].body)).value == "foobar" +assert r.opcodes[1].code == "I" +assert (SwitchManualStr_Opcode_Intval(r.opcodes[1].body)).value == 66 +assert r.opcodes[2].code == "I" +assert (SwitchManualStr_Opcode_Intval(r.opcodes[2].body)).value == 55 +assert r.opcodes[3].code == "S" +assert (SwitchManualStr_Opcode_Strval(r.opcodes[3].body)).value == "" diff --git a/spec/nim/tswitch_manual_str_else.nim b/spec/nim/tswitch_manual_str_else.nim index 065dd99d4..65819a293 100644 --- a/spec/nim/tswitch_manual_str_else.nim +++ b/spec/nim/tswitch_manual_str_else.nim @@ -6,12 +6,12 @@ import auxiliary/test_utils let r = SwitchManualStrElse.fromFile("src/switch_opcodes2.bin") -assert len(r.opcodes) == int(4) -assert r.opcodes[0].code == string("S") -assert (SwitchManualStrElse_Opcode_Strval(r.opcodes[0].body)).value == string("foo") -assert r.opcodes[1].code == string("X") -assert (SwitchManualStrElse_Opcode_Noneval(r.opcodes[1].body)).filler == uint32(66) -assert r.opcodes[2].code == string("Y") -assert (SwitchManualStrElse_Opcode_Noneval(r.opcodes[2].body)).filler == uint32(51966) -assert r.opcodes[3].code == string("I") -assert (SwitchManualStrElse_Opcode_Intval(r.opcodes[3].body)).value == uint8(7) +assert len(r.opcodes) == 4 +assert r.opcodes[0].code == "S" +assert (SwitchManualStrElse_Opcode_Strval(r.opcodes[0].body)).value == "foo" +assert r.opcodes[1].code == "X" +assert (SwitchManualStrElse_Opcode_Noneval(r.opcodes[1].body)).filler == 66 +assert r.opcodes[2].code == "Y" +assert (SwitchManualStrElse_Opcode_Noneval(r.opcodes[2].body)).filler == 51966 +assert r.opcodes[3].code == "I" +assert (SwitchManualStrElse_Opcode_Intval(r.opcodes[3].body)).value == 7 diff --git a/spec/nim/tswitch_repeat_expr.nim b/spec/nim/tswitch_repeat_expr.nim index ae95e2bfa..a2afce098 100644 --- a/spec/nim/tswitch_repeat_expr.nim +++ b/spec/nim/tswitch_repeat_expr.nim @@ -6,6 +6,6 @@ import auxiliary/test_utils let r = SwitchRepeatExpr.fromFile("src/switch_tlv.bin") -assert r.code == uint8(17) -assert r.size == uint32(9) +assert r.code == 17 +assert r.size == 9 assert (SwitchRepeatExpr_One(r.body[0])).first == @[83'u8, 116'u8, 117'u8, 102'u8, 102'u8, 0'u8, 77'u8, 101'u8, 0'u8] diff --git a/spec/nim/tswitch_repeat_expr_invalid.nim b/spec/nim/tswitch_repeat_expr_invalid.nim index bb8cc1000..442bf2d8b 100644 --- a/spec/nim/tswitch_repeat_expr_invalid.nim +++ b/spec/nim/tswitch_repeat_expr_invalid.nim @@ -6,6 +6,6 @@ import auxiliary/test_utils let r = SwitchRepeatExprInvalid.fromFile("src/switch_tlv.bin") -assert r.code == uint8(17) -assert r.size == uint32(9) +assert r.code == 17 +assert r.size == 9 assert (seq[byte](r.body[0])) == @[83'u8, 116'u8, 117'u8, 102'u8, 102'u8, 0'u8, 77'u8, 101'u8, 0'u8] diff --git a/spec/nim/tterm_strz.nim b/spec/nim/tterm_strz.nim index 1dc96bc23..6bdc6de0d 100644 --- a/spec/nim/tterm_strz.nim +++ b/spec/nim/tterm_strz.nim @@ -6,6 +6,6 @@ import auxiliary/test_utils let r = TermStrz.fromFile("src/term_strz.bin") -assert r.s1 == string("foo") -assert r.s2 == string("bar") -assert r.s3 == string("|baz@") +assert r.s1 == "foo" +assert r.s2 == "bar" +assert r.s3 == "|baz@" diff --git a/spec/nim/tterm_u1_val.nim b/spec/nim/tterm_u1_val.nim index ba707f4d9..1d187e286 100644 --- a/spec/nim/tterm_u1_val.nim +++ b/spec/nim/tterm_u1_val.nim @@ -7,4 +7,4 @@ import auxiliary/test_utils let r = TermU1Val.fromFile("src/str_encodings.bin") assert r.foo == @[10'u8, 0'u8, 83'u8, 111'u8, 109'u8, 101'u8, 32'u8, 65'u8, 83'u8, 67'u8, 73'u8, 73'u8, 15'u8, 0'u8] -assert r.bar == string("\u3053\u3093\u306b") +assert r.bar == "\u3053\u3093\u306b" diff --git a/spec/nim/tts_packet_header.nim b/spec/nim/tts_packet_header.nim index 513b28ea5..96e3d4bfb 100644 --- a/spec/nim/tts_packet_header.nim +++ b/spec/nim/tts_packet_header.nim @@ -6,10 +6,10 @@ import auxiliary/test_utils let r = TsPacketHeader.fromFile("src/ts_packet.bin") -assert r.syncByte == uint8(71) -assert r.transportErrorIndicator == bool(false) -assert r.payloadUnitStartIndicator == bool(false) -assert r.transportPriority == bool(true) -assert r.pid == uint64(33) -assert r.transportScramblingControl == uint64(0) +assert r.syncByte == 71 +assert r.transportErrorIndicator == false +assert r.payloadUnitStartIndicator == false +assert r.transportPriority == true +assert r.pid == 33 +assert r.transportScramblingControl == 0 assert r.adaptationFieldControl == ts_packet_header.payload_only diff --git a/spec/nim/ttype_int_unary_op.nim b/spec/nim/ttype_int_unary_op.nim index e53eb585e..1e1b2c603 100644 --- a/spec/nim/ttype_int_unary_op.nim +++ b/spec/nim/ttype_int_unary_op.nim @@ -6,7 +6,7 @@ import auxiliary/test_utils let r = TypeIntUnaryOp.fromFile("src/fixed_struct.bin") -assert r.valueS2 == int16(16720) -assert r.valueS8 == int64(4706543082108963651'i64) -assert r.unaryS2 == int(-16720) -assert r.unaryS8 == int64(-4706543082108963651'i64) +assert r.valueS2 == 16720 +assert r.valueS8 == 4706543082108963651'i64 +assert r.unaryS2 == -16720 +assert r.unaryS8 == -4706543082108963651'i64 diff --git a/spec/nim/ttype_ternary.nim b/spec/nim/ttype_ternary.nim index b306d021d..44744ded2 100644 --- a/spec/nim/ttype_ternary.nim +++ b/spec/nim/ttype_ternary.nim @@ -6,4 +6,4 @@ import auxiliary/test_utils let r = TypeTernary.fromFile("src/term_strz.bin") -assert r.dif.value == uint8(101) +assert r.dif.value == 101 diff --git a/spec/nim/ttype_ternary_2nd_falsy.nim b/spec/nim/ttype_ternary_2nd_falsy.nim index 44cfbe187..c2b4ca524 100644 --- a/spec/nim/ttype_ternary_2nd_falsy.nim +++ b/spec/nim/ttype_ternary_2nd_falsy.nim @@ -6,16 +6,16 @@ import auxiliary/test_utils let r = TypeTernary2ndFalsy.fromFile("src/switch_integers.bin") -assert r.vFalse == bool(false) -assert r.vIntZero == int8(0) -assert r.vIntNegZero == int(-0) -assert r.vFloatZero == float64(0.0) -assert r.vFloatNegZero == float64(-0.0) -assert r.vStrWZero == string("0") -assert len(r.vStrWZero) == int(1) -assert r.ut.m == uint8(7) +assert r.vFalse == false +assert r.vIntZero == 0 +assert r.vIntNegZero == -0 +assert r.vFloatZero == 0.0 +assert r.vFloatNegZero == -0.0 +assert r.vStrWZero == "0" +assert len(r.vStrWZero) == 1 +assert r.ut.m == 7 assert r.vNullUt == nil -assert r.vStrEmpty == string("") -assert len(r.vStrEmpty) == int(0) -assert len(r.intArray) == int(2) -assert len(r.vIntArrayEmpty) == int(0) +assert r.vStrEmpty == "" +assert len(r.vStrEmpty) == 0 +assert len(r.intArray) == 2 +assert len(r.vIntArrayEmpty) == 0 diff --git a/spec/nim/tuser_type.nim b/spec/nim/tuser_type.nim index 60cfd2edc..a53352d01 100644 --- a/spec/nim/tuser_type.nim +++ b/spec/nim/tuser_type.nim @@ -6,5 +6,5 @@ import auxiliary/test_utils let r = UserType.fromFile("src/repeat_until_s4.bin") -assert r.one.width == uint32(66) -assert r.one.height == uint32(4919) +assert r.one.width == 66 +assert r.one.height == 4919 diff --git a/spec/nim/tyaml_ints.nim b/spec/nim/tyaml_ints.nim index 57b3c4c0b..999f077bf 100644 --- a/spec/nim/tyaml_ints.nim +++ b/spec/nim/tyaml_ints.nim @@ -6,7 +6,7 @@ import auxiliary/test_utils let r = YamlInts.fromFile("src/fixed_struct.bin") -assert r.testU4Dec == int(4294967295'i64) -assert r.testU4Hex == int(4294967295'i64) -assert r.testU8Dec == int(18446744073709551615'u64) -assert r.testU8Hex == int(18446744073709551615'u64) +assert r.testU4Dec == 4294967295'i64 +assert r.testU4Hex == 4294967295'i64 +assert r.testU8Dec == 18446744073709551615'u64 +assert r.testU8Hex == 18446744073709551615'u64 diff --git a/spec/nim/tzlib_surrounded.nim b/spec/nim/tzlib_surrounded.nim index 167c9445b..460d468b4 100644 --- a/spec/nim/tzlib_surrounded.nim +++ b/spec/nim/tzlib_surrounded.nim @@ -6,4 +6,4 @@ import auxiliary/test_utils let r = ZlibSurrounded.fromFile("src/zlib_surrounded.bin") -assert r.zlib.num == int32(-1) +assert r.zlib.num == -1 diff --git a/translator/src/main/scala/io/kaitai/struct/testtranslator/specgenerators/NimSG.scala b/translator/src/main/scala/io/kaitai/struct/testtranslator/specgenerators/NimSG.scala index dead8c60f..5f3b25a34 100644 --- a/translator/src/main/scala/io/kaitai/struct/testtranslator/specgenerators/NimSG.scala +++ b/translator/src/main/scala/io/kaitai/struct/testtranslator/specgenerators/NimSG.scala @@ -61,12 +61,7 @@ class NimSG(spec: TestSpec, provider: ClassTypeProvider) extends BaseGenerator(s override def simpleAssert(check: TestAssert): Unit = { val actStr = translateAct(check.actual) val expStr = translator.translate(check.expected) - val td = new TypeDetector(provider) - val ta = ksToNim(td.detectType(check.actual)) - td.detectType(check.expected) match { - case _: EnumType | _: BytesType | _: ArrayType => out.puts(s"assert $actStr == $expStr") - case _ => out.puts(s"assert $actStr == $ta($expStr)") - } + out.puts(s"assert $actStr == $expStr") } override def trueArrayAssert(check: TestAssert, elType: DataType, elts: Seq[expr]): Unit = { val arr = elts.map(v => translator.translate(v))