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" {
737737 defer testing.allocator.free(as);
738738 const es = "120317241209124781241290847124";
739739
740 try testing.expect(mem.eql(u8, as, es));
740 try testing.expectEqualSlices(u8, es, as);
741741}
742742
743743test "string to base base error" {
......@@ -755,7 +755,7 @@ test "string to base 2" {
755755 defer testing.allocator.free(as);
756756 const es = "-1011";
757757
758 try testing.expect(mem.eql(u8, as, es));
758 try testing.expectEqualSlices(u8, es, as);
759759}
760760
761761test "string to base 16" {
......@@ -766,7 +766,7 @@ test "string to base 16" {
766766 defer testing.allocator.free(as);
767767 const es = "efffffff00000001eeeeeeefaaaaaaab";
768768
769 try testing.expect(mem.eql(u8, as, es));
769 try testing.expectEqualSlices(u8, es, as);
770770}
771771
772772test "string to base 36" {
......@@ -777,7 +777,7 @@ test "string to base 36" {
777777 defer testing.allocator.free(as);
778778 const es = "fifvthrv1mzt79ez9";
779779
780 try testing.expect(mem.eql(u8, as, es));
780 try testing.expectEqualSlices(u8, es, as);
781781}
782782
783783test "neg string to" {
......@@ -788,7 +788,7 @@ test "neg string to" {
788788 defer testing.allocator.free(as);
789789 const es = "-123907434";
790790
791 try testing.expect(mem.eql(u8, as, es));
791 try testing.expectEqualSlices(u8, es, as);
792792}
793793
794794test "zero string to" {
......@@ -799,7 +799,7 @@ test "zero string to" {
799799 defer testing.allocator.free(as);
800800 const es = "0";
801801
802 try testing.expect(mem.eql(u8, as, es));
802 try testing.expectEqualSlices(u8, es, as);
803803}
804804
805805test "clone" {
......@@ -3404,26 +3404,26 @@ test "big int conversion read twos complement with padding" {
34043404
34053405 var bit_count: usize = 12 * 8 + 1;
34063406 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);
34083408 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);
34103410 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);
34123412 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
34153415 @memset(buffer1, 0xaa);
34163416 try a.set(-0x01_02030405_06070809_0a0b0c0d);
34173417 bit_count = 12 * 8 + 2;
34183418
34193419 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);
34213421 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);
34233423 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);
34253425 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);
34273427}
34283428
34293429test "big int write twos complement +/- zero" {
......@@ -3438,13 +3438,13 @@ test "big int write twos complement +/- zero" {
34383438 // Test zero
34393439
34403440 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);
34423442 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);
34443444 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);
34463446 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
34493449 @memset(buffer1, 0xaa);
34503450 m.positive = false;
......@@ -3452,13 +3452,13 @@ test "big int write twos complement +/- zero" {
34523452 // Test negative zero
34533453
34543454 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);
34563456 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);
34583458 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);
34603460 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);
34623462}
34633463
34643464test "big int conversion write twos complement with padding" {
......@@ -3816,7 +3816,7 @@ test "(BigInt) positive" {
38163816
38173817 const b_fmt = try std.fmt.allocPrint(testing.allocator, "{d}", .{b});
38183818 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));
38203820}
38213821
38223822test "(BigInt) negative" {
......@@ -3840,7 +3840,7 @@ test "(BigInt) negative" {
38403840 const b_fmt = try std.fmt.allocPrint(testing.allocator, "{d}", .{b});
38413841 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);
38443844 try testing.expect(!mem.eql(u8, b_fmt, "(BigInt)"));
38453845}
38463846