diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2024-02-26 23:43:02 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-02-26 23:43:02 -0800 |
| commit | 085bde6889925b486291ddf1450b6bb6c8562a8f (patch) | |
| tree | 02f7a49b4378dc2387b825bfc19825405f4502ca /lib/std/math | |
| parent | 4e2570baafb587c679ee0fc5e113ddeb36522a5d (diff) | |
| parent | 726a1149e05669e5cc05a16ce877bbb2be787e39 (diff) | |
| download | zig-085bde6889925b486291ddf1450b6bb6c8562a8f.tar.gz zig-085bde6889925b486291ddf1450b6bb6c8562a8f.zip | |
Merge pull request #19087 from squeek502/redundant-test-naming
Remove redundant test name prefixes now that test names are fully qualified
Diffstat (limited to 'lib/std/math')
55 files changed, 358 insertions, 360 deletions
diff --git a/lib/std/math/acos.zig b/lib/std/math/acos.zig index b451664885..dfb3caf4d9 100644 --- a/lib/std/math/acos.zig +++ b/lib/std/math/acos.zig @@ -148,12 +148,12 @@ fn acos64(x: f64) f64 { return 2 * (df + w); } -test "math.acos" { +test acos { try expect(acos(@as(f32, 0.0)) == acos32(0.0)); try expect(acos(@as(f64, 0.0)) == acos64(0.0)); } -test "math.acos32" { +test acos32 { const epsilon = 0.000001; try expect(math.approxEqAbs(f32, acos32(0.0), 1.570796, epsilon)); @@ -164,7 +164,7 @@ test "math.acos32" { try expect(math.approxEqAbs(f32, acos32(-0.2), 1.772154, epsilon)); } -test "math.acos64" { +test acos64 { const epsilon = 0.000001; try expect(math.approxEqAbs(f64, acos64(0.0), 1.570796, epsilon)); @@ -175,12 +175,12 @@ test "math.acos64" { try expect(math.approxEqAbs(f64, acos64(-0.2), 1.772154, epsilon)); } -test "math.acos32.special" { +test "acos32.special" { try expect(math.isNan(acos32(-2))); try expect(math.isNan(acos32(1.5))); } -test "math.acos64.special" { +test "acos64.special" { try expect(math.isNan(acos64(-2))); try expect(math.isNan(acos64(1.5))); } diff --git a/lib/std/math/acosh.zig b/lib/std/math/acosh.zig index 5ffb6e141c..8c86dbba4c 100644 --- a/lib/std/math/acosh.zig +++ b/lib/std/math/acosh.zig @@ -59,12 +59,12 @@ fn acosh64(x: f64) f64 { } } -test "math.acosh" { +test acosh { try expect(acosh(@as(f32, 1.5)) == acosh32(1.5)); try expect(acosh(@as(f64, 1.5)) == acosh64(1.5)); } -test "math.acosh32" { +test acosh32 { const epsilon = 0.000001; try expect(math.approxEqAbs(f32, acosh32(1.5), 0.962424, epsilon)); @@ -73,7 +73,7 @@ test "math.acosh32" { try expect(math.approxEqAbs(f32, acosh32(123123.234375), 12.414088, epsilon)); } -test "math.acosh64" { +test acosh64 { const epsilon = 0.000001; try expect(math.approxEqAbs(f64, acosh64(1.5), 0.962424, epsilon)); @@ -82,12 +82,12 @@ test "math.acosh64" { try expect(math.approxEqAbs(f64, acosh64(123123.234375), 12.414088, epsilon)); } -test "math.acosh32.special" { +test "acosh32.special" { try expect(math.isNan(acosh32(math.nan(f32)))); try expect(math.isNan(acosh32(0.5))); } -test "math.acosh64.special" { +test "acosh64.special" { try expect(math.isNan(acosh64(math.nan(f64)))); try expect(math.isNan(acosh64(0.5))); } diff --git a/lib/std/math/asin.zig b/lib/std/math/asin.zig index da16f92c3c..cb4571c24e 100644 --- a/lib/std/math/asin.zig +++ b/lib/std/math/asin.zig @@ -141,12 +141,12 @@ fn asin64(x: f64) f64 { } } -test "math.asin" { +test asin { try expect(asin(@as(f32, 0.0)) == asin32(0.0)); try expect(asin(@as(f64, 0.0)) == asin64(0.0)); } -test "math.asin32" { +test asin32 { const epsilon = 0.000001; try expect(math.approxEqAbs(f32, asin32(0.0), 0.0, epsilon)); @@ -157,7 +157,7 @@ test "math.asin32" { try expect(math.approxEqAbs(f32, asin32(0.8923), 1.102415, epsilon)); } -test "math.asin64" { +test asin64 { const epsilon = 0.000001; try expect(math.approxEqAbs(f64, asin64(0.0), 0.0, epsilon)); @@ -168,14 +168,14 @@ test "math.asin64" { try expect(math.approxEqAbs(f64, asin64(0.8923), 1.102415, epsilon)); } -test "math.asin32.special" { +test "asin32.special" { try expect(math.isPositiveZero(asin32(0.0))); try expect(math.isNegativeZero(asin32(-0.0))); try expect(math.isNan(asin32(-2))); try expect(math.isNan(asin32(1.5))); } -test "math.asin64.special" { +test "asin64.special" { try expect(math.isPositiveZero(asin64(0.0))); try expect(math.isNegativeZero(asin64(-0.0))); try expect(math.isNan(asin64(-2))); diff --git a/lib/std/math/asinh.zig b/lib/std/math/asinh.zig index 796be5fdc7..b2fd1b13a2 100644 --- a/lib/std/math/asinh.zig +++ b/lib/std/math/asinh.zig @@ -80,12 +80,12 @@ fn asinh64(x: f64) f64 { return if (s != 0) -rx else rx; } -test "math.asinh" { +test asinh { try expect(asinh(@as(f32, 0.0)) == asinh32(0.0)); try expect(asinh(@as(f64, 0.0)) == asinh64(0.0)); } -test "math.asinh32" { +test asinh32 { const epsilon = 0.000001; try expect(math.approxEqAbs(f32, asinh32(0.0), 0.0, epsilon)); @@ -98,7 +98,7 @@ test "math.asinh32" { try expect(math.approxEqAbs(f32, asinh32(123123.234375), 12.414088, epsilon)); } -test "math.asinh64" { +test asinh64 { const epsilon = 0.000001; try expect(math.approxEqAbs(f64, asinh64(0.0), 0.0, epsilon)); @@ -111,7 +111,7 @@ test "math.asinh64" { try expect(math.approxEqAbs(f64, asinh64(123123.234375), 12.414088, epsilon)); } -test "math.asinh32.special" { +test "asinh32.special" { try expect(math.isPositiveZero(asinh32(0.0))); try expect(math.isNegativeZero(asinh32(-0.0))); try expect(math.isPositiveInf(asinh32(math.inf(f32)))); @@ -119,7 +119,7 @@ test "math.asinh32.special" { try expect(math.isNan(asinh32(math.nan(f32)))); } -test "math.asinh64.special" { +test "asinh64.special" { try expect(math.isPositiveZero(asinh64(0.0))); try expect(math.isNegativeZero(asinh64(-0.0))); try expect(math.isPositiveInf(asinh64(math.inf(f64)))); diff --git a/lib/std/math/atan.zig b/lib/std/math/atan.zig index ebd4b8ca5a..377d96897f 100644 --- a/lib/std/math/atan.zig +++ b/lib/std/math/atan.zig @@ -212,12 +212,12 @@ fn atan64(x_: f64) f64 { } } -test "math.atan" { +test atan { try expect(@as(u32, @bitCast(atan(@as(f32, 0.2)))) == @as(u32, @bitCast(atan32(0.2)))); try expect(atan(@as(f64, 0.2)) == atan64(0.2)); } -test "math.atan32" { +test atan32 { const epsilon = 0.000001; try expect(math.approxEqAbs(f32, atan32(0.2), 0.197396, epsilon)); @@ -227,7 +227,7 @@ test "math.atan32" { try expect(math.approxEqAbs(f32, atan32(1.5), 0.982794, epsilon)); } -test "math.atan64" { +test atan64 { const epsilon = 0.000001; try expect(math.approxEqAbs(f64, atan64(0.2), 0.197396, epsilon)); @@ -237,7 +237,7 @@ test "math.atan64" { try expect(math.approxEqAbs(f64, atan64(1.5), 0.982794, epsilon)); } -test "math.atan32.special" { +test "atan32.special" { const epsilon = 0.000001; try expect(math.isPositiveZero(atan32(0.0))); @@ -246,7 +246,7 @@ test "math.atan32.special" { try expect(math.approxEqAbs(f32, atan32(-math.inf(f32)), -math.pi / 2.0, epsilon)); } -test "math.atan64.special" { +test "atan64.special" { const epsilon = 0.000001; try expect(math.isPositiveZero(atan64(0.0))); diff --git a/lib/std/math/atan2.zig b/lib/std/math/atan2.zig index a60fa73e8c..f0c8aa0792 100644 --- a/lib/std/math/atan2.zig +++ b/lib/std/math/atan2.zig @@ -214,7 +214,7 @@ fn atan2_64(y: f64, x: f64) f64 { } } -test "math.atan2" { +test atan2 { const y32: f32 = 0.2; const x32: f32 = 0.21; const y64: f64 = 0.2; @@ -223,7 +223,7 @@ test "math.atan2" { try expect(atan2(y64, x64) == atan2_64(0.2, 0.21)); } -test "math.atan2_32" { +test atan2_32 { const epsilon = 0.000001; try expect(math.approxEqAbs(f32, atan2_32(0.0, 0.0), 0.0, epsilon)); @@ -235,7 +235,7 @@ test "math.atan2_32" { try expect(math.approxEqAbs(f32, atan2_32(0.34, 1.243), 0.267001, epsilon)); } -test "math.atan2_64" { +test atan2_64 { const epsilon = 0.000001; try expect(math.approxEqAbs(f64, atan2_64(0.0, 0.0), 0.0, epsilon)); @@ -247,7 +247,7 @@ test "math.atan2_64" { try expect(math.approxEqAbs(f64, atan2_64(0.34, 1.243), 0.267001, epsilon)); } -test "math.atan2_32.special" { +test "atan2_32.special" { const epsilon = 0.000001; try expect(math.isNan(atan2_32(1.0, math.nan(f32)))); @@ -271,7 +271,7 @@ test "math.atan2_32.special" { try expect(math.approxEqAbs(f32, atan2_32(-math.inf(f32), 1.0), -math.pi / 2.0, epsilon)); } -test "math.atan2_64.special" { +test "atan2_64.special" { const epsilon = 0.000001; try expect(math.isNan(atan2_64(1.0, math.nan(f64)))); diff --git a/lib/std/math/atanh.zig b/lib/std/math/atanh.zig index 3f504bf99f..4cca62a8e7 100644 --- a/lib/std/math/atanh.zig +++ b/lib/std/math/atanh.zig @@ -84,12 +84,12 @@ fn atanh_64(x: f64) f64 { return if (s != 0) -y else y; } -test "math.atanh" { +test atanh { try expect(atanh(@as(f32, 0.0)) == atanh_32(0.0)); try expect(atanh(@as(f64, 0.0)) == atanh_64(0.0)); } -test "math.atanh_32" { +test atanh_32 { const epsilon = 0.000001; try expect(math.approxEqAbs(f32, atanh_32(0.0), 0.0, epsilon)); @@ -97,7 +97,7 @@ test "math.atanh_32" { try expect(math.approxEqAbs(f32, atanh_32(0.8923), 1.433099, epsilon)); } -test "math.atanh_64" { +test atanh_64 { const epsilon = 0.000001; try expect(math.approxEqAbs(f64, atanh_64(0.0), 0.0, epsilon)); @@ -105,7 +105,7 @@ test "math.atanh_64" { try expect(math.approxEqAbs(f64, atanh_64(0.8923), 1.433099, epsilon)); } -test "math.atanh32.special" { +test "atanh32.special" { try expect(math.isPositiveInf(atanh_32(1))); try expect(math.isNegativeInf(atanh_32(-1))); try expect(math.isNan(atanh_32(1.5))); @@ -113,7 +113,7 @@ test "math.atanh32.special" { try expect(math.isNan(atanh_32(math.nan(f32)))); } -test "math.atanh64.special" { +test "atanh64.special" { try expect(math.isPositiveInf(atanh_64(1))); try expect(math.isNegativeInf(atanh_64(-1))); try expect(math.isNan(atanh_64(1.5))); diff --git a/lib/std/math/big/int_test.zig b/lib/std/math/big/int_test.zig index 558ada3374..251d1c5acd 100644 --- a/lib/std/math/big/int_test.zig +++ b/lib/std/math/big/int_test.zig @@ -17,7 +17,7 @@ const minInt = std.math.minInt; // They will still run on larger than this and should pass, but the multi-limb code-paths // may be untested in some cases. -test "big.int comptime_int set" { +test "comptime_int set" { comptime var s = 0xefffffff00000001eeeeeeefaaaaaaab; var a = try Managed.initSet(testing.allocator, s); defer a.deinit(); @@ -33,7 +33,7 @@ test "big.int comptime_int set" { } } -test "big.int comptime_int set negative" { +test "comptime_int set negative" { var a = try Managed.initSet(testing.allocator, -10); defer a.deinit(); @@ -41,7 +41,7 @@ test "big.int comptime_int set negative" { try testing.expect(a.isPositive() == false); } -test "big.int int set unaligned small" { +test "int set unaligned small" { var a = try Managed.initSet(testing.allocator, @as(u7, 45)); defer a.deinit(); @@ -49,28 +49,28 @@ test "big.int int set unaligned small" { try testing.expect(a.isPositive() == true); } -test "big.int comptime_int to" { +test "comptime_int to" { var a = try Managed.initSet(testing.allocator, 0xefffffff00000001eeeeeeefaaaaaaab); defer a.deinit(); try testing.expect((try a.to(u128)) == 0xefffffff00000001eeeeeeefaaaaaaab); } -test "big.int sub-limb to" { +test "sub-limb to" { var a = try Managed.initSet(testing.allocator, 10); defer a.deinit(); try testing.expect((try a.to(u8)) == 10); } -test "big.int set negative minimum" { +test "set negative minimum" { var a = try Managed.initSet(testing.allocator, @as(i64, minInt(i64))); defer a.deinit(); try testing.expect((try a.to(i64)) == minInt(i64)); } -test "big.int set double-width maximum then zero" { +test "set double-width maximum then zero" { var a = try Managed.initSet(testing.allocator, maxInt(DoubleLimb)); defer a.deinit(); try a.set(@as(DoubleLimb, 0)); @@ -78,14 +78,14 @@ test "big.int set double-width maximum then zero" { try testing.expectEqual(@as(DoubleLimb, 0), try a.to(DoubleLimb)); } -test "big.int to target too small error" { +test "to target too small error" { var a = try Managed.initSet(testing.allocator, 0xffffffff); defer a.deinit(); try testing.expectError(error.TargetTooSmall, a.to(u8)); } -test "big.int normalize" { +test "normalize" { var a = try Managed.init(testing.allocator); defer a.deinit(); try a.ensureCapacity(8); @@ -113,7 +113,7 @@ test "big.int normalize" { try testing.expect(a.len() == 1); } -test "big.int normalize multi" { +test "normalize multi" { var a = try Managed.init(testing.allocator); defer a.deinit(); try a.ensureCapacity(8); @@ -143,7 +143,7 @@ test "big.int normalize multi" { try testing.expect(a.len() == 1); } -test "big.int parity" { +test "parity" { var a = try Managed.init(testing.allocator); defer a.deinit(); @@ -156,7 +156,7 @@ test "big.int parity" { try testing.expect(a.isOdd()); } -test "big.int bitcount + sizeInBaseUpperBound" { +test "bitcount + sizeInBaseUpperBound" { var a = try Managed.init(testing.allocator); defer a.deinit(); @@ -184,7 +184,7 @@ test "big.int bitcount + sizeInBaseUpperBound" { try testing.expect(a.sizeInBaseUpperBound(2) >= 5033); } -test "big.int bitcount/to" { +test "bitcount/to" { var a = try Managed.init(testing.allocator); defer a.deinit(); @@ -215,7 +215,7 @@ test "big.int bitcount/to" { try testing.expect((try a.to(i9)) == -129); } -test "big.int fits" { +test "fits" { var a = try Managed.init(testing.allocator); defer a.deinit(); @@ -243,7 +243,7 @@ test "big.int fits" { try testing.expect(a.fits(u65)); } -test "big.int string set" { +test "string set" { var a = try Managed.init(testing.allocator); defer a.deinit(); @@ -251,7 +251,7 @@ test "big.int string set" { try testing.expect((try a.to(u128)) == 120317241209124781241290847124); } -test "big.int string negative" { +test "string negative" { var a = try Managed.init(testing.allocator); defer a.deinit(); @@ -259,7 +259,7 @@ test "big.int string negative" { try testing.expect((try a.to(i32)) == -1023); } -test "big.int string set number with underscores" { +test "string set number with underscores" { var a = try Managed.init(testing.allocator); defer a.deinit(); @@ -267,7 +267,7 @@ test "big.int string set number with underscores" { try testing.expect((try a.to(u128)) == 120317241209124781241290847124); } -test "big.int string set case insensitive number" { +test "string set case insensitive number" { var a = try Managed.init(testing.allocator); defer a.deinit(); @@ -275,19 +275,19 @@ test "big.int string set case insensitive number" { try testing.expect((try a.to(u32)) == 0xabcdef); } -test "big.int string set bad char error" { +test "string set bad char error" { var a = try Managed.init(testing.allocator); defer a.deinit(); try testing.expectError(error.InvalidCharacter, a.setString(10, "x")); } -test "big.int string set bad base error" { +test "string set bad base error" { var a = try Managed.init(testing.allocator); defer a.deinit(); try testing.expectError(error.InvalidBase, a.setString(45, "10")); } -test "big.int twos complement limit set" { +test "twos complement limit set" { const test_types = [_]type{ u64, i64, @@ -315,7 +315,7 @@ test "big.int twos complement limit set" { } } -test "big.int string to" { +test "string to" { var a = try Managed.initSet(testing.allocator, 120317241209124781241290847124); defer a.deinit(); @@ -326,14 +326,14 @@ test "big.int string to" { try testing.expect(mem.eql(u8, as, es)); } -test "big.int string to base base error" { +test "string to base base error" { var a = try Managed.initSet(testing.allocator, 0xffffffff); defer a.deinit(); try testing.expectError(error.InvalidBase, a.toString(testing.allocator, 45, .lower)); } -test "big.int string to base 2" { +test "string to base 2" { var a = try Managed.initSet(testing.allocator, -0b1011); defer a.deinit(); @@ -344,7 +344,7 @@ test "big.int string to base 2" { try testing.expect(mem.eql(u8, as, es)); } -test "big.int string to base 16" { +test "string to base 16" { var a = try Managed.initSet(testing.allocator, 0xefffffff00000001eeeeeeefaaaaaaab); defer a.deinit(); @@ -355,7 +355,7 @@ test "big.int string to base 16" { try testing.expect(mem.eql(u8, as, es)); } -test "big.int neg string to" { +test "neg string to" { var a = try Managed.initSet(testing.allocator, -123907434); defer a.deinit(); @@ -366,7 +366,7 @@ test "big.int neg string to" { try testing.expect(mem.eql(u8, as, es)); } -test "big.int zero string to" { +test "zero string to" { var a = try Managed.initSet(testing.allocator, 0); defer a.deinit(); @@ -377,7 +377,7 @@ test "big.int zero string to" { try testing.expect(mem.eql(u8, as, es)); } -test "big.int clone" { +test "clone" { var a = try Managed.initSet(testing.allocator, 1234); defer a.deinit(); var b = try a.clone(); @@ -391,7 +391,7 @@ test "big.int clone" { try testing.expect((try b.to(u32)) == 1234); } -test "big.int swap" { +test "swap" { var a = try Managed.initSet(testing.allocator, 1234); defer a.deinit(); var b = try Managed.initSet(testing.allocator, 5678); @@ -406,14 +406,14 @@ test "big.int swap" { try testing.expect((try b.to(u32)) == 1234); } -test "big.int to negative" { +test "to negative" { var a = try Managed.initSet(testing.allocator, -10); defer a.deinit(); try testing.expect((try a.to(i32)) == -10); } -test "big.int compare" { +test "compare" { var a = try Managed.initSet(testing.allocator, -11); defer a.deinit(); var b = try Managed.initSet(testing.allocator, 10); @@ -423,7 +423,7 @@ test "big.int compare" { try testing.expect(a.order(b) == .lt); } -test "big.int compare similar" { +test "compare similar" { var a = try Managed.initSet(testing.allocator, 0xffffffffeeeeeeeeffffffffeeeeeeee); defer a.deinit(); var b = try Managed.initSet(testing.allocator, 0xffffffffeeeeeeeeffffffffeeeeeeef); @@ -433,7 +433,7 @@ test "big.int compare similar" { try testing.expect(b.orderAbs(a) == .gt); } -test "big.int compare different limb size" { +test "compare different limb size" { var a = try Managed.initSet(testing.allocator, maxInt(Limb) + 1); defer a.deinit(); var b = try Managed.initSet(testing.allocator, 1); @@ -443,7 +443,7 @@ test "big.int compare different limb size" { try testing.expect(b.orderAbs(a) == .lt); } -test "big.int compare multi-limb" { +test "compare multi-limb" { var a = try Managed.initSet(testing.allocator, -0x7777777799999999ffffeeeeffffeeeeffffeeeef); defer a.deinit(); var b = try Managed.initSet(testing.allocator, 0x7777777799999999ffffeeeeffffeeeeffffeeeee); @@ -453,7 +453,7 @@ test "big.int compare multi-limb" { try testing.expect(a.order(b) == .lt); } -test "big.int equality" { +test "equality" { var a = try Managed.initSet(testing.allocator, 0xffffffff1); defer a.deinit(); var b = try Managed.initSet(testing.allocator, -0xffffffff1); @@ -463,7 +463,7 @@ test "big.int equality" { try testing.expect(!a.eql(b)); } -test "big.int abs" { +test "abs" { var a = try Managed.initSet(testing.allocator, -5); defer a.deinit(); @@ -474,7 +474,7 @@ test "big.int abs" { try testing.expect((try a.to(u32)) == 5); } -test "big.int negate" { +test "negate" { var a = try Managed.initSet(testing.allocator, 5); defer a.deinit(); @@ -485,7 +485,7 @@ test "big.int negate" { try testing.expect((try a.to(i32)) == 5); } -test "big.int add single-single" { +test "add single-single" { var a = try Managed.initSet(testing.allocator, 50); defer a.deinit(); var b = try Managed.initSet(testing.allocator, 5); @@ -498,7 +498,7 @@ test "big.int add single-single" { try testing.expect((try c.to(u32)) == 55); } -test "big.int add multi-single" { +test "add multi-single" { var a = try Managed.initSet(testing.allocator, maxInt(Limb) + 1); defer a.deinit(); var b = try Managed.initSet(testing.allocator, 1); @@ -514,7 +514,7 @@ test "big.int add multi-single" { try testing.expect((try c.to(DoubleLimb)) == maxInt(Limb) + 2); } -test "big.int add multi-multi" { +test "add multi-multi" { var op1: u128 = 0xefefefef7f7f7f7f; var op2: u128 = 0xfefefefe9f9f9f9f; // These must be runtime-known to prevent this comparison being tautological, as the @@ -532,7 +532,7 @@ test "big.int add multi-multi" { try testing.expect((try c.to(u128)) == op1 + op2); } -test "big.int add zero-zero" { +test "add zero-zero" { var a = try Managed.initSet(testing.allocator, 0); defer a.deinit(); var b = try Managed.initSet(testing.allocator, 0); @@ -545,7 +545,7 @@ test "big.int add zero-zero" { try testing.expect((try c.to(u32)) == 0); } -test "big.int add alias multi-limb nonzero-zero" { +test "add alias multi-limb nonzero-zero" { const op1 = 0xffffffff777777771; var a = try Managed.initSet(testing.allocator, op1); defer a.deinit(); @@ -557,7 +557,7 @@ test "big.int add alias multi-limb nonzero-zero" { try testing.expect((try a.to(u128)) == op1); } -test "big.int add sign" { +test "add sign" { var a = try Managed.init(testing.allocator); defer a.deinit(); @@ -583,7 +583,7 @@ test "big.int add sign" { try testing.expect((try a.to(i32)) == -3); } -test "big.int add comptime scalar" { +test "add comptime scalar" { var a = try Managed.initSet(testing.allocator, 50); defer a.deinit(); @@ -594,7 +594,7 @@ test "big.int add comptime scalar" { try testing.expect((try b.to(u32)) == 55); } -test "big.int add scalar" { +test "add scalar" { var a = try Managed.initSet(testing.allocator, 123); defer a.deinit(); @@ -605,7 +605,7 @@ test "big.int add scalar" { try testing.expect((try b.to(u32)) == 154); } -test "big.int addWrap single-single, unsigned" { +test "addWrap single-single, unsigned" { var a = try Managed.initSet(testing.allocator, maxInt(u17)); defer a.deinit(); @@ -618,7 +618,7 @@ test "big.int addWrap single-single, unsigned" { try testing.expect((try a.to(u17)) == 9); } -test "big.int subWrap single-single, unsigned" { +test "subWrap single-single, unsigned" { var a = try Managed.initSet(testing.allocator, 0); defer a.deinit(); @@ -631,7 +631,7 @@ test "big.int subWrap single-single, unsigned" { try testing.expect((try a.to(u17)) == 1); } -test "big.int addWrap multi-multi, unsigned, limb aligned" { +test "addWrap multi-multi, unsigned, limb aligned" { var a = try Managed.initSet(testing.allocator, maxInt(DoubleLimb)); defer a.deinit(); @@ -644,7 +644,7 @@ test "big.int addWrap multi-multi, unsigned, limb aligned" { try testing.expect((try a.to(DoubleLimb)) == maxInt(DoubleLimb) - 1); } -test "big.int subWrap single-multi, unsigned, limb aligned" { +test "subWrap single-multi, unsigned, limb aligned" { var a = try Managed.initSet(testing.allocator, 10); defer a.deinit(); @@ -657,7 +657,7 @@ test "big.int subWrap single-multi, unsigned, limb aligned" { try testing.expect((try a.to(DoubleLimb)) == maxInt(DoubleLimb) - 88); } -test "big.int addWrap single-single, signed" { +test "addWrap single-single, signed" { var a = try Managed.initSet(testing.allocator, maxInt(i21)); defer a.deinit(); @@ -670,7 +670,7 @@ test "big.int addWrap single-single, signed" { try testing.expect((try a.to(i21)) == minInt(i21)); } -test "big.int subWrap single-single, signed" { +test "subWrap single-single, signed" { var a = try Managed.initSet(testing.allocator, minInt(i21)); defer a.deinit(); @@ -683,7 +683,7 @@ test "big.int subWrap single-single, signed" { try testing.expect((try a.to(i21)) == maxInt(i21)); } -test "big.int addWrap multi-multi, signed, limb aligned" { +test "addWrap multi-multi, signed, limb aligned" { var a = try Managed.initSet(testing.allocator, maxInt(SignedDoubleLimb)); defer a.deinit(); @@ -696,7 +696,7 @@ test "big.int addWrap multi-multi, signed, limb aligned" { try testing.expect((try a.to(SignedDoubleLimb)) == -2); } -test "big.int subWrap single-multi, signed, limb aligned" { +test "subWrap single-multi, signed, limb aligned" { var a = try Managed.initSet(testing.allocator, minInt(SignedDoubleLimb)); defer a.deinit(); @@ -709,7 +709,7 @@ test "big.int subWrap single-multi, signed, limb aligned" { try testing.expect((try a.to(SignedDoubleLimb)) == maxInt(SignedDoubleLimb)); } -test "big.int addSat single-single, unsigned" { +test "addSat single-single, unsigned" { var a = try Managed.initSet(testing.allocator, maxInt(u17) - 5); defer a.deinit(); @@ -721,7 +721,7 @@ test "big.int addSat single-single, unsigned" { try testing.expect((try a.to(u17)) == maxInt(u17)); } -test "big.int subSat single-single, unsigned" { +test "subSat single-single, unsigned" { var a = try Managed.initSet(testing.allocator, 123); defer a.deinit(); @@ -733,7 +733,7 @@ test "big.int subSat single-single, unsigned" { try testing.expect((try a.to(u17)) == 0); } -test "big.int addSat multi-multi, unsigned, limb aligned" { +test "addSat multi-multi, unsigned, limb aligned" { var a = try Managed.initSet(testing.allocator, maxInt(DoubleLimb)); defer a.deinit(); @@ -745,7 +745,7 @@ test "big.int addSat multi-multi, unsigned, limb aligned" { try testing.expect((try a.to(DoubleLimb)) == maxInt(DoubleLimb)); } -test "big.int subSat single-multi, unsigned, limb aligned" { +test "subSat single-multi, unsigned, limb aligned" { var a = try Managed.initSet(testing.allocator, 10); defer a.deinit(); @@ -757,7 +757,7 @@ test "big.int subSat single-multi, unsigned, limb aligned" { try testing.expect((try a.to(DoubleLimb)) == 0); } -test "big.int addSat single-single, signed" { +test "addSat single-single, signed" { var a = try Managed.initSet(testing.allocator, maxInt(i14)); defer a.deinit(); @@ -769,7 +769,7 @@ test "big.int addSat single-single, signed" { try testing.expect((try a.to(i14)) == maxInt(i14)); } -test "big.int subSat single-single, signed" { +test "subSat single-single, signed" { var a = try Managed.initSet(testing.allocator, minInt(i21)); defer a.deinit(); @@ -781,7 +781,7 @@ test "big.int subSat single-single, signed" { try testing.expect((try a.to(i21)) == minInt(i21)); } -test "big.int addSat multi-multi, signed, limb aligned" { +test "addSat multi-multi, signed, limb aligned" { var a = try Managed.initSet(testing.allocator, maxInt(SignedDoubleLimb)); defer a.deinit(); @@ -793,7 +793,7 @@ test "big.int addSat multi-multi, signed, limb aligned" { try testing.expect((try a.to(SignedDoubleLimb)) == maxInt(SignedDoubleLimb)); } -test "big.int subSat single-multi, signed, limb aligned" { +test "subSat single-multi, signed, limb aligned" { var a = try Managed.initSet(testing.allocator, minInt(SignedDoubleLimb)); defer a.deinit(); @@ -805,7 +805,7 @@ test "big.int subSat single-multi, signed, limb aligned" { try testing.expect((try a.to(SignedDoubleLimb)) == minInt(SignedDoubleLimb)); } -test "big.int sub single-single" { +test "sub single-single" { var a = try Managed.initSet(testing.allocator, 50); defer a.deinit(); var b = try Managed.initSet(testing.allocator, 5); @@ -818,7 +818,7 @@ test "big.int sub single-single" { try testing.expect((try c.to(u32)) == 45); } -test "big.int sub multi-single" { +test "sub multi-single" { var a = try Managed.initSet(testing.allocator, maxInt(Limb) + 1); defer a.deinit(); var b = try Managed.initSet(testing.allocator, 1); @@ -831,7 +831,7 @@ test "big.int sub multi-single" { try testing.expect((try c.to(Limb)) == maxInt(Limb)); } -test "big.int sub multi-multi" { +test "sub multi-multi" { var op1: u128 = 0xefefefefefefefefefefefef; var op2: u128 = 0xabababababababababababab; _ = .{ &op1, &op2 }; @@ -848,7 +848,7 @@ test "big.int sub multi-multi" { try testing.expect((try c.to(u128)) == op1 - op2); } -test "big.int sub equal" { +test "sub equal" { var a = try Managed.initSet(testing.allocator, 0x11efefefefefefefefefefefef); defer a.deinit(); var b = try Managed.initSet(testing.allocator, 0x11efefefefefefefefefefefef); @@ -861,7 +861,7 @@ test "big.int sub equal" { try testing.expect((try c.to(u32)) == 0); } -test "big.int sub sign" { +test "sub sign" { var a = try Managed.init(testing.allocator); defer a.deinit(); @@ -890,7 +890,7 @@ test "big.int sub sign" { try testing.expect((try a.to(i32)) == -1); } -test "big.int mul single-single" { +test "mul single-single" { var a = try Managed.initSet(testing.allocator, 50); defer a.deinit(); var b = try Managed.initSet(testing.allocator, 5); @@ -903,7 +903,7 @@ test "big.int mul single-single" { try testing.expect((try c.to(u64)) == 250); } -test "big.int mul multi-single" { +test "mul multi-single" { var a = try Managed.initSet(testing.allocator, maxInt(Limb)); defer a.deinit(); var b = try Managed.initSet(testing.allocator, 2); @@ -916,7 +916,7 @@ test "big.int mul multi-single" { try testing.expect((try c.to(DoubleLimb)) == 2 * maxInt(Limb)); } -test "big.int mul multi-multi" { +test "mul multi-multi" { if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; var op1: u256 = 0x998888efefefefefefefef; @@ -935,7 +935,7 @@ test "big.int mul multi-multi" { try testing.expect((try c.to(u256)) == op1 * op2); } -test "big.int mul alias r with a" { +test "mul alias r with a" { var a = try Managed.initSet(testing.allocator, maxInt(Limb)); defer a.deinit(); var b = try Managed.initSet(testing.allocator, 2); @@ -946,7 +946,7 @@ test "big.int mul alias r with a" { try testing.expect((try a.to(DoubleLimb)) == 2 * maxInt(Limb)); } -test "big.int mul alias r with b" { +test "mul alias r with b" { var a = try Managed.initSet(testing.allocator, maxInt(Limb)); defer a.deinit(); var b = try Managed.initSet(testing.allocator, 2); @@ -957,7 +957,7 @@ test "big.int mul alias r with b" { try testing.expect((try a.to(DoubleLimb)) == 2 * maxInt(Limb)); } -test "big.int mul alias r with a and b" { +test "mul alias r with a and b" { var a = try Managed.initSet(testing.allocator, maxInt(Limb)); defer a.deinit(); @@ -966,7 +966,7 @@ test "big.int mul alias r with a and b" { try testing.expect((try a.to(DoubleLimb)) == maxInt(Limb) * maxInt(Limb)); } -test "big.int mul a*0" { +test "mul a*0" { var a = try Managed.initSet(testing.allocator, 0xefefefefefefefef); defer a.deinit(); var b = try Managed.initSet(testing.allocator, 0); @@ -979,7 +979,7 @@ test "big.int mul a*0" { try testing.expect((try c.to(u32)) == 0); } -test "big.int mul 0*0" { +test "mul 0*0" { var a = try Managed.initSet(testing.allocator, 0); defer a.deinit(); var b = try Managed.initSet(testing.allocator, 0); @@ -992,7 +992,7 @@ test "big.int mul 0*0" { try testing.expect((try c.to(u32)) == 0); } -test "big.int mul large" { +test "mul large" { var a = try Managed.initCapacity(testing.allocator, 50); defer a.deinit(); var b = try Managed.initCapacity(testing.allocator, 100); @@ -1013,7 +1013,7 @@ test "big.int mul large" { try testing.expect(b.eql(c)); } -test "big.int mulWrap single-single unsigned" { +test "mulWrap single-single unsigned" { var a = try Managed.initSet(testing.allocator, 1234); defer a.deinit(); var b = try Managed.initSet(testing.allocator, 5678); @@ -1026,7 +1026,7 @@ test "big.int mulWrap single-single unsigned" { try testing.expect((try c.to(u17)) == 59836); } -test "big.int mulWrap single-single signed" { +test "mulWrap single-single signed" { var a = try Managed.initSet(testing.allocator, 1234); defer a.deinit(); var b = try Managed.initSet(testing.allocator, -5678); @@ -1039,7 +1039,7 @@ test "big.int mulWrap single-single signed" { try testing.expect((try c.to(i17)) == -59836); } -test "big.int mulWrap multi-multi unsigned" { +test "mulWrap multi-multi unsigned" { if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; var op1: u256 = 0x998888efefefefefefefef; @@ -1058,7 +1058,7 @@ test "big.int mulWrap multi-multi unsigned" { try testing.expect((try c.to(u256)) == (op1 * op2) & ((1 << 65) - 1)); } -test "big.int mulWrap multi-multi signed" { +test "mulWrap multi-multi signed" { switch (builtin.zig_backend) { .stage2_c => return error.SkipZigTest, else => {}, @@ -1076,7 +1076,7 @@ test "big.int mulWrap multi-multi signed" { try testing.expect((try c.to(SignedDoubleLimb)) == minInt(SignedDoubleLimb) + 2); } -test "big.int mulWrap large" { +test "mulWrap large" { var a = try Managed.initCapacity(testing.allocator, 50); defer a.deinit(); var b = try Managed.initCapacity(testing.allocator, 100); @@ -1100,7 +1100,7 @@ test "big.int mulWrap large" { try testing.expect(b.eql(c)); } -test "big.int div single-half no rem" { +test "div single-half no rem" { var a = try Managed.initSet(testing.allocator, 50); defer a.deinit(); var b = try Managed.initSet(testing.allocator, 5); @@ -1116,7 +1116,7 @@ test "big.int div single-half no rem" { try testing.expect((try r.to(u32)) == 0); } -test "big.int div single-half with rem" { +test "div single-half with rem" { var a = try Managed.initSet(testing.allocator, 49); defer a.deinit(); var b = try Managed.initSet(testing.allocator, 5); @@ -1132,7 +1132,7 @@ test "big.int div single-half with rem" { try testing.expect((try r.to(u32)) == 4); } -test "big.int div single-single no rem" { +test "div single-single no rem" { // assumes usize is <= 64 bits. var a = try Managed.initSet(testing.allocator, 1 << 52); defer a.deinit(); @@ -1149,7 +1149,7 @@ test "big.int div single-single no rem" { try testing.expect((try r.to(u32)) == 0); } -test "big.int div single-single with rem" { +test "div single-single with rem" { var a = try Managed.initSet(testing.allocator, (1 << 52) | (1 << 33)); defer a.deinit(); var b = try Managed.initSet(testing.allocator, (1 << 35)); @@ -1165,7 +1165,7 @@ test "big.int div single-single with rem" { try testing.expect((try r.to(u64)) == 8589934592); } -test "big.int div multi-single no rem" { +test "div multi-single no rem" { var op1: u128 = 0xffffeeeeddddcccc; var op2: u128 = 34; _ = .{ &op1, &op2 }; @@ -1185,7 +1185,7 @@ test "big.int div multi-single no rem" { try testing.expect((try r.to(u64)) == 0); } -test "big.int div multi-single with rem" { +test "div multi-single with rem" { var op1: u128 = 0xffffeeeeddddcccf; var op2: u128 = 34; _ = .{ &op1, &op2 }; @@ -1205,7 +1205,7 @@ test "big.int div multi-single with rem" { try testing.expect((try r.to(u64)) == 3); } -test "big.int div multi>2-single" { +test "div multi>2-single" { var op1: u128 = 0xfefefefefefefefefefefefefefefefe; var op2: u128 = 0xefab8; _ = .{ &op1, &op2 }; @@ -1225,7 +1225,7 @@ test "big.int div multi>2-single" { try testing.expect((try r.to(u32)) == 0x3e4e); } -test "big.int div single-single q < r" { +test "div single-single q < r" { var a = try Managed.initSet(testing.allocator, 0x0078f432); defer a.deinit(); var b = try Managed.initSet(testing.allocator, 0x01000000); @@ -1241,7 +1241,7 @@ test "big.int div single-single q < r" { try testing.expect((try r.to(u64)) == 0x0078f432); } -test "big.int div single-single q == r" { +test "div single-single q == r" { var a = try Managed.initSet(testing.allocator, 10); defer a.deinit(); var b = try Managed.initSet(testing.allocator, 10); @@ -1257,7 +1257,7 @@ test "big.int div single-single q == r" { try testing.expect((try r.to(u64)) == 0); } -test "big.int div q=0 alias" { +test "div q=0 alias" { var a = try Managed.initSet(testing.allocator, 3); defer a.deinit(); var b = try Managed.initSet(testing.allocator, 10); @@ -1269,7 +1269,7 @@ test "big.int div q=0 alias" { try testing.expect((try b.to(u64)) == 3); } -test "big.int div multi-multi q < r" { +test "div multi-multi q < r" { if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; const op1 = 0x1ffffffff0078f432; @@ -1289,7 +1289,7 @@ test "big.int div multi-multi q < r" { try testing.expect((try r.to(u128)) == op1); } -test "big.int div trunc single-single +/+" { +test "div trunc single-single +/+" { const u: i32 = 5; const v: i32 = 3; @@ -1313,7 +1313,7 @@ test "big.int div trunc single-single +/+" { try testing.expect((try r.to(i32)) == er); } -test "big.int div trunc single-single -/+" { +test "div trunc single-single -/+" { const u: i32 = -5; const v: i32 = 3; @@ -1337,7 +1337,7 @@ test "big.int div trunc single-single -/+" { try testing.expect((try r.to(i32)) == er); } -test "big.int div trunc single-single +/-" { +test "div trunc single-single +/-" { const u: i32 = 5; const v: i32 = -3; @@ -1361,7 +1361,7 @@ test "big.int div trunc single-single +/-" { try testing.expect((try r.to(i32)) == er); } -test "big.int div trunc single-single -/-" { +test "div trunc single-single -/-" { const u: i32 = -5; const v: i32 = -3; @@ -1385,7 +1385,7 @@ test "big.int div trunc single-single -/-" { try testing.expect((try r.to(i32)) == er); } -test "big.int divTrunc #15535" { +test "divTrunc #15535" { var one = try Managed.initSet(testing.allocator, 1); defer one.deinit(); var x = try Managed.initSet(testing.allocator, std.math.pow(u128, 2, 64)); @@ -1398,7 +1398,7 @@ test "big.int divTrunc #15535" { try testing.expect(r.order(one) == std.math.Order.lt); } -test "big.int divFloor #10932" { +test "divFloor #10932" { var a = try Managed.init(testing.allocator); defer a.deinit(); @@ -1422,7 +1422,7 @@ test "big.int divFloor #10932" { try testing.expect((try mod.to(i32)) == 0); } -test "big.int divFloor #11166" { +test "divFloor #11166" { var a = try Managed.init(testing.allocator); defer a.deinit(); @@ -1449,7 +1449,7 @@ test "big.int divFloor #11166" { try testing.expect(std.mem.eql(u8, mods, "870000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000")); } -test "big.int gcd #10932" { +test "gcd #10932" { var a = try Managed.init(testing.allocator); defer a.deinit(); @@ -1469,7 +1469,7 @@ test "big.int gcd #10932" { try testing.expect(std.mem.eql(u8, ress, "1a974a5c9734476ff5a3604bcc678a756beacfc21b4427d1f2c1f56f5d4e411a162c56136e20000000000000000000000000000000")); } -test "big.int bitAnd #10932" { +test "bitAnd #10932" { var a = try Managed.init(testing.allocator); defer a.deinit(); @@ -1487,7 +1487,7 @@ test "big.int bitAnd #10932" { try testing.expect((try res.to(i32)) == 0); } -test "big.int div floor single-single +/+" { +test "div floor single-single +/+" { const u: i32 = 5; const v: i32 = 3; @@ -1511,7 +1511,7 @@ test "big.int div floor single-single +/+" { try testing.expect((try r.to(i32)) == er); } -test "big.int div floor single-single -/+" { +test "div floor single-single -/+" { const u: i32 = -5; const v: i32 = 3; @@ -1535,7 +1535,7 @@ test "big.int div floor single-single -/+" { try testing.expect((try r.to(i32)) == er); } -test "big.int div floor single-single +/-" { +test "div floor single-single +/-" { const u: i32 = 5; const v: i32 = -3; @@ -1559,7 +1559,7 @@ test "big.int div floor single-single +/-" { try testing.expect((try r.to(i32)) == er); } -test "big.int div floor single-single -/-" { +test "div floor single-single -/-" { const u: i32 = -5; const v: i32 = -3; @@ -1583,7 +1583,7 @@ test "big.int div floor single-single -/-" { try testing.expect((try r.to(i32)) == er); } -test "big.int div floor no remainder negative quotient" { +test "div floor no remainder negative quotient" { const u: i32 = -0x80000000; const v: i32 = 1; @@ -1602,7 +1602,7 @@ test "big.int div floor no remainder negative quotient" { try testing.expect((try r.to(i32)) == 0); } -test "big.int div floor negative close to zero" { +test "div floor negative close to zero" { const u: i32 = -2; const v: i32 = 12; @@ -1621,7 +1621,7 @@ test "big.int div floor negative close to zero" { try testing.expect((try r.to(i32)) == 10); } -test "big.int div floor positive close to zero" { +test "div floor positive close to zero" { const u: i32 = 10; const v: i32 = 12; @@ -1640,7 +1640,7 @@ test "big.int div floor positive close to zero" { try testing.expect((try r.to(i32)) == 10); } -test "big.int div multi-multi with rem" { +test "div multi-multi with rem" { if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; var a = try Managed.initSet(testing.allocator, 0x8888999911110000ffffeeeeddddccccbbbbaaaa9999); @@ -1658,7 +1658,7 @@ test "big.int div multi-multi with rem" { try testing.expect((try r.to(u128)) == 0x28de0acacd806823638); } -test "big.int div multi-multi no rem" { +test "div multi-multi no rem" { if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; var a = try Managed.initSet(testing.allocator, 0x8888999911110000ffffeeeedb4fec200ee3a4286361); @@ -1676,7 +1676,7 @@ test "big.int div multi-multi no rem" { try testing.expect((try r.to(u128)) == 0); } -test "big.int div multi-multi (2 branch)" { +test "div multi-multi (2 branch)" { if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; var a = try Managed.initSet(testing.allocator, 0x866666665555555588888887777777761111111111111111); @@ -1694,7 +1694,7 @@ test "big.int div multi-multi (2 branch)" { try testing.expect((try r.to(u128)) == 0x44444443444444431111111111111111); } -test "big.int div multi-multi (3.1/3.3 branch)" { +test "div multi-multi (3.1/3.3 branch)" { if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; var a = try Managed.initSet(testing.allocator, 0x11111111111111111111111111111111111111111111111111111111111111); @@ -1712,7 +1712,7 @@ test "big.int div multi-multi (3.1/3.3 branch)" { try testing.expect((try r.to(u256)) == 0x1111111111111111111110b12222222222222222282); } -test "big.int div multi-single zero-limb trailing" { +test "div multi-single zero-limb trailing" { if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; var a = try Managed.initSet(testing.allocator, 0x60000000000000000000000000000000000000000000000000000000000000000); @@ -1732,7 +1732,7 @@ test "big.int div multi-single zero-limb trailing" { try testing.expect(r.eqlZero()); } -test "big.int div multi-multi zero-limb trailing (with rem)" { +test "div multi-multi zero-limb trailing (with rem)" { if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; var a = try Managed.initSet(testing.allocator, 0x86666666555555558888888777777776111111111111111100000000000000000000000000000000); @@ -1753,7 +1753,7 @@ test "big.int div multi-multi zero-limb trailing (with rem)" { try testing.expect(std.mem.eql(u8, rs, "4444444344444443111111111111111100000000000000000000000000000000")); } -test "big.int div multi-multi zero-limb trailing (with rem) and dividend zero-limb count > divisor zero-limb count" { +test "div multi-multi zero-limb trailing (with rem) and dividend zero-limb count > divisor zero-limb count" { if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; var a = try Managed.initSet(testing.allocator, 0x8666666655555555888888877777777611111111111111110000000000000000); @@ -1774,7 +1774,7 @@ test "big.int div multi-multi zero-limb trailing (with rem) and dividend zero-li try testing.expect(std.mem.eql(u8, rs, "444444434444444311111111111111110000000000000000")); } -test "big.int div multi-multi zero-limb trailing (with rem) and dividend zero-limb count < divisor zero-limb count" { +test "div multi-multi zero-limb trailing (with rem) and dividend zero-limb count < divisor zero-limb count" { if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; var a = try Managed.initSet(testing.allocator, 0x86666666555555558888888777777776111111111111111100000000000000000000000000000000); @@ -1797,7 +1797,7 @@ test "big.int div multi-multi zero-limb trailing (with rem) and dividend zero-li try testing.expect(std.mem.eql(u8, rs, "4e11f2baa5896a321d463b543d0104e30000000000000000")); } -test "big.int div multi-multi fuzz case #1" { +test "div multi-multi fuzz case #1" { var a = try Managed.init(testing.allocator); defer a.deinit(); var b = try Managed.init(testing.allocator); @@ -1821,7 +1821,7 @@ test "big.int div multi-multi fuzz case #1" { try testing.expect(std.mem.eql(u8, rs, "310d1d4c414426b4836c2635bad1df3a424e50cbdd167ffccb4dfff57d36b4aae0d6ca0910698220171a0f3373c1060a046c2812f0027e321f72979daa5e7973214170d49e885de0c0ecc167837d44502430674a82522e5df6a0759548052420b91ec1")); } -test "big.int div multi-multi fuzz case #2" { +test "div multi-multi fuzz case #2" { var a = try Managed.init(testing.allocator); defer a.deinit(); var b = try Managed.init(testing.allocator); @@ -1845,7 +1845,7 @@ test "big.int div multi-multi fuzz case #2" { try testing.expect(std.mem.eql(u8, rs, "a900000000000000000000000000000000000000000000000000")); } -test "big.int truncate single unsigned" { +test "truncate single unsigned" { var a = try Managed.initSet(testing.allocator, maxInt(u47)); defer a.deinit(); @@ -1854,7 +1854,7 @@ test "big.int truncate single unsigned" { try testing.expect((try a.to(u17)) == maxInt(u17)); } -test "big.int truncate single signed" { +test "truncate single signed" { var a = try Managed.initSet(testing.allocator, 0x1_0000); defer a.deinit(); @@ -1863,7 +1863,7 @@ test "big.int truncate single signed" { try testing.expect((try a.to(i17)) == minInt(i17)); } -test "big.int truncate multi to single unsigned" { +test "truncate multi to single unsigned" { var a = try Managed.initSet(testing.allocator, (maxInt(Limb) + 1) | 0x1234_5678_9ABC_DEF0); defer a.deinit(); @@ -1872,7 +1872,7 @@ test "big.int truncate multi to single unsigned" { try testing.expect((try a.to(u27)) == 0x2BC_DEF0); } -test "big.int truncate multi to single signed" { +test "truncate multi to single signed" { var a = try Managed.initSet(testing.allocator, maxInt(Limb) << 10); defer a.deinit(); @@ -1881,7 +1881,7 @@ test "big.int truncate multi to single signed" { try testing.expect((try a.to(i11)) == minInt(i11)); } -test "big.int truncate multi to multi unsigned" { +test "truncate multi to multi unsigned" { const bits = @typeInfo(SignedDoubleLimb).Int.bits; const Int = std.meta.Int(.unsigned, bits - 1); @@ -1893,7 +1893,7 @@ test "big.int truncate multi to multi unsigned" { try testing.expect((try a.to(Int)) == maxInt(Int)); } -test "big.int truncate multi to multi signed" { +test "truncate multi to multi signed" { var a = try Managed.initSet(testing.allocator, 3 << @bitSizeOf(Limb)); defer a.deinit(); @@ -1902,7 +1902,7 @@ test "big.int truncate multi to multi signed" { try testing.expect((try a.to(std.meta.Int(.signed, @bitSizeOf(Limb) + 1))) == -1 << @bitSizeOf(Limb)); } -test "big.int truncate negative multi to single" { +test "truncate negative multi to single" { var a = try Managed.initSet(testing.allocator, -@as(SignedDoubleLimb, maxInt(Limb) + 1)); defer a.deinit(); @@ -1911,7 +1911,7 @@ test "big.int truncate negative multi to single" { try testing.expect((try a.to(i17)) == 0); } -test "big.int truncate multi unsigned many" { +test "truncate multi unsigned many" { var a = try Managed.initSet(testing.allocator, 1); defer a.deinit(); try a.shiftLeft(&a, 1023); @@ -1923,7 +1923,7 @@ test "big.int truncate multi unsigned many" { try testing.expect((try b.to(i1)) == 0); } -test "big.int saturate single signed positive" { +test "saturate single signed positive" { var a = try Managed.initSet(testing.allocator, 0xBBBB_BBBB); defer a.deinit(); @@ -1932,7 +1932,7 @@ test "big.int saturate single signed positive" { try testing.expect((try a.to(i17)) == maxInt(i17)); } -test "big.int saturate single signed negative" { +test "saturate single signed negative" { var a = try Managed.initSet(testing.allocator, -1_234_567); defer a.deinit(); @@ -1941,7 +1941,7 @@ test "big.int saturate single signed negative" { try testing.expect((try a.to(i17)) == minInt(i17)); } -test "big.int saturate single signed" { +test "saturate single signed" { var a = try Managed.initSet(testing.allocator, maxInt(i17) - 1); defer a.deinit(); @@ -1950,7 +1950,7 @@ test "big.int saturate single signed" { try testing.expect((try a.to(i17)) == maxInt(i17) - 1); } -test "big.int saturate multi signed" { +test "saturate multi signed" { var a = try Managed.initSet(testing.allocator, maxInt(Limb) << @bitSizeOf(SignedDoubleLimb)); defer a.deinit(); @@ -1959,7 +1959,7 @@ test "big.int saturate multi signed" { try testing.expect((try a.to(SignedDoubleLimb)) == maxInt(SignedDoubleLimb)); } -test "big.int saturate single unsigned" { +test "saturate single unsigned" { var a = try Managed.initSet(testing.allocator, 0xFEFE_FEFE); defer a.deinit(); @@ -1968,7 +1968,7 @@ test "big.int saturate single unsigned" { try testing.expect((try a.to(u23)) == maxInt(u23)); } -test "big.int saturate multi unsigned zero" { +test "saturate multi unsigned zero" { var a = try Managed.initSet(testing.allocator, -1); defer a.deinit(); @@ -1977,7 +1977,7 @@ test "big.int saturate multi unsigned zero" { try testing.expect(a.eqlZero()); } -test "big.int saturate multi unsigned" { +test "saturate multi unsigned" { var a = try Managed.initSet(testing.allocator, maxInt(Limb) << @bitSizeOf(DoubleLimb)); defer a.deinit(); @@ -1986,7 +1986,7 @@ test "big.int saturate multi unsigned" { try testing.expect((try a.to(DoubleLimb)) == maxInt(DoubleLimb)); } -test "big.int shift-right single" { +test "shift-right single" { var a = try Managed.initSet(testing.allocator, 0xffff0000); defer a.deinit(); try a.shiftRight(&a, 16); @@ -1994,7 +1994,7 @@ test "big.int shift-right single" { try testing.expect((try a.to(u32)) == 0xffff); } -test "big.int shift-right multi" { +test "shift-right multi" { var a = try Managed.initSet(testing.allocator, 0xffff0000eeee1111dddd2222cccc3333); defer a.deinit(); try a.shiftRight(&a, 67); @@ -2008,7 +2008,7 @@ test "big.int shift-right multi" { try testing.expect(a.eqlZero()); } -test "big.int shift-left single" { +test "shift-left single" { var a = try Managed.initSet(testing.allocator, 0xffff); defer a.deinit(); try a.shiftLeft(&a, 16); @@ -2016,7 +2016,7 @@ test "big.int shift-left single" { try testing.expect((try a.to(u64)) == 0xffff0000); } -test "big.int shift-left multi" { +test "shift-left multi" { var a = try Managed.initSet(testing.allocator, 0x1fffe0001dddc222); defer a.deinit(); try a.shiftLeft(&a, 67); @@ -2024,7 +2024,7 @@ test "big.int shift-left multi" { try testing.expect((try a.to(u128)) == 0xffff0000eeee11100000000000000000); } -test "big.int shift-right negative" { +test "shift-right negative" { var a = try Managed.init(testing.allocator); defer a.deinit(); @@ -2044,7 +2044,7 @@ test "big.int shift-right negative" { try testing.expect((try a.to(i32)) == -1); // -10 >> 1232 == -1 } -test "big.int sat shift-left simple unsigned" { +test "sat shift-left simple unsigned" { var a = try Managed.initSet(testing.allocator, 0xffff); defer a.deinit(); try a.shiftLeftSat(&a, 16, .unsigned, 21); @@ -2052,7 +2052,7 @@ test "big.int sat shift-left simple unsigned" { try testing.expect((try a.to(u64)) == 0x1fffff); } -test "big.int sat shift-left simple unsigned no sat" { +test "sat shift-left simple unsigned no sat" { var a = try Managed.initSet(testing.allocator, 1); defer a.deinit(); try a.shiftLeftSat(&a, 16, .unsigned, 21); @@ -2060,7 +2060,7 @@ test "big.int sat shift-left simple unsigned no sat" { try testing.expect((try a.to(u64)) == 0x10000); } -test "big.int sat shift-left multi unsigned" { +test "sat shift-left multi unsigned" { var a = try Managed.initSet(testing.allocator, 16); defer a.deinit(); try a.shiftLeftSat(&a, @bitSizeOf(DoubleLimb) - 3, .unsigned, @bitSizeOf(DoubleLimb) - 1); @@ -2068,7 +2068,7 @@ test "big.int sat shift-left multi unsigned" { try testing.expect((try a.to(DoubleLimb)) == maxInt(DoubleLimb) >> 1); } -test "big.int sat shift-left unsigned shift > bitcount" { +test "sat shift-left unsigned shift > bitcount" { var a = try Managed.initSet(testing.allocator, 1); defer a.deinit(); try a.shiftLeftSat(&a, 10, .unsigned, 10); @@ -2076,7 +2076,7 @@ test "big.int sat shift-left unsigned shift > bitcount" { try testing.expect((try a.to(u10)) == maxInt(u10)); } -test "big.int sat shift-left unsigned zero" { +test "sat shift-left unsigned zero" { var a = try Managed.initSet(testing.allocator, 0); defer a.deinit(); try a.shiftLeftSat(&a, 1, .unsigned, 0); @@ -2084,7 +2084,7 @@ test "big.int sat shift-left unsigned zero" { try testing.expect((try a.to(u64)) == 0); } -test "big.int sat shift-left unsigned negative" { +test "sat shift-left unsigned negative" { var a = try Managed.initSet(testing.allocator, -100); defer a.deinit(); try a.shiftLeftSat(&a, 0, .unsigned, 0); @@ -2092,7 +2092,7 @@ test "big.int sat shift-left unsigned negative" { try testing.expect((try a.to(u64)) == 0); } -test "big.int sat shift-left signed simple negative" { +test "sat shift-left signed simple negative" { var a = try Managed.initSet(testing.allocator, -100); defer a.deinit(); try a.shiftLeftSat(&a, 3, .signed, 10); @@ -2100,7 +2100,7 @@ test "big.int sat shift-left signed simple negative" { try testing.expect((try a.to(i10)) == minInt(i10)); } -test "big.int sat shift-left signed simple positive" { +test "sat shift-left signed simple positive" { var a = try Managed.initSet(testing.allocator, 100); defer a.deinit(); try a.shiftLeftSat(&a, 3, .signed, 10); @@ -2108,7 +2108,7 @@ test "big.int sat shift-left signed simple positive" { try testing.expect((try a.to(i10)) == maxInt(i10)); } -test "big.int sat shift-left signed multi positive" { +test "sat shift-left signed multi positive" { if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; var x: SignedDoubleLimb = 1; @@ -2123,7 +2123,7 @@ test "big.int sat shift-left signed multi positive" { try testing.expect((try a.to(SignedDoubleLimb)) == x <<| shift); } -test "big.int sat shift-left signed multi negative" { +test "sat shift-left signed multi negative" { if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; var x: SignedDoubleLimb = -1; @@ -2138,7 +2138,7 @@ test "big.int sat shift-left signed multi negative" { try testing.expect((try a.to(SignedDoubleLimb)) == x <<| shift); } -test "big.int bitNotWrap unsigned simple" { +test "bitNotWrap unsigned simple" { var x: u10 = 123; _ = &x; @@ -2150,7 +2150,7 @@ test "big.int bitNotWrap unsigned simple" { try testing.expect((try a.to(u10)) == ~x); } -test "big.int bitNotWrap unsigned multi" { +test "bitNotWrap unsigned multi" { var a = try Managed.initSet(testing.allocator, 0); defer a.deinit(); @@ -2159,7 +2159,7 @@ test "big.int bitNotWrap unsigned multi" { try testing.expect((try a.to(DoubleLimb)) == maxInt(DoubleLimb)); } -test "big.int bitNotWrap signed simple" { +test "bitNotWrap signed simple" { var x: i11 = -456; _ = &x; @@ -2171,7 +2171,7 @@ test "big.int bitNotWrap signed simple" { try testing.expect((try a.to(i11)) == ~x); } -test "big.int bitNotWrap signed multi" { +test "bitNotWrap signed multi" { var a = try Managed.initSet(testing.allocator, 0); defer a.deinit(); @@ -2180,7 +2180,7 @@ test "big.int bitNotWrap signed multi" { try testing.expect((try a.to(SignedDoubleLimb)) == -1); } -test "big.int bitNotWrap more than two limbs" { +test "bitNotWrap more than two limbs" { // This test requires int sizes greater than 128 bits. if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO @@ -2206,7 +2206,7 @@ test "big.int bitNotWrap more than two limbs" { try testing.expectEqual((try res.to(Signed)), ~@as(Signed, maxInt(Limb))); } -test "big.int bitwise and simple" { +test "bitwise and simple" { var a = try Managed.initSet(testing.allocator, 0xffffffff11111111); defer a.deinit(); var b = try Managed.initSet(testing.allocator, 0xeeeeeeee22222222); @@ -2217,7 +2217,7 @@ test "big.int bitwise and simple" { try testing.expect((try a.to(u64)) == 0xeeeeeeee00000000); } -test "big.int bitwise and multi-limb" { +test "bitwise and multi-limb" { var a = try Managed.initSet(testing.allocator, maxInt(Limb) + 1); defer a.deinit(); var b = try Managed.initSet(testing.allocator, maxInt(Limb)); @@ -2228,7 +2228,7 @@ test "big.int bitwise and multi-limb" { try testing.expect((try a.to(u128)) == 0); } -test "big.int bitwise and negative-positive simple" { +test "bitwise and negative-positive simple" { var a = try Managed.initSet(testing.allocator, -0xffffffff11111111); defer a.deinit(); var b = try Managed.initSet(testing.allocator, 0xeeeeeeee22222222); @@ -2239,7 +2239,7 @@ test "big.int bitwise and negative-positive simple" { try testing.expect((try a.to(u64)) == 0x22222222); } -test "big.int bitwise and negative-positive multi-limb" { +test "bitwise and negative-positive multi-limb" { var a = try Managed.initSet(testing.allocator, -maxInt(Limb) - 1); defer a.deinit(); var b = try Managed.initSet(testing.allocator, maxInt(Limb)); @@ -2250,7 +2250,7 @@ test "big.int bitwise and negative-positive multi-limb" { try testing.expect(a.eqlZero()); } -test "big.int bitwise and positive-negative simple" { +test "bitwise and positive-negative simple" { var a = try Managed.initSet(testing.allocator, 0xffffffff11111111); defer a.deinit(); var b = try Managed.initSet(testing.allocator, -0xeeeeeeee22222222); @@ -2261,7 +2261,7 @@ test "big.int bitwise and positive-negative simple" { try testing.expect((try a.to(u64)) == 0x1111111111111110); } -test "big.int bitwise and positive-negative multi-limb" { +test "bitwise and positive-negative multi-limb" { var a = try Managed.initSet(testing.allocator, maxInt(Limb)); defer a.deinit(); var b = try Managed.initSet(testing.allocator, -maxInt(Limb) - 1); @@ -2272,7 +2272,7 @@ test "big.int bitwise and positive-negative multi-limb" { try testing.expect(a.eqlZero()); } -test "big.int bitwise and negative-negative simple" { +test "bitwise and negative-negative simple" { var a = try Managed.initSet(testing.allocator, -0xffffffff11111111); defer a.deinit(); var b = try Managed.initSet(testing.allocator, -0xeeeeeeee22222222); @@ -2283,7 +2283,7 @@ test "big.int bitwise and negative-negative simple" { try testing.expect((try a.to(i128)) == -0xffffffff33333332); } -test "big.int bitwise and negative-negative multi-limb" { +test "bitwise and negative-negative multi-limb" { var a = try Managed.initSet(testing.allocator, -maxInt(Limb) - 1); defer a.deinit(); var b = try Managed.initSet(testing.allocator, -maxInt(Limb) - 2); @@ -2294,7 +2294,7 @@ test "big.int bitwise and negative-negative multi-limb" { try testing.expect((try a.to(i128)) == -maxInt(Limb) * 2 - 2); } -test "big.int bitwise and negative overflow" { +test "bitwise and negative overflow" { var a = try Managed.initSet(testing.allocator, -maxInt(Limb)); defer a.deinit(); var b = try Managed.initSet(testing.allocator, -2); @@ -2305,7 +2305,7 @@ test "big.int bitwise and negative overflow" { try testing.expect((try a.to(SignedDoubleLimb)) == -maxInt(Limb) - 1); } -test "big.int bitwise xor simple" { +test "bitwise xor simple" { var a = try Managed.initSet(testing.allocator, 0xffffffff11111111); defer a.deinit(); var b = try Managed.initSet(testing.allocator, 0xeeeeeeee22222222); @@ -2316,7 +2316,7 @@ test "big.int bitwise xor simple" { try testing.expect((try a.to(u64)) == 0x1111111133333333); } -test "big.int bitwise xor multi-limb" { +test "bitwise xor multi-limb" { var x: DoubleLimb = maxInt(Limb) + 1; var y: DoubleLimb = maxInt(Limb); _ = .{ &x, &y }; @@ -2331,7 +2331,7 @@ test "big.int bitwise xor multi-limb" { try testing.expect((try a.to(DoubleLimb)) == x ^ y); } -test "big.int bitwise xor single negative simple" { +test "bitwise xor single negative simple" { var a = try Managed.initSet(testing.allocator, 0x6b03e381328a3154); defer a.deinit(); var b = try Managed.initSet(testing.allocator, -0x45fd3acef9191fad); @@ -2342,7 +2342,7 @@ test "big.int bitwise xor single negative simple" { try testing.expect((try a.to(i64)) == -0x2efed94fcb932ef9); } -test "big.int bitwise xor single negative multi-limb" { +test "bitwise xor single negative multi-limb" { var a = try Managed.initSet(testing.allocator, -0x9849c6e7a10d66d0e4260d4846254c32); defer a.deinit(); var b = try Managed.initSet(testing.allocator, 0xf2194e7d1c855272a997fcde16f6d5a8); @@ -2353,7 +2353,7 @@ test "big.int bitwise xor single negative multi-limb" { try testing.expect((try a.to(i128)) == -0x6a50889abd8834a24db1f19650d3999a); } -test "big.int bitwise xor single negative overflow" { +test "bitwise xor single negative overflow" { var a = try Managed.initSet(testing.allocator, maxInt(Limb)); defer a.deinit(); var b = try Managed.initSet(testing.allocator, -1); @@ -2364,7 +2364,7 @@ test "big.int bitwise xor single negative overflow" { try testing.expect((try a.to(SignedDoubleLimb)) == -(maxInt(Limb) + 1)); } -test "big.int bitwise xor double negative simple" { +test "bitwise xor double negative simple" { var a = try Managed.initSet(testing.allocator, -0x8e48bd5f755ef1f3); defer a.deinit(); var b = try Managed.initSet(testing.allocator, -0x4dd4fa576f3046ac); @@ -2375,7 +2375,7 @@ test "big.int bitwise xor double negative simple" { try testing.expect((try a.to(u64)) == 0xc39c47081a6eb759); } -test "big.int bitwise xor double negative multi-limb" { +test "bitwise xor double negative multi-limb" { var a = try Managed.initSet(testing.allocator, -0x684e5da8f500ec8ca7204c33ccc51c9c); defer a.deinit(); var b = try Managed.initSet(testing.allocator, -0xcb07736a7b62289c78d967c3985eebeb); @@ -2386,7 +2386,7 @@ test "big.int bitwise xor double negative multi-limb" { try testing.expect((try a.to(u128)) == 0xa3492ec28e62c410dff92bf0549bf771); } -test "big.int bitwise or simple" { +test "bitwise or simple" { var a = try Managed.initSet(testing.allocator, 0xffffffff11111111); defer a.deinit(); var b = try Managed.initSet(testing.allocator, 0xeeeeeeee22222222); @@ -2397,7 +2397,7 @@ test "big.int bitwise or simple" { try testing.expect((try a.to(u64)) == 0xffffffff33333333); } -test "big.int bitwise or multi-limb" { +test "bitwise or multi-limb" { var a = try Managed.initSet(testing.allocator, maxInt(Limb) + 1); defer a.deinit(); var b = try Managed.initSet(testing.allocator, maxInt(Limb)); @@ -2408,7 +2408,7 @@ test "big.int bitwise or multi-limb" { try testing.expect((try a.to(DoubleLimb)) == (maxInt(Limb) + 1) + maxInt(Limb)); } -test "big.int bitwise or negative-positive simple" { +test "bitwise or negative-positive simple" { var a = try Managed.initSet(testing.allocator, -0xffffffff11111111); defer a.deinit(); var b = try Managed.initSet(testing.allocator, 0xeeeeeeee22222222); @@ -2419,7 +2419,7 @@ test "big.int bitwise or negative-positive simple" { try testing.expect((try a.to(i64)) == -0x1111111111111111); } -test "big.int bitwise or negative-positive multi-limb" { +test "bitwise or negative-positive multi-limb" { var a = try Managed.initSet(testing.allocator, -maxInt(Limb) - 1); defer a.deinit(); var b = try Managed.initSet(testing.allocator, 1); @@ -2430,7 +2430,7 @@ test "big.int bitwise or negative-positive multi-limb" { try testing.expect((try a.to(SignedDoubleLimb)) == -maxInt(Limb)); } -test "big.int bitwise or positive-negative simple" { +test "bitwise or positive-negative simple" { var a = try Managed.initSet(testing.allocator, 0xffffffff11111111); defer a.deinit(); var b = try Managed.initSet(testing.allocator, -0xeeeeeeee22222222); @@ -2441,7 +2441,7 @@ test "big.int bitwise or positive-negative simple" { try testing.expect((try a.to(i64)) == -0x22222221); } -test "big.int bitwise or positive-negative multi-limb" { +test "bitwise or positive-negative multi-limb" { var a = try Managed.initSet(testing.allocator, maxInt(Limb) + 1); defer a.deinit(); var b = try Managed.initSet(testing.allocator, -1); @@ -2452,7 +2452,7 @@ test "big.int bitwise or positive-negative multi-limb" { try testing.expect((try a.to(SignedDoubleLimb)) == -1); } -test "big.int bitwise or negative-negative simple" { +test "bitwise or negative-negative simple" { var a = try Managed.initSet(testing.allocator, -0xffffffff11111111); defer a.deinit(); var b = try Managed.initSet(testing.allocator, -0xeeeeeeee22222222); @@ -2463,7 +2463,7 @@ test "big.int bitwise or negative-negative simple" { try testing.expect((try a.to(i128)) == -0xeeeeeeee00000001); } -test "big.int bitwise or negative-negative multi-limb" { +test "bitwise or negative-negative multi-limb" { var a = try Managed.initSet(testing.allocator, -maxInt(Limb) - 1); defer a.deinit(); var b = try Managed.initSet(testing.allocator, -maxInt(Limb)); @@ -2474,7 +2474,7 @@ test "big.int bitwise or negative-negative multi-limb" { try testing.expect((try a.to(SignedDoubleLimb)) == -maxInt(Limb)); } -test "big.int var args" { +test "var args" { var a = try Managed.initSet(testing.allocator, 5); defer a.deinit(); @@ -2492,7 +2492,7 @@ test "big.int var args" { try testing.expect(a.order(d) != .gt); } -test "big.int gcd non-one small" { +test "gcd non-one small" { var a = try Managed.initSet(testing.allocator, 17); defer a.deinit(); var b = try Managed.initSet(testing.allocator, 97); @@ -2505,7 +2505,7 @@ test "big.int gcd non-one small" { try testing.expect((try r.to(u32)) == 1); } -test "big.int gcd non-one medium" { +test "gcd non-one medium" { var a = try Managed.initSet(testing.allocator, 4864); defer a.deinit(); var b = try Managed.initSet(testing.allocator, 3458); @@ -2518,7 +2518,7 @@ test "big.int gcd non-one medium" { try testing.expect((try r.to(u32)) == 38); } -test "big.int gcd non-one large" { +test "gcd non-one large" { var a = try Managed.initSet(testing.allocator, 0xffffffffffffffff); defer a.deinit(); var b = try Managed.initSet(testing.allocator, 0xffffffffffffffff7777); @@ -2531,7 +2531,7 @@ test "big.int gcd non-one large" { try testing.expect((try r.to(u32)) == 4369); } -test "big.int gcd large multi-limb result" { +test "gcd large multi-limb result" { if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; var a = try Managed.initSet(testing.allocator, 0x12345678123456781234567812345678123456781234567812345678); @@ -2547,7 +2547,7 @@ test "big.int gcd large multi-limb result" { try testing.expect(answer == 0xf000000ff00000fff0000ffff000fffff00ffffff1); } -test "big.int gcd one large" { +test "gcd one large" { var a = try Managed.initSet(testing.allocator, 1897056385327307); defer a.deinit(); var b = try Managed.initSet(testing.allocator, 2251799813685248); @@ -2560,7 +2560,7 @@ test "big.int gcd one large" { try testing.expect((try r.to(u64)) == 1); } -test "big.int mutable to managed" { +test "mutable to managed" { const allocator = testing.allocator; const limbs_buf = try allocator.alloc(Limb, 8); defer allocator.free(limbs_buf); @@ -2571,7 +2571,7 @@ test "big.int mutable to managed" { try testing.expect(a.toConst().eql(a_managed.toConst())); } -test "big.int const to managed" { +test "const to managed" { var a = try Managed.initSet(testing.allocator, 123423453456); defer a.deinit(); @@ -2581,7 +2581,7 @@ test "big.int const to managed" { try testing.expect(a.toConst().eql(b.toConst())); } -test "big.int pow" { +test "pow" { { var a = try Managed.initSet(testing.allocator, -3); defer a.deinit(); @@ -2636,7 +2636,7 @@ test "big.int pow" { } } -test "big.int sqrt" { +test "sqrt" { var r = try Managed.init(testing.allocator); defer r.deinit(); var a = try Managed.init(testing.allocator); @@ -2666,7 +2666,7 @@ test "big.int sqrt" { try testing.expectEqual(@as(i32, 0x100_0000), try r.to(i32)); } -test "big.int regression test for 1 limb overflow with alias" { +test "regression test for 1 limb overflow with alias" { // Note these happen to be two consecutive Fibonacci sequence numbers, the // first two whose sum exceeds 2**64. var a = try Managed.initSet(testing.allocator, 7540113804746346429); @@ -2680,7 +2680,7 @@ test "big.int regression test for 1 limb overflow with alias" { try testing.expect(a.toConst().orderAgainstScalar(19740274219868223167) == .eq); } -test "big.int regression test for realloc with alias" { +test "regression test for realloc with alias" { // Note these happen to be two consecutive Fibonacci sequence numbers, the // second of which is the first such number to exceed 2**192. var a = try Managed.initSet(testing.allocator, 5611500259351924431073312796924978741056961814867751431689); @@ -3099,7 +3099,7 @@ test "big int byte swap" { try byteSwapTest(i48, 0x123456789abc, @as(i48, @bitCast(@as(u48, 0xbc9a78563412)))); } -test "big.int mul multi-multi alias r with a and b" { +test "mul multi-multi alias r with a and b" { var a = try Managed.initSet(testing.allocator, 2 * maxInt(Limb)); defer a.deinit(); @@ -3115,7 +3115,7 @@ test "big.int mul multi-multi alias r with a and b" { } } -test "big.int sqr multi alias r with a" { +test "sqr multi alias r with a" { var a = try Managed.initSet(testing.allocator, 2 * maxInt(Limb)); defer a.deinit(); @@ -3131,7 +3131,7 @@ test "big.int sqr multi alias r with a" { } } -test "big.int eql zeroes #17296" { +test "eql zeroes #17296" { var zero = try Managed.init(testing.allocator); defer zero.deinit(); try zero.setString(10, "0"); @@ -3152,7 +3152,7 @@ test "big.int eql zeroes #17296" { } } -test "big.int.Const.order 0 == -0" { +test "Const.order 0 == -0" { const a = std.math.big.int.Const{ .limbs = &.{0}, .positive = true, @@ -3164,7 +3164,7 @@ test "big.int.Const.order 0 == -0" { try std.testing.expectEqual(std.math.Order.eq, a.order(b)); } -test "big.int.Managed sqrt(0) = 0" { +test "Managed sqrt(0) = 0" { const allocator = testing.allocator; var a = try Managed.initSet(allocator, 1); defer a.deinit(); @@ -3178,7 +3178,7 @@ test "big.int.Managed sqrt(0) = 0" { try testing.expectEqual(@as(i32, 0), try res.to(i32)); } -test "big.int.Managed sqrt(-1) = error" { +test "Managed sqrt(-1) = error" { const allocator = testing.allocator; var a = try Managed.initSet(allocator, 1); defer a.deinit(); @@ -3191,7 +3191,7 @@ test "big.int.Managed sqrt(-1) = error" { try testing.expectError(error.SqrtOfNegativeNumber, res.sqrt(&a)); } -test "big.int.Managed sqrt(n) succeed with res.bitCountAbs() >= usize bits" { +test "Managed sqrt(n) succeed with res.bitCountAbs() >= usize bits" { const allocator = testing.allocator; var a = try Managed.initSet(allocator, 1); defer a.deinit(); diff --git a/lib/std/math/big/rational.zig b/lib/std/math/big/rational.zig index b095d005f0..774e0c1314 100644 --- a/lib/std/math/big/rational.zig +++ b/lib/std/math/big/rational.zig @@ -493,7 +493,7 @@ fn extractLowBits(a: Int, comptime T: type) T { } } -test "big.rational extractLowBits" { +test extractLowBits { var a = try Int.initSet(testing.allocator, 0x11112222333344441234567887654321); defer a.deinit(); @@ -513,7 +513,7 @@ test "big.rational extractLowBits" { try testing.expect(a5 == 0x11112222333344441234567887654321); } -test "big.rational set" { +test "set" { var a = try Rational.init(testing.allocator); defer a.deinit(); @@ -542,7 +542,7 @@ test "big.rational set" { try testing.expect((try a.q.to(i32)) == 1); } -test "big.rational setFloat" { +test "setFloat" { var a = try Rational.init(testing.allocator); defer a.deinit(); @@ -567,7 +567,7 @@ test "big.rational setFloat" { try testing.expect((try a.q.to(u128)) == 70368744177664); } -test "big.rational setFloatString" { +test "setFloatString" { var a = try Rational.init(testing.allocator); defer a.deinit(); @@ -578,7 +578,7 @@ test "big.rational setFloatString" { try testing.expect((try a.q.to(u128)) == 100000000000000000000000000000000000); } -test "big.rational toFloat" { +test "toFloat" { var a = try Rational.init(testing.allocator); defer a.deinit(); @@ -591,7 +591,7 @@ test "big.rational toFloat" { try testing.expect((try a.toFloat(f64)) == 72.141593120712409172417410926841290461290467124); } -test "big.rational set/to Float round-trip" { +test "set/to Float round-trip" { var a = try Rational.init(testing.allocator); defer a.deinit(); var prng = std.Random.DefaultPrng.init(0x5EED); @@ -604,7 +604,7 @@ test "big.rational set/to Float round-trip" { } } -test "big.rational copy" { +test "copy" { var a = try Rational.init(testing.allocator); defer a.deinit(); @@ -634,7 +634,7 @@ test "big.rational copy" { try testing.expect((try a.q.to(u32)) == 1); } -test "big.rational negate" { +test "negate" { var a = try Rational.init(testing.allocator); defer a.deinit(); @@ -651,7 +651,7 @@ test "big.rational negate" { try testing.expect((try a.q.to(i32)) == 1); } -test "big.rational abs" { +test "abs" { var a = try Rational.init(testing.allocator); defer a.deinit(); @@ -668,7 +668,7 @@ test "big.rational abs" { try testing.expect((try a.q.to(i32)) == 1); } -test "big.rational swap" { +test "swap" { var a = try Rational.init(testing.allocator); defer a.deinit(); var b = try Rational.init(testing.allocator); @@ -692,7 +692,7 @@ test "big.rational swap" { try testing.expect((try b.q.to(u32)) == 23); } -test "big.rational order" { +test "order" { var a = try Rational.init(testing.allocator); defer a.deinit(); var b = try Rational.init(testing.allocator); @@ -707,7 +707,7 @@ test "big.rational order" { try testing.expect((try a.order(b)) == .eq); } -test "big.rational order/orderAbs with negative" { +test "order/orderAbs with negative" { var a = try Rational.init(testing.allocator); defer a.deinit(); var b = try Rational.init(testing.allocator); @@ -719,7 +719,7 @@ test "big.rational order/orderAbs with negative" { try testing.expect((try a.orderAbs(b)) == .lt); } -test "big.rational add single-limb" { +test "add single-limb" { var a = try Rational.init(testing.allocator); defer a.deinit(); var b = try Rational.init(testing.allocator); @@ -734,7 +734,7 @@ test "big.rational add single-limb" { try testing.expect((try a.order(b)) == .eq); } -test "big.rational add" { +test "add" { var a = try Rational.init(testing.allocator); defer a.deinit(); var b = try Rational.init(testing.allocator); @@ -750,7 +750,7 @@ test "big.rational add" { try testing.expect((try a.order(r)) == .eq); } -test "big.rational sub" { +test "sub" { var a = try Rational.init(testing.allocator); defer a.deinit(); var b = try Rational.init(testing.allocator); @@ -766,7 +766,7 @@ test "big.rational sub" { try testing.expect((try a.order(r)) == .eq); } -test "big.rational mul" { +test "mul" { var a = try Rational.init(testing.allocator); defer a.deinit(); var b = try Rational.init(testing.allocator); @@ -782,7 +782,7 @@ test "big.rational mul" { try testing.expect((try a.order(r)) == .eq); } -test "big.rational div" { +test "div" { { var a = try Rational.init(testing.allocator); defer a.deinit(); diff --git a/lib/std/math/cbrt.zig b/lib/std/math/cbrt.zig index db0273eda8..e1290fdd2b 100644 --- a/lib/std/math/cbrt.zig +++ b/lib/std/math/cbrt.zig @@ -119,12 +119,12 @@ fn cbrt64(x: f64) f64 { return t + t * q; } -test "math.cbrt" { +test cbrt { try expect(cbrt(@as(f32, 0.0)) == cbrt32(0.0)); try expect(cbrt(@as(f64, 0.0)) == cbrt64(0.0)); } -test "math.cbrt32" { +test cbrt32 { const epsilon = 0.000001; try expect(math.isPositiveZero(cbrt32(0.0))); @@ -135,7 +135,7 @@ test "math.cbrt32" { try expect(math.approxEqAbs(f32, cbrt32(123123.234375), 49.748501, epsilon)); } -test "math.cbrt64" { +test cbrt64 { const epsilon = 0.000001; try expect(math.isPositiveZero(cbrt64(0.0))); @@ -146,7 +146,7 @@ test "math.cbrt64" { try expect(math.approxEqAbs(f64, cbrt64(123123.234375), 49.748501, epsilon)); } -test "math.cbrt.special" { +test "cbrt.special" { try expect(math.isPositiveZero(cbrt32(0.0))); try expect(@as(u32, @bitCast(cbrt32(-0.0))) == @as(u32, 0x80000000)); try expect(math.isPositiveInf(cbrt32(math.inf(f32)))); @@ -154,7 +154,7 @@ test "math.cbrt.special" { try expect(math.isNan(cbrt32(math.nan(f32)))); } -test "math.cbrt64.special" { +test "cbrt64.special" { try expect(math.isPositiveZero(cbrt64(0.0))); try expect(math.isNegativeZero(cbrt64(-0.0))); try expect(math.isPositiveInf(cbrt64(math.inf(f64)))); diff --git a/lib/std/math/complex.zig b/lib/std/math/complex.zig index 8b9e8befab..8398d0a69a 100644 --- a/lib/std/math/complex.zig +++ b/lib/std/math/complex.zig @@ -120,7 +120,7 @@ pub fn Complex(comptime T: type) type { const epsilon = 0.0001; -test "complex.add" { +test "add" { const a = Complex(f32).init(5, 3); const b = Complex(f32).init(2, 7); const c = a.add(b); @@ -128,7 +128,7 @@ test "complex.add" { try testing.expect(c.re == 7 and c.im == 10); } -test "complex.sub" { +test "sub" { const a = Complex(f32).init(5, 3); const b = Complex(f32).init(2, 7); const c = a.sub(b); @@ -136,7 +136,7 @@ test "complex.sub" { try testing.expect(c.re == 3 and c.im == -4); } -test "complex.mul" { +test "mul" { const a = Complex(f32).init(5, 3); const b = Complex(f32).init(2, 7); const c = a.mul(b); @@ -144,7 +144,7 @@ test "complex.mul" { try testing.expect(c.re == -11 and c.im == 41); } -test "complex.div" { +test "div" { const a = Complex(f32).init(5, 3); const b = Complex(f32).init(2, 7); const c = a.div(b); @@ -153,28 +153,28 @@ test "complex.div" { math.approxEqAbs(f32, c.im, @as(f32, -29) / 53, epsilon)); } -test "complex.conjugate" { +test "conjugate" { const a = Complex(f32).init(5, 3); const c = a.conjugate(); try testing.expect(c.re == 5 and c.im == -3); } -test "complex.neg" { +test "neg" { const a = Complex(f32).init(5, 3); const c = a.neg(); try testing.expect(c.re == -5 and c.im == -3); } -test "complex.mulbyi" { +test "mulbyi" { const a = Complex(f32).init(5, 3); const c = a.mulbyi(); try testing.expect(c.re == -3 and c.im == 5); } -test "complex.reciprocal" { +test "reciprocal" { const a = Complex(f32).init(5, 3); const c = a.reciprocal(); @@ -182,7 +182,7 @@ test "complex.reciprocal" { math.approxEqAbs(f32, c.im, @as(f32, -3) / 34, epsilon)); } -test "complex.magnitude" { +test "magnitude" { const a = Complex(f32).init(5, 3); const c = a.magnitude(); diff --git a/lib/std/math/complex/abs.zig b/lib/std/math/complex/abs.zig index 97999ee775..ab85f2c36c 100644 --- a/lib/std/math/complex/abs.zig +++ b/lib/std/math/complex/abs.zig @@ -11,7 +11,7 @@ pub fn abs(z: anytype) @TypeOf(z.re, z.im) { const epsilon = 0.0001; -test "complex.cabs" { +test abs { const a = Complex(f32).init(5, 3); const c = abs(a); try testing.expect(math.approxEqAbs(f32, c, 5.83095, epsilon)); diff --git a/lib/std/math/complex/acos.zig b/lib/std/math/complex/acos.zig index e7f0f1f021..9cbfaffe4b 100644 --- a/lib/std/math/complex/acos.zig +++ b/lib/std/math/complex/acos.zig @@ -13,7 +13,7 @@ pub fn acos(z: anytype) Complex(@TypeOf(z.re, z.im)) { const epsilon = 0.0001; -test "complex.cacos" { +test acos { const a = Complex(f32).init(5, 3); const c = acos(a); diff --git a/lib/std/math/complex/acosh.zig b/lib/std/math/complex/acosh.zig index 4eab21914b..dba8b03794 100644 --- a/lib/std/math/complex/acosh.zig +++ b/lib/std/math/complex/acosh.zig @@ -13,7 +13,7 @@ pub fn acosh(z: anytype) Complex(@TypeOf(z.re, z.im)) { const epsilon = 0.0001; -test "complex.cacosh" { +test acosh { const a = Complex(f32).init(5, 3); const c = acosh(a); diff --git a/lib/std/math/complex/arg.zig b/lib/std/math/complex/arg.zig index bf5e0eff42..ac69276d96 100644 --- a/lib/std/math/complex/arg.zig +++ b/lib/std/math/complex/arg.zig @@ -11,7 +11,7 @@ pub fn arg(z: anytype) @TypeOf(z.re, z.im) { const epsilon = 0.0001; -test "complex.carg" { +test arg { const a = Complex(f32).init(5, 3); const c = arg(a); try testing.expect(math.approxEqAbs(f32, c, 0.540420, epsilon)); diff --git a/lib/std/math/complex/asin.zig b/lib/std/math/complex/asin.zig index aad337c6e2..deacfa26ea 100644 --- a/lib/std/math/complex/asin.zig +++ b/lib/std/math/complex/asin.zig @@ -19,7 +19,7 @@ pub fn asin(z: anytype) Complex(@TypeOf(z.re, z.im)) { const epsilon = 0.0001; -test "complex.casin" { +test asin { const a = Complex(f32).init(5, 3); const c = asin(a); diff --git a/lib/std/math/complex/asinh.zig b/lib/std/math/complex/asinh.zig index 67daabcf00..2dcfc9c2ac 100644 --- a/lib/std/math/complex/asinh.zig +++ b/lib/std/math/complex/asinh.zig @@ -14,7 +14,7 @@ pub fn asinh(z: anytype) Complex(@TypeOf(z.re, z.im)) { const epsilon = 0.0001; -test "complex.casinh" { +test asinh { const a = Complex(f32).init(5, 3); const c = asinh(a); diff --git a/lib/std/math/complex/atan.zig b/lib/std/math/complex/atan.zig index 5af14fb629..33109178f8 100644 --- a/lib/std/math/complex/atan.zig +++ b/lib/std/math/complex/atan.zig @@ -120,7 +120,7 @@ fn atan64(z: Complex(f64)) Complex(f64) { const epsilon = 0.0001; -test "complex.catan32" { +test atan32 { const a = Complex(f32).init(5, 3); const c = atan(a); @@ -128,7 +128,7 @@ test "complex.catan32" { try testing.expect(math.approxEqAbs(f32, c.im, 0.086569, epsilon)); } -test "complex.catan64" { +test atan64 { const a = Complex(f64).init(5, 3); const c = atan(a); diff --git a/lib/std/math/complex/atanh.zig b/lib/std/math/complex/atanh.zig index b9dcae6ac8..54d21fc433 100644 --- a/lib/std/math/complex/atanh.zig +++ b/lib/std/math/complex/atanh.zig @@ -14,7 +14,7 @@ pub fn atanh(z: anytype) Complex(@TypeOf(z.re, z.im)) { const epsilon = 0.0001; -test "complex.catanh" { +test atanh { const a = Complex(f32).init(5, 3); const c = atanh(a); diff --git a/lib/std/math/complex/conj.zig b/lib/std/math/complex/conj.zig index b470b5b442..b5a4d063d3 100644 --- a/lib/std/math/complex/conj.zig +++ b/lib/std/math/complex/conj.zig @@ -10,7 +10,7 @@ pub fn conj(z: anytype) Complex(@TypeOf(z.re, z.im)) { return Complex(T).init(z.re, -z.im); } -test "complex.conj" { +test conj { const a = Complex(f32).init(5, 3); const c = a.conjugate(); diff --git a/lib/std/math/complex/cos.zig b/lib/std/math/complex/cos.zig index 3b14ba47a3..389dd013e3 100644 --- a/lib/std/math/complex/cos.zig +++ b/lib/std/math/complex/cos.zig @@ -13,7 +13,7 @@ pub fn cos(z: anytype) Complex(@TypeOf(z.re, z.im)) { const epsilon = 0.0001; -test "complex.ccos" { +test cos { const a = Complex(f32).init(5, 3); const c = cos(a); diff --git a/lib/std/math/complex/cosh.zig b/lib/std/math/complex/cosh.zig index fe987a75e7..42f5b432ec 100644 --- a/lib/std/math/complex/cosh.zig +++ b/lib/std/math/complex/cosh.zig @@ -155,7 +155,7 @@ fn cosh64(z: Complex(f64)) Complex(f64) { const epsilon = 0.0001; -test "complex.ccosh32" { +test cosh32 { const a = Complex(f32).init(5, 3); const c = cosh(a); @@ -163,7 +163,7 @@ test "complex.ccosh32" { try testing.expect(math.approxEqAbs(f32, c.im, 10.471557, epsilon)); } -test "complex.ccosh64" { +test cosh64 { const a = Complex(f64).init(5, 3); const c = cosh(a); diff --git a/lib/std/math/complex/exp.zig b/lib/std/math/complex/exp.zig index 5b70e547ac..a3916300c4 100644 --- a/lib/std/math/complex/exp.zig +++ b/lib/std/math/complex/exp.zig @@ -119,7 +119,7 @@ fn exp64(z: Complex(f64)) Complex(f64) { } } -test "complex.cexp32" { +test exp32 { const tolerance_f32 = @sqrt(math.floatEps(f32)); { @@ -139,7 +139,7 @@ test "complex.cexp32" { } } -test "complex.cexp64" { +test exp64 { const tolerance_f64 = @sqrt(math.floatEps(f64)); { diff --git a/lib/std/math/complex/log.zig b/lib/std/math/complex/log.zig index c725888102..65859c2dce 100644 --- a/lib/std/math/complex/log.zig +++ b/lib/std/math/complex/log.zig @@ -15,7 +15,7 @@ pub fn log(z: anytype) Complex(@TypeOf(z.re, z.im)) { const epsilon = 0.0001; -test "complex.clog" { +test log { const a = Complex(f32).init(5, 3); const c = log(a); diff --git a/lib/std/math/complex/pow.zig b/lib/std/math/complex/pow.zig index af93c2f43c..874e4037dc 100644 --- a/lib/std/math/complex/pow.zig +++ b/lib/std/math/complex/pow.zig @@ -11,7 +11,7 @@ pub fn pow(z: anytype, s: anytype) Complex(@TypeOf(z.re, z.im, s.re, s.im)) { const epsilon = 0.0001; -test "complex.cpow" { +test pow { const a = Complex(f32).init(5, 3); const b = Complex(f32).init(2.3, -1.3); const c = pow(a, b); diff --git a/lib/std/math/complex/proj.zig b/lib/std/math/complex/proj.zig index 4c67c92fe9..b7d3d58b12 100644 --- a/lib/std/math/complex/proj.zig +++ b/lib/std/math/complex/proj.zig @@ -15,9 +15,7 @@ pub fn proj(z: anytype) Complex(@TypeOf(z.re, z.im)) { return Complex(T).init(z.re, z.im); } -const epsilon = 0.0001; - -test "complex.cproj" { +test proj { const a = Complex(f32).init(5, 3); const c = proj(a); diff --git a/lib/std/math/complex/sin.zig b/lib/std/math/complex/sin.zig index b966957456..3ca2419e43 100644 --- a/lib/std/math/complex/sin.zig +++ b/lib/std/math/complex/sin.zig @@ -14,7 +14,7 @@ pub fn sin(z: anytype) Complex(@TypeOf(z.re, z.im)) { const epsilon = 0.0001; -test "complex.csin" { +test sin { const a = Complex(f32).init(5, 3); const c = sin(a); diff --git a/lib/std/math/complex/sinh.zig b/lib/std/math/complex/sinh.zig index 5b3bf94a41..911587a9c5 100644 --- a/lib/std/math/complex/sinh.zig +++ b/lib/std/math/complex/sinh.zig @@ -154,7 +154,7 @@ fn sinh64(z: Complex(f64)) Complex(f64) { const epsilon = 0.0001; -test "complex.csinh32" { +test sinh32 { const a = Complex(f32).init(5, 3); const c = sinh(a); @@ -162,7 +162,7 @@ test "complex.csinh32" { try testing.expect(math.approxEqAbs(f32, c.im, 10.472508, epsilon)); } -test "complex.csinh64" { +test sinh64 { const a = Complex(f64).init(5, 3); const c = sinh(a); diff --git a/lib/std/math/complex/sqrt.zig b/lib/std/math/complex/sqrt.zig index 745940b955..0edf18fb23 100644 --- a/lib/std/math/complex/sqrt.zig +++ b/lib/std/math/complex/sqrt.zig @@ -129,7 +129,7 @@ fn sqrt64(z: Complex(f64)) Complex(f64) { const epsilon = 0.0001; -test "complex.csqrt32" { +test sqrt32 { const a = Complex(f32).init(5, 3); const c = sqrt(a); @@ -137,7 +137,7 @@ test "complex.csqrt32" { try testing.expect(math.approxEqAbs(f32, c.im, 0.644574, epsilon)); } -test "complex.csqrt64" { +test sqrt64 { const a = Complex(f64).init(5, 3); const c = sqrt(a); diff --git a/lib/std/math/complex/tan.zig b/lib/std/math/complex/tan.zig index 4e22ab9eb0..ad5b1b47b6 100644 --- a/lib/std/math/complex/tan.zig +++ b/lib/std/math/complex/tan.zig @@ -14,7 +14,7 @@ pub fn tan(z: anytype) Complex(@TypeOf(z.re, z.im)) { const epsilon = 0.0001; -test "complex.ctan" { +test tan { const a = Complex(f32).init(5, 3); const c = tan(a); diff --git a/lib/std/math/complex/tanh.zig b/lib/std/math/complex/tanh.zig index 02ba0bf91c..8a1d46eca7 100644 --- a/lib/std/math/complex/tanh.zig +++ b/lib/std/math/complex/tanh.zig @@ -103,7 +103,7 @@ fn tanh64(z: Complex(f64)) Complex(f64) { const epsilon = 0.0001; -test "complex.ctanh32" { +test tanh32 { const a = Complex(f32).init(5, 3); const c = tanh(a); @@ -111,7 +111,7 @@ test "complex.ctanh32" { try testing.expect(math.approxEqAbs(f32, c.im, -0.000025, epsilon)); } -test "complex.ctanh64" { +test tanh64 { const a = Complex(f64).init(5, 3); const c = tanh(a); diff --git a/lib/std/math/copysign.zig b/lib/std/math/copysign.zig index 3cefc0471f..63daf59047 100644 --- a/lib/std/math/copysign.zig +++ b/lib/std/math/copysign.zig @@ -12,7 +12,7 @@ pub fn copysign(magnitude: anytype, sign: @TypeOf(magnitude)) @TypeOf(magnitude) return @as(T, @bitCast(mag | sgn)); } -test "math.copysign" { +test copysign { inline for ([_]type{ f16, f32, f64, f80, f128 }) |T| { try expect(copysign(@as(T, 1.0), @as(T, 1.0)) == 1.0); try expect(copysign(@as(T, 2.0), @as(T, -2.0)) == -2.0); diff --git a/lib/std/math/cosh.zig b/lib/std/math/cosh.zig index 085d6fd2f9..950448bb74 100644 --- a/lib/std/math/cosh.zig +++ b/lib/std/math/cosh.zig @@ -86,12 +86,12 @@ fn cosh64(x: f64) f64 { return expo2(ax); } -test "math.cosh" { +test cosh { try expect(cosh(@as(f32, 1.5)) == cosh32(1.5)); try expect(cosh(@as(f64, 1.5)) == cosh64(1.5)); } -test "math.cosh32" { +test cosh32 { const epsilon = 0.000001; try expect(math.approxEqAbs(f32, cosh32(0.0), 1.0, epsilon)); @@ -104,7 +104,7 @@ test "math.cosh32" { try expect(math.approxEqAbs(f32, cosh32(-1.5), 2.352410, epsilon)); } -test "math.cosh64" { +test cosh64 { const epsilon = 0.000001; try expect(math.approxEqAbs(f64, cosh64(0.0), 1.0, epsilon)); @@ -117,7 +117,7 @@ test "math.cosh64" { try expect(math.approxEqAbs(f64, cosh64(-1.5), 2.352410, epsilon)); } -test "math.cosh32.special" { +test "cosh32.special" { try expect(cosh32(0.0) == 1.0); try expect(cosh32(-0.0) == 1.0); try expect(math.isPositiveInf(cosh32(math.inf(f32)))); @@ -125,7 +125,7 @@ test "math.cosh32.special" { try expect(math.isNan(cosh32(math.nan(f32)))); } -test "math.cosh64.special" { +test "cosh64.special" { try expect(cosh64(0.0) == 1.0); try expect(cosh64(-0.0) == 1.0); try expect(math.isPositiveInf(cosh64(math.inf(f64)))); diff --git a/lib/std/math/expm1.zig b/lib/std/math/expm1.zig index e9ba023b92..c64a123631 100644 --- a/lib/std/math/expm1.zig +++ b/lib/std/math/expm1.zig @@ -286,12 +286,12 @@ fn expm1_64(x_: f64) f64 { } } -test "math.exp1m" { +test expm1 { try expect(expm1(@as(f32, 0.0)) == expm1_32(0.0)); try expect(expm1(@as(f64, 0.0)) == expm1_64(0.0)); } -test "math.expm1_32" { +test expm1_32 { const epsilon = 0.000001; try expect(math.isPositiveZero(expm1_32(0.0))); @@ -301,7 +301,7 @@ test "math.expm1_32" { try expect(math.approxEqAbs(f32, expm1_32(1.5), 3.481689, epsilon)); } -test "math.expm1_64" { +test expm1_64 { const epsilon = 0.000001; try expect(math.isPositiveZero(expm1_64(0.0))); @@ -311,13 +311,13 @@ test "math.expm1_64" { try expect(math.approxEqAbs(f64, expm1_64(1.5), 3.481689, epsilon)); } -test "math.expm1_32.special" { +test "expm1_32.special" { try expect(math.isPositiveInf(expm1_32(math.inf(f32)))); try expect(expm1_32(-math.inf(f32)) == -1.0); try expect(math.isNan(expm1_32(math.nan(f32)))); } -test "math.expm1_64.special" { +test "expm1_64.special" { try expect(math.isPositiveInf(expm1_64(math.inf(f64)))); try expect(expm1_64(-math.inf(f64)) == -1.0); try expect(math.isNan(expm1_64(math.nan(f64)))); diff --git a/lib/std/math/float.zig b/lib/std/math/float.zig index fdebdf16a1..f8f04e217c 100644 --- a/lib/std/math/float.zig +++ b/lib/std/math/float.zig @@ -132,7 +132,7 @@ test "float bits" { } } -test "math.inf" { +test inf { const inf_u16: u16 = 0x7C00; const inf_u32: u32 = 0x7F800000; const inf_u64: u64 = 0x7FF0000000000000; @@ -145,7 +145,7 @@ test "math.inf" { try expectEqual(inf_u128, @as(u128, @bitCast(inf(f128)))); } -test "math.nan" { +test nan { const qnan_u16: u16 = 0x7E00; const qnan_u32: u32 = 0x7FC00000; const qnan_u64: u64 = 0x7FF8000000000000; @@ -158,7 +158,7 @@ test "math.nan" { try expectEqual(qnan_u128, @as(u128, @bitCast(nan(f128)))); } -test "math.snan" { +test snan { // TODO: https://github.com/ziglang/zig/issues/14366 if (builtin.zig_backend == .stage2_llvm and comptime builtin.cpu.arch.isArmOrThumb()) return error.SkipZigTest; diff --git a/lib/std/math/gamma.zig b/lib/std/math/gamma.zig index 7a2d1f12ea..ce37db4962 100644 --- a/lib/std/math/gamma.zig +++ b/lib/std/math/gamma.zig @@ -240,7 +240,7 @@ const expect = std.testing.expect; const expectEqual = std.testing.expectEqual; const expectApproxEqRel = std.testing.expectApproxEqRel; -test "math.gamma" { +test gamma { inline for (&.{ f32, f64 }) |T| { const eps = @sqrt(std.math.floatEps(T)); try expectApproxEqRel(@as(T, 120), gamma(T, 6), eps); @@ -261,7 +261,7 @@ test "math.gamma" { } } -test "math.gamma.special" { +test "gamma.special" { inline for (&.{ f32, f64 }) |T| { try expect(std.math.isNan(gamma(T, -std.math.nan(T)))); try expect(std.math.isNan(gamma(T, std.math.nan(T)))); @@ -286,7 +286,7 @@ test "math.gamma.special" { } } -test "math.lgamma" { +test lgamma { inline for (&.{ f32, f64 }) |T| { const eps = @sqrt(std.math.floatEps(T)); try expectApproxEqRel(@as(T, @log(24.0)), lgamma(T, 5), eps); @@ -307,7 +307,7 @@ test "math.lgamma" { } } -test "math.lgamma.special" { +test "lgamma.special" { inline for (&.{ f32, f64 }) |T| { try expect(std.math.isNan(lgamma(T, -std.math.nan(T)))); try expect(std.math.isNan(lgamma(T, std.math.nan(T)))); diff --git a/lib/std/math/hypot.zig b/lib/std/math/hypot.zig index fc5b0ddca8..c0bfabca1c 100644 --- a/lib/std/math/hypot.zig +++ b/lib/std/math/hypot.zig @@ -124,7 +124,7 @@ fn hypot64(x: f64, y: f64) f64 { return z * @sqrt(ly + lx + hy + hx); } -test "math.hypot" { +test hypot { const x32: f32 = 0.0; const y32: f32 = -1.2; const x64: f64 = 0.0; @@ -133,7 +133,7 @@ test "math.hypot" { try expect(hypot(x64, y64) == hypot64(0.0, -1.2)); } -test "math.hypot32" { +test hypot32 { const epsilon = 0.000001; try expect(math.approxEqAbs(f32, hypot32(0.0, -1.2), 1.2, epsilon)); @@ -145,7 +145,7 @@ test "math.hypot32" { try expect(math.approxEqAbs(f32, hypot32(123123.234375, 529428.707813), 543556.875, epsilon)); } -test "math.hypot64" { +test hypot64 { const epsilon = 0.000001; try expect(math.approxEqAbs(f64, hypot64(0.0, -1.2), 1.2, epsilon)); @@ -157,7 +157,7 @@ test "math.hypot64" { try expect(math.approxEqAbs(f64, hypot64(123123.234375, 529428.707813), 543556.885247, epsilon)); } -test "math.hypot32.special" { +test "hypot32.special" { try expect(math.isPositiveInf(hypot32(math.inf(f32), 0.0))); try expect(math.isPositiveInf(hypot32(-math.inf(f32), 0.0))); try expect(math.isPositiveInf(hypot32(0.0, math.inf(f32)))); @@ -166,7 +166,7 @@ test "math.hypot32.special" { try expect(math.isNan(hypot32(0.0, math.nan(f32)))); } -test "math.hypot64.special" { +test "hypot64.special" { try expect(math.isPositiveInf(hypot64(math.inf(f64), 0.0))); try expect(math.isPositiveInf(hypot64(-math.inf(f64), 0.0))); try expect(math.isPositiveInf(hypot64(0.0, math.inf(f64)))); diff --git a/lib/std/math/isfinite.zig b/lib/std/math/isfinite.zig index 36c6cdd062..5d5bfd2a41 100644 --- a/lib/std/math/isfinite.zig +++ b/lib/std/math/isfinite.zig @@ -10,7 +10,7 @@ pub fn isFinite(x: anytype) bool { return @as(TBits, @bitCast(x)) & remove_sign < @as(TBits, @bitCast(math.inf(T))); } -test "math.isFinite" { +test isFinite { inline for ([_]type{ f16, f32, f64, f80, f128 }) |T| { // normals try expect(isFinite(@as(T, 1.0))); diff --git a/lib/std/math/isinf.zig b/lib/std/math/isinf.zig index 9b3a0a8f4a..7a2e3943d6 100644 --- a/lib/std/math/isinf.zig +++ b/lib/std/math/isinf.zig @@ -20,7 +20,7 @@ pub inline fn isNegativeInf(x: anytype) bool { return x == -math.inf(@TypeOf(x)); } -test "math.isInf" { +test isInf { inline for ([_]type{ f16, f32, f64, f80, f128 }) |T| { try expect(!isInf(@as(T, 0.0))); try expect(!isInf(@as(T, -0.0))); @@ -31,7 +31,7 @@ test "math.isInf" { } } -test "math.isPositiveInf" { +test isPositiveInf { inline for ([_]type{ f16, f32, f64, f80, f128 }) |T| { try expect(!isPositiveInf(@as(T, 0.0))); try expect(!isPositiveInf(@as(T, -0.0))); @@ -42,7 +42,7 @@ test "math.isPositiveInf" { } } -test "math.isNegativeInf" { +test isNegativeInf { inline for ([_]type{ f16, f32, f64, f80, f128 }) |T| { try expect(!isNegativeInf(@as(T, 0.0))); try expect(!isNegativeInf(@as(T, -0.0))); diff --git a/lib/std/math/isnan.zig b/lib/std/math/isnan.zig index d4666f38a5..cb929e5890 100644 --- a/lib/std/math/isnan.zig +++ b/lib/std/math/isnan.zig @@ -17,7 +17,7 @@ pub fn isSignalNan(x: anytype) bool { return isNan(x) and (@as(U, @bitCast(x)) & quiet_signal_bit_mask == 0); } -test "math.isNan" { +test isNan { inline for ([_]type{ f16, f32, f64, f80, f128, c_longdouble }) |T| { try expect(isNan(math.nan(T))); try expect(isNan(-math.nan(T))); @@ -27,7 +27,7 @@ test "math.isNan" { } } -test "math.isSignalNan" { +test isSignalNan { inline for ([_]type{ f16, f32, f64, f80, f128, c_longdouble }) |T| { // TODO: Signalling NaN values get converted to quiet NaN values in // some cases where they shouldn't such that this can fail. diff --git a/lib/std/math/isnormal.zig b/lib/std/math/isnormal.zig index 38b459b54e..1ecaf39330 100644 --- a/lib/std/math/isnormal.zig +++ b/lib/std/math/isnormal.zig @@ -19,7 +19,7 @@ pub fn isNormal(x: anytype) bool { return value & remove_sign >= (increment_exp << 1); } -test "math.isNormal" { +test isNormal { // TODO add `c_longdouble' when math.inf(T) supports it inline for ([_]type{ f16, f32, f64, f80, f128 }) |T| { const TBits = std.meta.Int(.unsigned, @bitSizeOf(T)); diff --git a/lib/std/math/ldexp.zig b/lib/std/math/ldexp.zig index 85b0f42e57..c785f719f0 100644 --- a/lib/std/math/ldexp.zig +++ b/lib/std/math/ldexp.zig @@ -66,7 +66,7 @@ pub fn ldexp(x: anytype, n: i32) @TypeOf(x) { } } -test "math.ldexp" { +test ldexp { // subnormals try expect(ldexp(@as(f16, 0x1.1FFp14), -14 - 9 - 15) == math.floatTrueMin(f16)); try expect(ldexp(@as(f32, 0x1.3FFFFFp-1), -126 - 22) == math.floatTrueMin(f32)); diff --git a/lib/std/math/log.zig b/lib/std/math/log.zig index 3063869f35..3ff13a7f19 100644 --- a/lib/std/math/log.zig +++ b/lib/std/math/log.zig @@ -47,7 +47,7 @@ pub fn log(comptime T: type, base: T, x: T) T { } } -test "math.log integer" { +test "log integer" { try expect(log(u8, 2, 0x1) == 0); try expect(log(u8, 2, 0x2) == 1); try expect(log(u16, 2, 0x72) == 6); @@ -55,7 +55,7 @@ test "math.log integer" { try expect(log(u64, 2, 0x7FF0123456789ABC) == 62); } -test "math.log float" { +test "log float" { const epsilon = 0.000001; try expect(math.approxEqAbs(f32, log(f32, 6, 0.23947), -0.797723, epsilon)); @@ -63,7 +63,7 @@ test "math.log float" { try expect(math.approxEqAbs(f64, log(f64, 123897, 12389216414), 1.981724596, epsilon)); } -test "math.log float_special" { +test "log float_special" { try expect(log(f32, 2, 0.2301974) == math.log2(@as(f32, 0.2301974))); try expect(log(f32, 10, 0.2301974) == math.log10(@as(f32, 0.2301974))); diff --git a/lib/std/math/log1p.zig b/lib/std/math/log1p.zig index 0cd34e30bb..2d7507bc88 100644 --- a/lib/std/math/log1p.zig +++ b/lib/std/math/log1p.zig @@ -182,12 +182,12 @@ fn log1p_64(x: f64) f64 { return s * (hfsq + R) + (dk * ln2_lo + c) - hfsq + f + dk * ln2_hi; } -test "math.log1p" { +test log1p { try expect(log1p(@as(f32, 0.0)) == log1p_32(0.0)); try expect(log1p(@as(f64, 0.0)) == log1p_64(0.0)); } -test "math.log1p_32" { +test log1p_32 { const epsilon = 0.000001; try expect(math.approxEqAbs(f32, log1p_32(0.0), 0.0, epsilon)); @@ -199,7 +199,7 @@ test "math.log1p_32" { try expect(math.approxEqAbs(f32, log1p_32(123123.234375), 11.720949, epsilon)); } -test "math.log1p_64" { +test log1p_64 { const epsilon = 0.000001; try expect(math.approxEqAbs(f64, log1p_64(0.0), 0.0, epsilon)); @@ -211,7 +211,7 @@ test "math.log1p_64" { try expect(math.approxEqAbs(f64, log1p_64(123123.234375), 11.720949, epsilon)); } -test "math.log1p_32.special" { +test "log1p_32.special" { try expect(math.isPositiveInf(log1p_32(math.inf(f32)))); try expect(math.isPositiveZero(log1p_32(0.0))); try expect(math.isNegativeZero(log1p_32(-0.0))); @@ -220,7 +220,7 @@ test "math.log1p_32.special" { try expect(math.isNan(log1p_32(math.nan(f32)))); } -test "math.log1p_64.special" { +test "log1p_64.special" { try expect(math.isPositiveInf(log1p_64(math.inf(f64)))); try expect(math.isPositiveZero(log1p_64(0.0))); try expect(math.isNegativeZero(log1p_64(-0.0))); diff --git a/lib/std/math/log2.zig b/lib/std/math/log2.zig index 65fd9c296b..0902f3e10c 100644 --- a/lib/std/math/log2.zig +++ b/lib/std/math/log2.zig @@ -42,7 +42,7 @@ pub fn log2(x: anytype) @TypeOf(x) { } } -test "log2" { +test log2 { // https://github.com/ziglang/zig/issues/13703 if (builtin.cpu.arch == .aarch64 and builtin.os.tag == .windows) return error.SkipZigTest; diff --git a/lib/std/math/log_int.zig b/lib/std/math/log_int.zig index ea1820bd27..edf5c31782 100644 --- a/lib/std/math/log_int.zig +++ b/lib/std/math/log_int.zig @@ -60,7 +60,7 @@ pub fn log_int(comptime T: type, base: T, x: T) Log2Int(T) { return exponent; } -test "math.log_int" { +test "log_int" { // Test all unsigned integers with 2, 3, ..., 64 bits. // We cannot test 0 or 1 bits since base must be > 1. inline for (2..64 + 1) |bits| { @@ -92,7 +92,7 @@ test "math.log_int" { } } -test "math.log_int vs math.log2" { +test "log_int vs math.log2" { const types = [_]type{ u2, u3, u4, u8, u16 }; inline for (types) |T| { var n: T = 0; @@ -105,7 +105,7 @@ test "math.log_int vs math.log2" { } } -test "math.log_int vs math.log10" { +test "log_int vs math.log10" { const types = [_]type{ u4, u5, u6, u8, u16 }; inline for (types) |T| { var n: T = 0; @@ -118,7 +118,7 @@ test "math.log_int vs math.log10" { } } -test "math.log_int at comptime" { +test "log_int at comptime" { const x = 59049; // 9 ** 5; comptime { if (math.log_int(comptime_int, 9, x) != 5) { diff --git a/lib/std/math/modf.zig b/lib/std/math/modf.zig index 5a77ea7dd8..03b8111873 100644 --- a/lib/std/math/modf.zig +++ b/lib/std/math/modf.zig @@ -123,14 +123,14 @@ fn modf64(x: f64) modf64_result { return result; } -test "math.modf" { +test modf { const a = modf(@as(f32, 1.0)); const b = modf32(1.0); // NOTE: No struct comparison on generic return type function? non-named, makes sense, but still. try expectEqual(a, b); } -test "math.modf32" { +test modf32 { const epsilon = 0.000001; var r: modf32_result = undefined; @@ -155,7 +155,7 @@ test "math.modf32" { try expect(math.approxEqAbs(f32, r.fpart, 0.340820, epsilon)); } -test "math.modf64" { +test modf64 { const epsilon = 0.000001; var r: modf64_result = undefined; @@ -180,7 +180,7 @@ test "math.modf64" { try expect(math.approxEqAbs(f64, r.fpart, 0.340780, epsilon)); } -test "math.modf32.special" { +test "modf32.special" { var r: modf32_result = undefined; r = modf32(math.inf(f32)); @@ -193,7 +193,7 @@ test "math.modf32.special" { try expect(math.isNan(r.ipart) and math.isNan(r.fpart)); } -test "math.modf64.special" { +test "modf64.special" { var r: modf64_result = undefined; r = modf64(math.inf(f64)); diff --git a/lib/std/math/nextafter.zig b/lib/std/math/nextafter.zig index 7d2396ed26..6780d6089f 100644 --- a/lib/std/math/nextafter.zig +++ b/lib/std/math/nextafter.zig @@ -101,7 +101,7 @@ fn nextAfterFloat(comptime T: type, x: T, y: T) T { } } -test "math.nextAfter.int" { +test "int" { try expect(nextAfter(i0, 0, 0) == 0); try expect(nextAfter(u0, 0, 0) == 0); try expect(nextAfter(i1, 0, 0) == 0); @@ -143,7 +143,7 @@ test "math.nextAfter.int" { } } -test "math.nextAfter.float" { +test "float" { @setEvalBranchQuota(2000); // normal -> normal diff --git a/lib/std/math/pow.zig b/lib/std/math/pow.zig index a69fccc907..2e50cc16dd 100644 --- a/lib/std/math/pow.zig +++ b/lib/std/math/pow.zig @@ -190,7 +190,7 @@ fn isOddInteger(x: f64) bool { return r.fpart == 0.0 and @as(i64, @intFromFloat(r.ipart)) & 1 == 1; } -test "math.pow.isOddInteger" { +test isOddInteger { try expect(isOddInteger(math.maxInt(i64) * 2) == false); try expect(isOddInteger(math.maxInt(i64) * 2 + 1) == false); try expect(isOddInteger(1 << 53) == false); @@ -198,7 +198,7 @@ test "math.pow.isOddInteger" { try expect(isOddInteger(15.0) == true); } -test "math.pow" { +test pow { const epsilon = 0.000001; try expect(math.approxEqAbs(f32, pow(f32, 0.0, 3.3), 0.0, epsilon)); @@ -216,7 +216,7 @@ test "math.pow" { try expect(math.approxEqAbs(f64, pow(f64, 89.123, 3.3), 2722490.231436, epsilon)); } -test "math.pow.special" { +test "special" { const epsilon = 0.000001; try expect(pow(f32, 4, 0.0) == 1.0); @@ -258,7 +258,7 @@ test "math.pow.special" { try expect(math.isNan(pow(f32, -12.4, 78.5))); } -test "math.pow.overflow" { +test "overflow" { try expect(math.isPositiveInf(pow(f64, 2, 1 << 32))); try expect(pow(f64, 2, -(1 << 32)) == 0); try expect(math.isNegativeInf(pow(f64, -2, (1 << 32) + 1))); diff --git a/lib/std/math/powi.zig b/lib/std/math/powi.zig index d7d07985eb..271d24352a 100644 --- a/lib/std/math/powi.zig +++ b/lib/std/math/powi.zig @@ -91,7 +91,7 @@ pub fn powi(comptime T: type, x: T, y: T) (error{ return acc; } -test "math.powi" { +test powi { try testing.expectError(error.Overflow, powi(i8, -66, 6)); try testing.expectError(error.Overflow, powi(i16, -13, 13)); try testing.expectError(error.Overflow, powi(i32, -32, 21)); @@ -141,7 +141,7 @@ test "math.powi" { try testing.expectError(error.Underflow, powi(i42, 34, -6)); } -test "math.powi.special" { +test "powi.special" { try testing.expectError(error.Overflow, powi(i8, -2, 8)); try testing.expectError(error.Overflow, powi(i16, -2, 16)); try testing.expectError(error.Overflow, powi(i32, -2, 32)); @@ -186,7 +186,7 @@ test "math.powi.special" { try testing.expect((try powi(u42, 34, 0)) == 1); } -test "math.powi.narrow" { +test "powi.narrow" { try testing.expectError(error.Overflow, powi(u0, 0, 0)); try testing.expectError(error.Overflow, powi(i0, 0, 0)); try testing.expectError(error.Overflow, powi(i1, 0, 0)); diff --git a/lib/std/math/scalbn.zig b/lib/std/math/scalbn.zig index 2c8c3733fa..d754ffebda 100644 --- a/lib/std/math/scalbn.zig +++ b/lib/std/math/scalbn.zig @@ -6,7 +6,7 @@ const expect = std.testing.expect; /// Zig only supports binary base IEEE-754 floats. Hence FLT_RADIX=2, and this is an alias for ldexp. pub const scalbn = @import("ldexp.zig").ldexp; -test "math.scalbn" { +test scalbn { // Verify we are using base 2. try expect(scalbn(@as(f16, 1.5), 4) == 24.0); try expect(scalbn(@as(f32, 1.5), 4) == 24.0); diff --git a/lib/std/math/signbit.zig b/lib/std/math/signbit.zig index df061568b1..eeb729ceb7 100644 --- a/lib/std/math/signbit.zig +++ b/lib/std/math/signbit.zig @@ -9,7 +9,7 @@ pub fn signbit(x: anytype) bool { return @as(TBits, @bitCast(x)) >> (@bitSizeOf(T) - 1) != 0; } -test "math.signbit" { +test signbit { inline for ([_]type{ f16, f32, f64, f80, f128 }) |T| { try expect(!signbit(@as(T, 0.0))); try expect(!signbit(@as(T, 1.0))); diff --git a/lib/std/math/sinh.zig b/lib/std/math/sinh.zig index c3bd6e1b43..5652603d1a 100644 --- a/lib/std/math/sinh.zig +++ b/lib/std/math/sinh.zig @@ -91,12 +91,12 @@ fn sinh64(x: f64) f64 { return 2 * h * expo2(ax); } -test "math.sinh" { +test sinh { try expect(sinh(@as(f32, 1.5)) == sinh32(1.5)); try expect(sinh(@as(f64, 1.5)) == sinh64(1.5)); } -test "math.sinh32" { +test sinh32 { const epsilon = 0.000001; try expect(math.approxEqAbs(f32, sinh32(0.0), 0.0, epsilon)); @@ -109,7 +109,7 @@ test "math.sinh32" { try expect(math.approxEqAbs(f32, sinh32(-1.5), -2.129279, epsilon)); } -test "math.sinh64" { +test sinh64 { const epsilon = 0.000001; try expect(math.approxEqAbs(f64, sinh64(0.0), 0.0, epsilon)); @@ -122,7 +122,7 @@ test "math.sinh64" { try expect(math.approxEqAbs(f64, sinh64(-1.5), -2.129279, epsilon)); } -test "math.sinh32.special" { +test "sinh32.special" { try expect(math.isPositiveZero(sinh32(0.0))); try expect(math.isNegativeZero(sinh32(-0.0))); try expect(math.isPositiveInf(sinh32(math.inf(f32)))); @@ -130,7 +130,7 @@ test "math.sinh32.special" { try expect(math.isNan(sinh32(math.nan(f32)))); } -test "math.sinh64.special" { +test "sinh64.special" { try expect(math.isPositiveZero(sinh64(0.0))); try expect(math.isNegativeZero(sinh64(-0.0))); try expect(math.isPositiveInf(sinh64(math.inf(f64)))); diff --git a/lib/std/math/sqrt.zig b/lib/std/math/sqrt.zig index b4a9ee3838..a000911897 100644 --- a/lib/std/math/sqrt.zig +++ b/lib/std/math/sqrt.zig @@ -61,7 +61,7 @@ fn sqrt_int(comptime T: type, value: T) Sqrt(T) { } } -test "math.sqrt_int" { +test sqrt_int { try expect(sqrt_int(u32, 3) == 1); try expect(sqrt_int(u32, 4) == 2); try expect(sqrt_int(u32, 5) == 2); diff --git a/lib/std/math/tanh.zig b/lib/std/math/tanh.zig index f9d023ae41..dfe70f4b7a 100644 --- a/lib/std/math/tanh.zig +++ b/lib/std/math/tanh.zig @@ -104,12 +104,12 @@ fn tanh64(x: f64) f64 { return if (sign) -t else t; } -test "math.tanh" { +test tanh { try expect(tanh(@as(f32, 1.5)) == tanh32(1.5)); try expect(tanh(@as(f64, 1.5)) == tanh64(1.5)); } -test "math.tanh32" { +test tanh32 { const epsilon = 0.000001; try expect(math.approxEqAbs(f32, tanh32(0.0), 0.0, epsilon)); @@ -122,7 +122,7 @@ test "math.tanh32" { try expect(math.approxEqAbs(f32, tanh32(-37.45), -1.0, epsilon)); } -test "math.tanh64" { +test tanh64 { const epsilon = 0.000001; try expect(math.approxEqAbs(f64, tanh64(0.0), 0.0, epsilon)); @@ -135,7 +135,7 @@ test "math.tanh64" { try expect(math.approxEqAbs(f64, tanh64(-37.45), -1.0, epsilon)); } -test "math.tanh32.special" { +test "tanh32.special" { try expect(math.isPositiveZero(tanh32(0.0))); try expect(math.isNegativeZero(tanh32(-0.0))); try expect(tanh32(math.inf(f32)) == 1.0); @@ -143,7 +143,7 @@ test "math.tanh32.special" { try expect(math.isNan(tanh32(math.nan(f32)))); } -test "math.tanh64.special" { +test "tanh64.special" { try expect(math.isPositiveZero(tanh64(0.0))); try expect(math.isNegativeZero(tanh64(-0.0))); try expect(tanh64(math.inf(f64)) == 1.0); |
