authorgravatar for git.litmus427@passinbox.comunplanned <git.litmus427@passinbox.com> 2025-12-04 00:24:45+01:00
committergravatar for git.litmus427@passinbox.comunplanned <git.litmus427@passinbox.com> 2025-12-04 01:12:50+01:00
logc6a14448646980cb1483bb17d38dcd9ae650c78e
treefbde3dc4fbbfde136a35a1610f3b7c7abdec01cc
parentded4e125590f2e113f184acc1d79718ac21b83d9

std.math.big.int.int_test: replace mem.eql by expectEqualSlices


1 files changed, 24 insertions(+), 24 deletions(-)

lib/std/math/big/int_test.zig+24-24
...@@ -737,7 +737,7 @@ test "string to" {...@@ -737,7 +737,7 @@ test "string to" {
737 defer testing.allocator.free(as);737 defer testing.allocator.free(as);
738 const es = "120317241209124781241290847124";738 const es = "120317241209124781241290847124";
739739
740 try testing.expect(mem.eql(u8, as, es));740 try testing.expectEqualSlices(u8, es, as);
741}741}
742742
743test "string to base base error" {743test "string to base base error" {
...@@ -755,7 +755,7 @@ test "string to base 2" {...@@ -755,7 +755,7 @@ test "string to base 2" {
755 defer testing.allocator.free(as);755 defer testing.allocator.free(as);
756 const es = "-1011";756 const es = "-1011";
757757
758 try testing.expect(mem.eql(u8, as, es));758 try testing.expectEqualSlices(u8, es, as);
759}759}
760760
761test "string to base 16" {761test "string to base 16" {
...@@ -766,7 +766,7 @@ test "string to base 16" {...@@ -766,7 +766,7 @@ test "string to base 16" {
766 defer testing.allocator.free(as);766 defer testing.allocator.free(as);
767 const es = "efffffff00000001eeeeeeefaaaaaaab";767 const es = "efffffff00000001eeeeeeefaaaaaaab";
768768
769 try testing.expect(mem.eql(u8, as, es));769 try testing.expectEqualSlices(u8, es, as);
770}770}
771771
772test "string to base 36" {772test "string to base 36" {
...@@ -777,7 +777,7 @@ test "string to base 36" {...@@ -777,7 +777,7 @@ test "string to base 36" {
777 defer testing.allocator.free(as);777 defer testing.allocator.free(as);
778 const es = "fifvthrv1mzt79ez9";778 const es = "fifvthrv1mzt79ez9";
779779
780 try testing.expect(mem.eql(u8, as, es));780 try testing.expectEqualSlices(u8, es, as);
781}781}
782782
783test "neg string to" {783test "neg string to" {
...@@ -788,7 +788,7 @@ test "neg string to" {...@@ -788,7 +788,7 @@ test "neg string to" {
788 defer testing.allocator.free(as);788 defer testing.allocator.free(as);
789 const es = "-123907434";789 const es = "-123907434";
790790
791 try testing.expect(mem.eql(u8, as, es));791 try testing.expectEqualSlices(u8, es, as);
792}792}
793793
794test "zero string to" {794test "zero string to" {
...@@ -799,7 +799,7 @@ test "zero string to" {...@@ -799,7 +799,7 @@ test "zero string to" {
799 defer testing.allocator.free(as);799 defer testing.allocator.free(as);
800 const es = "0";800 const es = "0";
801801
802 try testing.expect(mem.eql(u8, as, es));802 try testing.expectEqualSlices(u8, es, as);
803}803}
804804
805test "clone" {805test "clone" {
...@@ -3404,26 +3404,26 @@ test "big int conversion read twos complement with padding" {...@@ -3404,26 +3404,26 @@ test "big int conversion read twos complement with padding" {
34043404
3405 var bit_count: usize = 12 * 8 + 1;3405 var bit_count: usize = 12 * 8 + 1;
3406 a.toConst().writeTwosComplement(buffer1[0..13], .little);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 a.toConst().writeTwosComplement(buffer1[0..13], .big);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 a.toConst().writeTwosComplement(buffer1[0..16], .little);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 a.toConst().writeTwosComplement(buffer1[0..16], .big);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);
34143414
3415 @memset(buffer1, 0xaa);3415 @memset(buffer1, 0xaa);
3416 try a.set(-0x01_02030405_06070809_0a0b0c0d);3416 try a.set(-0x01_02030405_06070809_0a0b0c0d);
3417 bit_count = 12 * 8 + 2;3417 bit_count = 12 * 8 + 2;
34183418
3419 a.toConst().writeTwosComplement(buffer1[0..13], .little);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 a.toConst().writeTwosComplement(buffer1[0..13], .big);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 a.toConst().writeTwosComplement(buffer1[0..16], .little);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 a.toConst().writeTwosComplement(buffer1[0..16], .big);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}
34283428
3429test "big int write twos complement +/- zero" {3429test "big int write twos complement +/- zero" {
...@@ -3438,13 +3438,13 @@ test "big int write twos complement +/- zero" {...@@ -3438,13 +3438,13 @@ test "big int write twos complement +/- zero" {
3438 // Test zero3438 // Test zero
34393439
3440 m.toConst().writeTwosComplement(buffer1[0..13], .little);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 m.toConst().writeTwosComplement(buffer1[0..13], .big);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 m.toConst().writeTwosComplement(buffer1[0..16], .little);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 m.toConst().writeTwosComplement(buffer1[0..16], .big);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);
34483448
3449 @memset(buffer1, 0xaa);3449 @memset(buffer1, 0xaa);
3450 m.positive = false;3450 m.positive = false;
...@@ -3452,13 +3452,13 @@ test "big int write twos complement +/- zero" {...@@ -3452,13 +3452,13 @@ test "big int write twos complement +/- zero" {
3452 // Test negative zero3452 // Test negative zero
34533453
3454 m.toConst().writeTwosComplement(buffer1[0..13], .little);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 m.toConst().writeTwosComplement(buffer1[0..13], .big);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 m.toConst().writeTwosComplement(buffer1[0..16], .little);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 m.toConst().writeTwosComplement(buffer1[0..16], .big);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}
34633463
3464test "big int conversion write twos complement with padding" {3464test "big int conversion write twos complement with padding" {
...@@ -3816,7 +3816,7 @@ test "(BigInt) positive" {...@@ -3816,7 +3816,7 @@ test "(BigInt) positive" {
38163816
3817 const b_fmt = try std.fmt.allocPrint(testing.allocator, "{d}", .{b});3817 const b_fmt = try std.fmt.allocPrint(testing.allocator, "{d}", .{b});
3818 defer testing.allocator.free(b_fmt);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}
38213821
3822test "(BigInt) negative" {3822test "(BigInt) negative" {
...@@ -3840,7 +3840,7 @@ test "(BigInt) negative" {...@@ -3840,7 +3840,7 @@ test "(BigInt) negative" {
3840 const b_fmt = try std.fmt.allocPrint(testing.allocator, "{d}", .{b});3840 const b_fmt = try std.fmt.allocPrint(testing.allocator, "{d}", .{b});
3841 defer testing.allocator.free(b_fmt);3841 defer testing.allocator.free(b_fmt);
38423842
3843 try testing.expect(mem.eql(u8, a_fmt, "(BigInt)"));3843 try testing.expectEqualSlices(u8, "(BigInt)", a_fmt);
3844 try testing.expect(!mem.eql(u8, b_fmt, "(BigInt)"));3844 try testing.expect(!mem.eql(u8, b_fmt, "(BigInt)"));
3845}3845}
38463846