| ... | ... | @@ -737,7 +737,7 @@ test "string to" { |
| 737 | 737 | defer testing.allocator.free(as); |
| 738 | 738 | const es = "120317241209124781241290847124"; |
| 739 | 739 | |
| 740 | | try testing.expect(mem.eql(u8, as, es)); |
| 740 | try testing.expectEqualSlices(u8, es, as); |
| 741 | 741 | } |
| 742 | 742 | |
| 743 | 743 | test "string to base base error" { |
| ... | ... | @@ -755,7 +755,7 @@ test "string to base 2" { |
| 755 | 755 | defer testing.allocator.free(as); |
| 756 | 756 | const es = "-1011"; |
| 757 | 757 | |
| 758 | | try testing.expect(mem.eql(u8, as, es)); |
| 758 | try testing.expectEqualSlices(u8, es, as); |
| 759 | 759 | } |
| 760 | 760 | |
| 761 | 761 | test "string to base 16" { |
| ... | ... | @@ -766,7 +766,7 @@ test "string to base 16" { |
| 766 | 766 | defer testing.allocator.free(as); |
| 767 | 767 | const es = "efffffff00000001eeeeeeefaaaaaaab"; |
| 768 | 768 | |
| 769 | | try testing.expect(mem.eql(u8, as, es)); |
| 769 | try testing.expectEqualSlices(u8, es, as); |
| 770 | 770 | } |
| 771 | 771 | |
| 772 | 772 | test "string to base 36" { |
| ... | ... | @@ -777,7 +777,7 @@ test "string to base 36" { |
| 777 | 777 | defer testing.allocator.free(as); |
| 778 | 778 | const es = "fifvthrv1mzt79ez9"; |
| 779 | 779 | |
| 780 | | try testing.expect(mem.eql(u8, as, es)); |
| 780 | try testing.expectEqualSlices(u8, es, as); |
| 781 | 781 | } |
| 782 | 782 | |
| 783 | 783 | test "neg string to" { |
| ... | ... | @@ -788,7 +788,7 @@ test "neg string to" { |
| 788 | 788 | defer testing.allocator.free(as); |
| 789 | 789 | const es = "-123907434"; |
| 790 | 790 | |
| 791 | | try testing.expect(mem.eql(u8, as, es)); |
| 791 | try testing.expectEqualSlices(u8, es, as); |
| 792 | 792 | } |
| 793 | 793 | |
| 794 | 794 | test "zero string to" { |
| ... | ... | @@ -799,7 +799,7 @@ test "zero string to" { |
| 799 | 799 | defer testing.allocator.free(as); |
| 800 | 800 | const es = "0"; |
| 801 | 801 | |
| 802 | | try testing.expect(mem.eql(u8, as, es)); |
| 802 | try testing.expectEqualSlices(u8, es, as); |
| 803 | 803 | } |
| 804 | 804 | |
| 805 | 805 | test "clone" { |
| ... | ... | @@ -3404,26 +3404,26 @@ test "big int conversion read twos complement with padding" { |
| 3404 | 3404 | |
| 3405 | 3405 | var bit_count: usize = 12 * 8 + 1; |
| 3406 | 3406 | a.toConst().writeTwosComplement(buffer1[0..13], .little); |
| 3407 | | try testing.expect(std.mem.eql(u8, buffer1, &[_]u8{ 0xd, 0xc, 0xb, 0xa, 0x9, 0x8, 0x7, 0x6, 0x5, 0x4, 0x3, 0x2, 0x1, 0xaa, 0xaa, 0xaa })); |
| 3407 | try testing.expectEqualSlices(u8, &[_]u8{ 0xd, 0xc, 0xb, 0xa, 0x9, 0x8, 0x7, 0x6, 0x5, 0x4, 0x3, 0x2, 0x1, 0xaa, 0xaa, 0xaa }, buffer1); |
| 3408 | 3408 | a.toConst().writeTwosComplement(buffer1[0..13], .big); |
| 3409 | | try testing.expect(std.mem.eql(u8, buffer1, &[_]u8{ 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xaa, 0xaa, 0xaa })); |
| 3409 | try testing.expectEqualSlices(u8, &[_]u8{ 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xaa, 0xaa, 0xaa }, buffer1); |
| 3410 | 3410 | a.toConst().writeTwosComplement(buffer1[0..16], .little); |
| 3411 | | try testing.expect(std.mem.eql(u8, buffer1, &[_]u8{ 0xd, 0xc, 0xb, 0xa, 0x9, 0x8, 0x7, 0x6, 0x5, 0x4, 0x3, 0x2, 0x1, 0x0, 0x0, 0x0 })); |
| 3411 | try testing.expectEqualSlices(u8, &[_]u8{ 0xd, 0xc, 0xb, 0xa, 0x9, 0x8, 0x7, 0x6, 0x5, 0x4, 0x3, 0x2, 0x1, 0x0, 0x0, 0x0 }, buffer1); |
| 3412 | 3412 | a.toConst().writeTwosComplement(buffer1[0..16], .big); |
| 3413 | | try testing.expect(std.mem.eql(u8, buffer1, &[_]u8{ 0x0, 0x0, 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd })); |
| 3413 | try testing.expectEqualSlices(u8, &[_]u8{ 0x0, 0x0, 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd }, buffer1); |
| 3414 | 3414 | |
| 3415 | 3415 | @memset(buffer1, 0xaa); |
| 3416 | 3416 | try a.set(-0x01_02030405_06070809_0a0b0c0d); |
| 3417 | 3417 | bit_count = 12 * 8 + 2; |
| 3418 | 3418 | |
| 3419 | 3419 | a.toConst().writeTwosComplement(buffer1[0..13], .little); |
| 3420 | | try testing.expect(std.mem.eql(u8, buffer1, &[_]u8{ 0xf3, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xaa, 0xaa, 0xaa })); |
| 3420 | try testing.expectEqualSlices(u8, &[_]u8{ 0xf3, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xaa, 0xaa, 0xaa }, buffer1); |
| 3421 | 3421 | a.toConst().writeTwosComplement(buffer1[0..13], .big); |
| 3422 | | try testing.expect(std.mem.eql(u8, buffer1, &[_]u8{ 0xfe, 0xfd, 0xfc, 0xfb, 0xfa, 0xf9, 0xf8, 0xf7, 0xf6, 0xf5, 0xf4, 0xf3, 0xf3, 0xaa, 0xaa, 0xaa })); |
| 3422 | try testing.expectEqualSlices(u8, &[_]u8{ 0xfe, 0xfd, 0xfc, 0xfb, 0xfa, 0xf9, 0xf8, 0xf7, 0xf6, 0xf5, 0xf4, 0xf3, 0xf3, 0xaa, 0xaa, 0xaa }, buffer1); |
| 3423 | 3423 | a.toConst().writeTwosComplement(buffer1[0..16], .little); |
| 3424 | | try testing.expect(std.mem.eql(u8, buffer1, &[_]u8{ 0xf3, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, 0xff, 0xff })); |
| 3424 | try testing.expectEqualSlices(u8, &[_]u8{ 0xf3, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, 0xff, 0xff }, buffer1); |
| 3425 | 3425 | a.toConst().writeTwosComplement(buffer1[0..16], .big); |
| 3426 | | try testing.expect(std.mem.eql(u8, buffer1, &[_]u8{ 0xff, 0xff, 0xff, 0xfe, 0xfd, 0xfc, 0xfb, 0xfa, 0xf9, 0xf8, 0xf7, 0xf6, 0xf5, 0xf4, 0xf3, 0xf3 })); |
| 3426 | try testing.expectEqualSlices(u8, &[_]u8{ 0xff, 0xff, 0xff, 0xfe, 0xfd, 0xfc, 0xfb, 0xfa, 0xf9, 0xf8, 0xf7, 0xf6, 0xf5, 0xf4, 0xf3, 0xf3 }, buffer1); |
| 3427 | 3427 | } |
| 3428 | 3428 | |
| 3429 | 3429 | test "big int write twos complement +/- zero" { |
| ... | ... | @@ -3438,13 +3438,13 @@ test "big int write twos complement +/- zero" { |
| 3438 | 3438 | // Test zero |
| 3439 | 3439 | |
| 3440 | 3440 | m.toConst().writeTwosComplement(buffer1[0..13], .little); |
| 3441 | | try testing.expect(std.mem.eql(u8, buffer1, &(([_]u8{0} ** 13) ++ ([_]u8{0xaa} ** 3)))); |
| 3441 | try testing.expectEqualSlices(u8, &(([_]u8{0} ** 13) ++ ([_]u8{0xaa} ** 3)), buffer1); |
| 3442 | 3442 | m.toConst().writeTwosComplement(buffer1[0..13], .big); |
| 3443 | | try testing.expect(std.mem.eql(u8, buffer1, &(([_]u8{0} ** 13) ++ ([_]u8{0xaa} ** 3)))); |
| 3443 | try testing.expectEqualSlices(u8, &(([_]u8{0} ** 13) ++ ([_]u8{0xaa} ** 3)), buffer1); |
| 3444 | 3444 | m.toConst().writeTwosComplement(buffer1[0..16], .little); |
| 3445 | | try testing.expect(std.mem.eql(u8, buffer1, &(([_]u8{0} ** 16)))); |
| 3445 | try testing.expectEqualSlices(u8, &(([_]u8{0} ** 16)), buffer1); |
| 3446 | 3446 | m.toConst().writeTwosComplement(buffer1[0..16], .big); |
| 3447 | | try testing.expect(std.mem.eql(u8, buffer1, &(([_]u8{0} ** 16)))); |
| 3447 | try testing.expectEqualSlices(u8, &(([_]u8{0} ** 16)), buffer1); |
| 3448 | 3448 | |
| 3449 | 3449 | @memset(buffer1, 0xaa); |
| 3450 | 3450 | m.positive = false; |
| ... | ... | @@ -3452,13 +3452,13 @@ test "big int write twos complement +/- zero" { |
| 3452 | 3452 | // Test negative zero |
| 3453 | 3453 | |
| 3454 | 3454 | m.toConst().writeTwosComplement(buffer1[0..13], .little); |
| 3455 | | try testing.expect(std.mem.eql(u8, buffer1, &(([_]u8{0} ** 13) ++ ([_]u8{0xaa} ** 3)))); |
| 3455 | try testing.expectEqualSlices(u8, &(([_]u8{0} ** 13) ++ ([_]u8{0xaa} ** 3)), buffer1); |
| 3456 | 3456 | m.toConst().writeTwosComplement(buffer1[0..13], .big); |
| 3457 | | try testing.expect(std.mem.eql(u8, buffer1, &(([_]u8{0} ** 13) ++ ([_]u8{0xaa} ** 3)))); |
| 3457 | try testing.expectEqualSlices(u8, &(([_]u8{0} ** 13) ++ ([_]u8{0xaa} ** 3)), buffer1); |
| 3458 | 3458 | m.toConst().writeTwosComplement(buffer1[0..16], .little); |
| 3459 | | try testing.expect(std.mem.eql(u8, buffer1, &(([_]u8{0} ** 16)))); |
| 3459 | try testing.expectEqualSlices(u8, &(([_]u8{0} ** 16)), buffer1); |
| 3460 | 3460 | m.toConst().writeTwosComplement(buffer1[0..16], .big); |
| 3461 | | try testing.expect(std.mem.eql(u8, buffer1, &(([_]u8{0} ** 16)))); |
| 3461 | try testing.expectEqualSlices(u8, &(([_]u8{0} ** 16)), buffer1); |
| 3462 | 3462 | } |
| 3463 | 3463 | |
| 3464 | 3464 | test "big int conversion write twos complement with padding" { |
| ... | ... | @@ -3816,7 +3816,7 @@ test "(BigInt) positive" { |
| 3816 | 3816 | |
| 3817 | 3817 | const b_fmt = try std.fmt.allocPrint(testing.allocator, "{d}", .{b}); |
| 3818 | 3818 | defer testing.allocator.free(b_fmt); |
| 3819 | | try testing.expect(!mem.eql(u8, b_fmt, "(BigInt)")); |
| 3819 | try testing.expect(!mem.eql(u8, "(BigInt)", b_fmt)); |
| 3820 | 3820 | } |
| 3821 | 3821 | |
| 3822 | 3822 | test "(BigInt) negative" { |
| ... | ... | @@ -3840,7 +3840,7 @@ test "(BigInt) negative" { |
| 3840 | 3840 | const b_fmt = try std.fmt.allocPrint(testing.allocator, "{d}", .{b}); |
| 3841 | 3841 | defer testing.allocator.free(b_fmt); |
| 3842 | 3842 | |
| 3843 | | try testing.expect(mem.eql(u8, a_fmt, "(BigInt)")); |
| 3843 | try testing.expectEqualSlices(u8, "(BigInt)", a_fmt); |
| 3844 | 3844 | try testing.expect(!mem.eql(u8, b_fmt, "(BigInt)")); |
| 3845 | 3845 | } |
| 3846 | 3846 | |