From 16b3d1004ee520341839305826fe065eb5d8c818 Mon Sep 17 00:00:00 2001 From: Ryan Liptak Date: Sun, 25 Feb 2024 23:31:53 -0800 Subject: [PATCH] Remove redundant test name prefixes now that test names are fully qualified Follow up to #19079, which made test names fully qualified. This fixes tests that now-redundant information in their test names. For example here's a fully qualified test name before the changes in this commit: "priority_queue.test.std.PriorityQueue: shrinkAndFree" and the same test's name after the changes in this commit: "priority_queue.test.shrinkAndFree" --- lib/std/Random/Isaac64.zig | 4 +- lib/std/Random/Pcg.zig | 4 +- lib/std/Random/RomuTrio.zig | 6 +- lib/std/Random/Sfc64.zig | 4 +- lib/std/Random/Xoroshiro128.zig | 4 +- lib/std/Random/Xoshiro256.zig | 4 +- lib/std/SemanticVersion.zig | 4 +- lib/std/Thread.zig | 4 +- lib/std/Thread/Condition.zig | 12 +- lib/std/Thread/Futex.zig | 8 +- lib/std/Thread/Mutex.zig | 6 +- lib/std/Thread/ResetEvent.zig | 6 +- lib/std/Thread/RwLock.zig | 4 +- lib/std/Thread/Semaphore.zig | 4 +- lib/std/array_list.zig | 111 +++--- lib/std/buf_set.zig | 6 +- lib/std/compress/flate.zig | 10 +- lib/std/compress/flate/CircularBuffer.zig | 12 +- lib/std/compress/flate/Lookup.zig | 4 +- lib/std/compress/flate/SlidingWindow.zig | 4 +- lib/std/compress/flate/Token.zig | 8 +- lib/std/compress/flate/bit_reader.zig | 10 +- lib/std/compress/flate/block_writer.zig | 6 +- lib/std/compress/flate/huffman_decoder.zig | 16 +- lib/std/compress/flate/huffman_encoder.zig | 10 +- lib/std/compress/flate/inflate.zig | 10 +- lib/std/compress/lzma/test.zig | 16 +- lib/std/compress/lzma/vec2d.zig | 14 +- lib/std/compress/zstandard.zig | 4 +- lib/std/comptime_string_map.zig | 18 +- lib/std/crypto/25519/curve25519.zig | 2 +- lib/std/crypto/25519/ed25519.zig | 14 +- lib/std/crypto/25519/edwards25519.zig | 10 +- lib/std/crypto/25519/x25519.zig | 12 +- lib/std/crypto/chacha20.zig | 16 +- lib/std/crypto/ecdsa.zig | 12 +- lib/std/crypto/hmac.zig | 6 +- lib/std/crypto/md5.zig | 6 +- lib/std/crypto/poly1305.zig | 4 +- lib/std/crypto/utils.zig | 10 +- lib/std/enums.zig | 24 +- lib/std/fmt/parse_float.zig | 20 +- lib/std/hash_map.zig | 46 +-- lib/std/heap/arena_allocator.zig | 4 +- lib/std/heap/memory_pool.zig | 12 +- lib/std/io/Reader/test.zig | 66 ++-- lib/std/io/buffered_reader.zig | 4 +- lib/std/io/buffered_tee.zig | 10 +- lib/std/io/counting_reader.zig | 2 +- lib/std/io/counting_writer.zig | 2 +- lib/std/io/fixed_buffer_stream.zig | 8 +- lib/std/io/stream_source.zig | 6 +- lib/std/json/scanner_test.zig | 8 +- lib/std/math.zig | 2 +- lib/std/math/acos.zig | 10 +- lib/std/math/acosh.zig | 10 +- lib/std/math/asin.zig | 10 +- lib/std/math/asinh.zig | 10 +- lib/std/math/atan.zig | 10 +- lib/std/math/atan2.zig | 10 +- lib/std/math/atanh.zig | 10 +- lib/std/math/big/int_test.zig | 390 ++++++++++----------- lib/std/math/big/rational.zig | 34 +- lib/std/math/cbrt.zig | 10 +- lib/std/math/complex.zig | 18 +- lib/std/math/complex/abs.zig | 2 +- lib/std/math/complex/acos.zig | 2 +- lib/std/math/complex/acosh.zig | 2 +- lib/std/math/complex/arg.zig | 2 +- lib/std/math/complex/asin.zig | 2 +- lib/std/math/complex/asinh.zig | 2 +- lib/std/math/complex/atan.zig | 4 +- lib/std/math/complex/atanh.zig | 2 +- lib/std/math/complex/conj.zig | 2 +- lib/std/math/complex/cos.zig | 2 +- lib/std/math/complex/cosh.zig | 4 +- lib/std/math/complex/exp.zig | 4 +- lib/std/math/complex/log.zig | 2 +- lib/std/math/complex/pow.zig | 2 +- lib/std/math/complex/proj.zig | 2 +- lib/std/math/complex/sin.zig | 2 +- lib/std/math/complex/sinh.zig | 4 +- lib/std/math/complex/sqrt.zig | 4 +- lib/std/math/complex/tan.zig | 2 +- lib/std/math/complex/tanh.zig | 4 +- lib/std/math/copysign.zig | 2 +- lib/std/math/cosh.zig | 10 +- lib/std/math/expm1.zig | 10 +- lib/std/math/float.zig | 6 +- lib/std/math/gamma.zig | 8 +- lib/std/math/hypot.zig | 10 +- lib/std/math/isfinite.zig | 2 +- lib/std/math/isinf.zig | 6 +- lib/std/math/isnan.zig | 4 +- lib/std/math/isnormal.zig | 2 +- lib/std/math/ldexp.zig | 2 +- lib/std/math/log.zig | 6 +- lib/std/math/log1p.zig | 10 +- lib/std/math/log_int.zig | 8 +- lib/std/math/modf.zig | 10 +- lib/std/math/nextafter.zig | 4 +- lib/std/math/pow.zig | 8 +- lib/std/math/powi.zig | 6 +- lib/std/math/scalbn.zig | 2 +- lib/std/math/signbit.zig | 2 +- lib/std/math/sinh.zig | 10 +- lib/std/math/sqrt.zig | 2 +- lib/std/math/tanh.zig | 10 +- lib/std/meta.zig | 38 +- lib/std/os/test.zig | 2 +- lib/std/priority_dequeue.zig | 62 ++-- lib/std/priority_queue.zig | 46 +-- lib/std/segmented_list.zig | 4 +- lib/std/treap.zig | 2 +- lib/std/wasm.zig | 4 +- 115 files changed, 757 insertions(+), 754 deletions(-) diff --git a/lib/std/Random/Isaac64.zig b/lib/std/Random/Isaac64.zig index a3dceabd5c..cbf9df8803 100644 --- a/lib/std/Random/Isaac64.zig +++ b/lib/std/Random/Isaac64.zig @@ -173,7 +173,7 @@ pub fn fill(self: *Isaac64, buf: []u8) void { } } -test "isaac64 sequence" { +test "sequence" { var r = Isaac64.init(0); // from reference implementation @@ -201,7 +201,7 @@ test "isaac64 sequence" { } } -test "isaac64 fill" { +test "fill" { var r = Isaac64.init(0); // from reference implementation diff --git a/lib/std/Random/Pcg.zig b/lib/std/Random/Pcg.zig index 1ff65f0f44..a5f4ef7e41 100644 --- a/lib/std/Random/Pcg.zig +++ b/lib/std/Random/Pcg.zig @@ -72,7 +72,7 @@ pub fn fill(self: *Pcg, buf: []u8) void { } } -test "pcg sequence" { +test "sequence" { var r = Pcg.init(0); const s0: u64 = 0x9394bf54ce5d79de; const s1: u64 = 0x84e9c579ef59bbf7; @@ -92,7 +92,7 @@ test "pcg sequence" { } } -test "pcg fill" { +test "fill" { var r = Pcg.init(0); const s0: u64 = 0x9394bf54ce5d79de; const s1: u64 = 0x84e9c579ef59bbf7; diff --git a/lib/std/Random/RomuTrio.zig b/lib/std/Random/RomuTrio.zig index 9cc8cf13e1..202361ae66 100644 --- a/lib/std/Random/RomuTrio.zig +++ b/lib/std/Random/RomuTrio.zig @@ -72,7 +72,7 @@ pub fn fill(self: *RomuTrio, buf: []u8) void { } } -test "RomuTrio sequence" { +test "sequence" { // Unfortunately there does not seem to be an official test sequence. var r = RomuTrio.init(0); @@ -94,7 +94,7 @@ test "RomuTrio sequence" { } } -test "RomuTrio fill" { +test "fill" { // Unfortunately there does not seem to be an official test sequence. var r = RomuTrio.init(0); @@ -120,7 +120,7 @@ test "RomuTrio fill" { } } -test "RomuTrio buf seeding test" { +test "buf seeding test" { const buf0 = @as([24]u8, @bitCast([3]u64{ 16294208416658607535, 13964609475759908645, 4703697494102998476 })); const resulting_state = .{ .x = 16294208416658607535, .y = 13964609475759908645, .z = 4703697494102998476 }; var r = RomuTrio.init(0); diff --git a/lib/std/Random/Sfc64.zig b/lib/std/Random/Sfc64.zig index 004167952e..7a68446096 100644 --- a/lib/std/Random/Sfc64.zig +++ b/lib/std/Random/Sfc64.zig @@ -70,7 +70,7 @@ pub fn fill(self: *Sfc64, buf: []u8) void { } } -test "Sfc64 sequence" { +test "sequence" { // Unfortunately there does not seem to be an official test sequence. var r = Sfc64.init(0); @@ -98,7 +98,7 @@ test "Sfc64 sequence" { } } -test "Sfc64 fill" { +test "fill" { // Unfortunately there does not seem to be an official test sequence. var r = Sfc64.init(0); diff --git a/lib/std/Random/Xoroshiro128.zig b/lib/std/Random/Xoroshiro128.zig index 6966a4fc5a..44eb594e37 100644 --- a/lib/std/Random/Xoroshiro128.zig +++ b/lib/std/Random/Xoroshiro128.zig @@ -88,7 +88,7 @@ pub fn fill(self: *Xoroshiro128, buf: []u8) void { } } -test "xoroshiro sequence" { +test "sequence" { var r = Xoroshiro128.init(0); r.s[0] = 0xaeecf86f7878dd75; r.s[1] = 0x01cd153642e72622; @@ -122,7 +122,7 @@ test "xoroshiro sequence" { } } -test "xoroshiro fill" { +test "fill" { var r = Xoroshiro128.init(0); r.s[0] = 0xaeecf86f7878dd75; r.s[1] = 0x01cd153642e72622; diff --git a/lib/std/Random/Xoshiro256.zig b/lib/std/Random/Xoshiro256.zig index 75e860b89f..94e62b1480 100644 --- a/lib/std/Random/Xoshiro256.zig +++ b/lib/std/Random/Xoshiro256.zig @@ -88,7 +88,7 @@ pub fn fill(self: *Xoshiro256, buf: []u8) void { } } -test "xoroshiro sequence" { +test "sequence" { if (@import("builtin").zig_backend == .stage2_c) return error.SkipZigTest; var r = Xoshiro256.init(0); @@ -122,7 +122,7 @@ test "xoroshiro sequence" { } } -test "xoroshiro fill" { +test "fill" { var r = Xoshiro256.init(0); const seq = [_]u64{ diff --git a/lib/std/SemanticVersion.zig b/lib/std/SemanticVersion.zig index 6078661bd6..71529045e5 100644 --- a/lib/std/SemanticVersion.zig +++ b/lib/std/SemanticVersion.zig @@ -166,7 +166,7 @@ pub fn format( const expect = std.testing.expect; const expectError = std.testing.expectError; -test "SemanticVersion format" { +test "format" { // Many of these test strings are from https://github.com/semver/semver.org/issues/59#issuecomment-390854010. // Valid version strings should be accepted. @@ -277,7 +277,7 @@ test "SemanticVersion format" { if (parse(big_invalid)) |ver| std.debug.panic("expected error, found {}", .{ver}) else |_| {} } -test "SemanticVersion precedence" { +test "precedence" { // SemVer 2 spec 11.2 example: 1.0.0 < 2.0.0 < 2.1.0 < 2.1.1. try expect(order(try parse("1.0.0"), try parse("2.0.0")) == .lt); try expect(order(try parse("2.0.0"), try parse("2.1.0")) == .lt); diff --git a/lib/std/Thread.zig b/lib/std/Thread.zig index ae794f44af..bf538c1b4f 100644 --- a/lib/std/Thread.zig +++ b/lib/std/Thread.zig @@ -1437,7 +1437,7 @@ fn testIncrementNotify(value: *usize, event: *ResetEvent) void { event.set(); } -test "Thread.join" { +test "join" { if (builtin.single_threaded) return error.SkipZigTest; var value: usize = 0; @@ -1449,7 +1449,7 @@ test "Thread.join" { try std.testing.expectEqual(value, 1); } -test "Thread.detach" { +test "detach" { if (builtin.single_threaded) return error.SkipZigTest; var value: usize = 0; diff --git a/lib/std/Thread/Condition.zig b/lib/std/Thread/Condition.zig index 83e5134538..5c436261a8 100644 --- a/lib/std/Thread/Condition.zig +++ b/lib/std/Thread/Condition.zig @@ -296,7 +296,7 @@ const FutexImpl = struct { } }; -test "Condition - smoke test" { +test "smoke test" { var mutex = Mutex{}; var cond = Condition{}; @@ -317,7 +317,7 @@ test "Condition - smoke test" { } // Inspired from: https://github.com/Amanieu/parking_lot/pull/129 -test "Condition - wait and signal" { +test "wait and signal" { // This test requires spawning threads if (builtin.single_threaded) { return error.SkipZigTest; @@ -362,7 +362,7 @@ test "Condition - wait and signal" { } } -test "Condition - signal" { +test "signal" { // This test requires spawning threads if (builtin.single_threaded) { return error.SkipZigTest; @@ -429,7 +429,7 @@ test "Condition - signal" { } } -test "Condition - multi signal" { +test "multi signal" { // This test requires spawning threads if (builtin.single_threaded) { return error.SkipZigTest; @@ -491,7 +491,7 @@ test "Condition - multi signal" { } } -test "Condition - broadcasting" { +test "broadcasting" { // This test requires spawning threads if (builtin.single_threaded) { return error.SkipZigTest; @@ -557,7 +557,7 @@ test "Condition - broadcasting" { } } -test "Condition - broadcasting - wake all threads" { +test "broadcasting - wake all threads" { // Tests issue #12877 // This test requires spawning threads if (builtin.single_threaded) { diff --git a/lib/std/Thread/Futex.zig b/lib/std/Thread/Futex.zig index 60f889f694..b6f37feda4 100644 --- a/lib/std/Thread/Futex.zig +++ b/lib/std/Thread/Futex.zig @@ -881,7 +881,7 @@ const PosixImpl = struct { } }; -test "Futex - smoke test" { +test "smoke test" { var value = atomic.Value(u32).init(0); // Try waits with invalid values. @@ -898,7 +898,7 @@ test "Futex - smoke test" { Futex.wake(&value, std.math.maxInt(u32)); } -test "Futex - signaling" { +test "signaling" { // This test requires spawning threads if (builtin.single_threaded) { return error.SkipZigTest; @@ -952,7 +952,7 @@ test "Futex - signaling" { for (paddles) |p| try testing.expectEqual(p.current, num_iterations); } -test "Futex - broadcasting" { +test "broadcasting" { // This test requires spawning threads if (builtin.single_threaded) { return error.SkipZigTest; @@ -1054,7 +1054,7 @@ pub const Deadline = struct { } }; -test "Futex - Deadline" { +test "Deadline" { var deadline = Deadline.init(100 * std.time.ns_per_ms); var futex_word = atomic.Value(u32).init(0); diff --git a/lib/std/Thread/Mutex.zig b/lib/std/Thread/Mutex.zig index a9024e6c5d..7beb7dd752 100644 --- a/lib/std/Thread/Mutex.zig +++ b/lib/std/Thread/Mutex.zig @@ -215,7 +215,7 @@ const FutexImpl = struct { } }; -test "Mutex - smoke test" { +test "smoke test" { var mutex = Mutex{}; try testing.expect(mutex.tryLock()); @@ -243,7 +243,7 @@ const NonAtomicCounter = struct { } }; -test "Mutex - many uncontended" { +test "many uncontended" { // This test requires spawning threads. if (builtin.single_threaded) { return error.SkipZigTest; @@ -274,7 +274,7 @@ test "Mutex - many uncontended" { for (runners) |r| try testing.expectEqual(r.counter.get(), num_increments); } -test "Mutex - many contended" { +test "many contended" { // This test requires spawning threads. if (builtin.single_threaded) { return error.SkipZigTest; diff --git a/lib/std/Thread/ResetEvent.zig b/lib/std/Thread/ResetEvent.zig index cd74f337fb..431d54e852 100644 --- a/lib/std/Thread/ResetEvent.zig +++ b/lib/std/Thread/ResetEvent.zig @@ -157,7 +157,7 @@ const FutexImpl = struct { } }; -test "ResetEvent - smoke test" { +test "smoke test" { // make sure the event is unset var event = ResetEvent{}; try testing.expectEqual(false, event.isSet()); @@ -181,7 +181,7 @@ test "ResetEvent - smoke test" { try testing.expectEqual(true, event.isSet()); } -test "ResetEvent - signaling" { +test "signaling" { // This test requires spawning threads if (builtin.single_threaded) { return error.SkipZigTest; @@ -242,7 +242,7 @@ test "ResetEvent - signaling" { try ctx.input(); } -test "ResetEvent - broadcast" { +test "broadcast" { // This test requires spawning threads if (builtin.single_threaded) { return error.SkipZigTest; diff --git a/lib/std/Thread/RwLock.zig b/lib/std/Thread/RwLock.zig index e0923c40ad..80207dee00 100644 --- a/lib/std/Thread/RwLock.zig +++ b/lib/std/Thread/RwLock.zig @@ -264,7 +264,7 @@ test "DefaultRwLock - internal state" { try testing.expectEqual(rwl, DefaultRwLock{}); } -test "RwLock - smoke test" { +test "smoke test" { var rwl = RwLock{}; rwl.lock(); @@ -293,7 +293,7 @@ test "RwLock - smoke test" { rwl.unlock(); } -test "RwLock - concurrent access" { +test "concurrent access" { if (builtin.single_threaded) return; diff --git a/lib/std/Thread/Semaphore.zig b/lib/std/Thread/Semaphore.zig index 3253d17a8e..47dccea6df 100644 --- a/lib/std/Thread/Semaphore.zig +++ b/lib/std/Thread/Semaphore.zig @@ -71,7 +71,7 @@ pub fn post(sem: *Semaphore) void { sem.cond.signal(); } -test "Thread.Semaphore" { +test "Semaphore" { if (builtin.single_threaded) { return error.SkipZigTest; } @@ -97,7 +97,7 @@ test "Thread.Semaphore" { try testing.expect(n == num_threads); } -test "Thread.Semaphore - timedWait" { +test "timedWait" { var sem = Semaphore{}; try testing.expectEqual(0, sem.permits); diff --git a/lib/std/array_list.zig b/lib/std/array_list.zig index 1926f627f3..ff2307e812 100644 --- a/lib/std/array_list.zig +++ b/lib/std/array_list.zig @@ -1231,7 +1231,7 @@ fn addOrOom(a: usize, b: usize) error{OutOfMemory}!usize { return result; } -test "std.ArrayList/ArrayListUnmanaged.init" { +test "init" { { var list = ArrayList(i32).init(testing.allocator); defer list.deinit(); @@ -1248,7 +1248,7 @@ test "std.ArrayList/ArrayListUnmanaged.init" { } } -test "std.ArrayList/ArrayListUnmanaged.initCapacity" { +test "initCapacity" { const a = testing.allocator; { var list = try ArrayList(i8).initCapacity(a, 200); @@ -1264,7 +1264,7 @@ test "std.ArrayList/ArrayListUnmanaged.initCapacity" { } } -test "std.ArrayList/ArrayListUnmanaged.clone" { +test "clone" { const a = testing.allocator; { var array = ArrayList(i32).init(a); @@ -1305,7 +1305,7 @@ test "std.ArrayList/ArrayListUnmanaged.clone" { } } -test "std.ArrayList/ArrayListUnmanaged.basic" { +test "basic" { const a = testing.allocator; { var list = ArrayList(i32).init(a); @@ -1409,7 +1409,7 @@ test "std.ArrayList/ArrayListUnmanaged.basic" { } } -test "std.ArrayList/ArrayListUnmanaged.appendNTimes" { +test "appendNTimes" { const a = testing.allocator; { var list = ArrayList(i32).init(a); @@ -1433,7 +1433,7 @@ test "std.ArrayList/ArrayListUnmanaged.appendNTimes" { } } -test "std.ArrayList/ArrayListUnmanaged.appendNTimes with failing allocator" { +test "appendNTimes with failing allocator" { const a = testing.failing_allocator; { var list = ArrayList(i32).init(a); @@ -1447,7 +1447,7 @@ test "std.ArrayList/ArrayListUnmanaged.appendNTimes with failing allocator" { } } -test "std.ArrayList/ArrayListUnmanaged.orderedRemove" { +test "orderedRemove" { const a = testing.allocator; { var list = ArrayList(i32).init(a); @@ -1519,7 +1519,7 @@ test "std.ArrayList/ArrayListUnmanaged.orderedRemove" { } } -test "std.ArrayList/ArrayListUnmanaged.swapRemove" { +test "swapRemove" { const a = testing.allocator; { var list = ArrayList(i32).init(a); @@ -1575,7 +1575,7 @@ test "std.ArrayList/ArrayListUnmanaged.swapRemove" { } } -test "std.ArrayList/ArrayListUnmanaged.insert" { +test "insert" { const a = testing.allocator; { var list = ArrayList(i32).init(a); @@ -1605,7 +1605,7 @@ test "std.ArrayList/ArrayListUnmanaged.insert" { } } -test "std.ArrayList/ArrayListUnmanaged.insertSlice" { +test "insertSlice" { const a = testing.allocator; { var list = ArrayList(i32).init(a); @@ -1651,7 +1651,7 @@ test "std.ArrayList/ArrayListUnmanaged.insertSlice" { } } -test "std.ArrayList/ArrayListUnmanaged.replaceRange" { +test "replaceRange" { var arena = std.heap.ArenaAllocator.init(testing.allocator); defer arena.deinit(); const a = arena.allocator(); @@ -1773,7 +1773,7 @@ const ItemUnmanaged = struct { sub_items: ArrayListUnmanaged(ItemUnmanaged), }; -test "std.ArrayList/ArrayListUnmanaged: ArrayList(T) of struct T" { +test "ArrayList(T) of struct T" { const a = std.testing.allocator; { var root = Item{ .integer = 1, .sub_items = ArrayList(Item).init(a) }; @@ -1789,7 +1789,7 @@ test "std.ArrayList/ArrayListUnmanaged: ArrayList(T) of struct T" { } } -test "std.ArrayList(u8)/ArrayListAligned implements writer" { +test "ArrayList(u8) implements writer" { const a = testing.allocator; { @@ -1816,7 +1816,7 @@ test "std.ArrayList(u8)/ArrayListAligned implements writer" { } } -test "std.ArrayListUnmanaged(u8) implements writer" { +test "ArrayListUnmanaged(u8) implements writer" { const a = testing.allocator; { @@ -1883,7 +1883,7 @@ test "shrinkAndFree with a copy" { try testing.expect(mem.eql(i32, list.items, &.{ 3, 3, 3, 3 })); } -test "std.ArrayList/ArrayListUnmanaged.addManyAsArray" { +test "addManyAsArray" { const a = std.testing.allocator; { var list = ArrayList(u8).init(a); @@ -1907,7 +1907,7 @@ test "std.ArrayList/ArrayListUnmanaged.addManyAsArray" { } } -test "std.ArrayList/ArrayListUnmanaged growing memory preserves contents" { +test "growing memory preserves contents" { // Shrink the list after every insertion to ensure that a memory growth // will be triggered in the next operation. const a = std.testing.allocator; @@ -1941,46 +1941,55 @@ test "std.ArrayList/ArrayListUnmanaged growing memory preserves contents" { } } -test "std.ArrayList/ArrayList.fromOwnedSliceSentinel" { +test "fromOwnedSlice" { const a = testing.allocator; + { + var orig_list = ArrayList(u8).init(a); + defer orig_list.deinit(); + try orig_list.appendSlice("foobar"); - var orig_list = ArrayList(u8).init(a); - defer orig_list.deinit(); - try orig_list.appendSlice("foobar"); - const sentinel_slice = try orig_list.toOwnedSliceSentinel(0); + const slice = try orig_list.toOwnedSlice(); + var list = ArrayList(u8).fromOwnedSlice(a, slice); + defer list.deinit(); + try testing.expectEqualStrings(list.items, "foobar"); + } + { + var list = ArrayList(u8).init(a); + defer list.deinit(); + try list.appendSlice("foobar"); - var list = ArrayList(u8).fromOwnedSliceSentinel(a, 0, sentinel_slice); - defer list.deinit(); - try testing.expectEqualStrings(list.items, "foobar"); + const slice = try list.toOwnedSlice(); + var unmanaged = ArrayListUnmanaged(u8).fromOwnedSlice(slice); + defer unmanaged.deinit(a); + try testing.expectEqualStrings(unmanaged.items, "foobar"); + } } -test "std.ArrayList/ArrayListUnmanaged.fromOwnedSlice" { +test "fromOwnedSliceSentinel" { const a = testing.allocator; + { + var orig_list = ArrayList(u8).init(a); + defer orig_list.deinit(); + try orig_list.appendSlice("foobar"); - var list = ArrayList(u8).init(a); - defer list.deinit(); - try list.appendSlice("foobar"); + const sentinel_slice = try orig_list.toOwnedSliceSentinel(0); + var list = ArrayList(u8).fromOwnedSliceSentinel(a, 0, sentinel_slice); + defer list.deinit(); + try testing.expectEqualStrings(list.items, "foobar"); + } + { + var list = ArrayList(u8).init(a); + defer list.deinit(); + try list.appendSlice("foobar"); - const slice = try list.toOwnedSlice(); - var unmanaged = ArrayListUnmanaged(u8).fromOwnedSlice(slice); - defer unmanaged.deinit(a); - try testing.expectEqualStrings(unmanaged.items, "foobar"); + const sentinel_slice = try list.toOwnedSliceSentinel(0); + var unmanaged = ArrayListUnmanaged(u8).fromOwnedSliceSentinel(0, sentinel_slice); + defer unmanaged.deinit(a); + try testing.expectEqualStrings(unmanaged.items, "foobar"); + } } -test "std.ArrayList/ArrayListUnmanaged.fromOwnedSliceSentinel" { - const a = testing.allocator; - - var list = ArrayList(u8).init(a); - defer list.deinit(); - try list.appendSlice("foobar"); - - const sentinel_slice = try list.toOwnedSliceSentinel(0); - var unmanaged = ArrayListUnmanaged(u8).fromOwnedSliceSentinel(0, sentinel_slice); - defer unmanaged.deinit(a); - try testing.expectEqualStrings(unmanaged.items, "foobar"); -} - -test "std.ArrayList/ArrayListUnmanaged.toOwnedSliceSentinel" { +test "toOwnedSliceSentinel" { const a = testing.allocator; { var list = ArrayList(u8).init(a); @@ -2004,7 +2013,7 @@ test "std.ArrayList/ArrayListUnmanaged.toOwnedSliceSentinel" { } } -test "ArrayListAligned/ArrayListAlignedUnmanaged accepts unaligned slices" { +test "accepts unaligned slices" { const a = testing.allocator; { var list = std.ArrayListAligned(u8, 8).init(a); @@ -2028,7 +2037,7 @@ test "ArrayListAligned/ArrayListAlignedUnmanaged accepts unaligned slices" { } } -test "std.ArrayList(u0)" { +test "ArrayList(u0)" { // An ArrayList on zero-sized types should not need to allocate const a = testing.failing_allocator; @@ -2048,7 +2057,7 @@ test "std.ArrayList(u0)" { try testing.expectEqual(count, 3); } -test "std.ArrayList(?u32).popOrNull()" { +test "ArrayList(?u32).popOrNull()" { const a = testing.allocator; var list = ArrayList(?u32).init(a); @@ -2065,7 +2074,7 @@ test "std.ArrayList(?u32).popOrNull()" { try testing.expect(list.popOrNull() == null); } -test "std.ArrayList(u32).getLast()" { +test "ArrayList(u32).getLast()" { const a = testing.allocator; var list = ArrayList(u32).init(a); @@ -2076,7 +2085,7 @@ test "std.ArrayList(u32).getLast()" { try testing.expectEqual(const_list.getLast(), 2); } -test "std.ArrayList(u32).getLastOrNull()" { +test "ArrayList(u32).getLastOrNull()" { const a = testing.allocator; var list = ArrayList(u32).init(a); diff --git a/lib/std/buf_set.zig b/lib/std/buf_set.zig index 46c10f82f8..6ff8ee23af 100644 --- a/lib/std/buf_set.zig +++ b/lib/std/buf_set.zig @@ -101,7 +101,7 @@ pub const BufSet = struct { } }; -test "BufSet" { +test BufSet { var bufset = BufSet.init(std.testing.allocator); defer bufset.deinit(); @@ -115,7 +115,7 @@ test "BufSet" { try bufset.insert("z"); } -test "BufSet clone" { +test "clone" { var original = BufSet.init(testing.allocator); defer original.deinit(); try original.insert("x"); @@ -132,7 +132,7 @@ test "BufSet clone" { ); } -test "BufSet.clone with arena" { +test "clone with arena" { const allocator = std.testing.allocator; var arena = std.heap.ArenaAllocator.init(allocator); defer arena.deinit(); diff --git a/lib/std/compress/flate.zig b/lib/std/compress/flate.zig index 5338328a21..da86d981f6 100644 --- a/lib/std/compress/flate.zig +++ b/lib/std/compress/flate.zig @@ -84,7 +84,7 @@ test { _ = inflate; } -test "flate compress/decompress" { +test "compress/decompress" { if (builtin.target.cpu.arch == .wasm32) return error.SkipZigTest; var cmp_buf: [64 * 1024]u8 = undefined; // compressed data buffer @@ -252,7 +252,7 @@ fn testDecompress(comptime container: Container, compressed: []const u8, expecte try testing.expectEqualSlices(u8, expected_plain, out.items); } -test "flate don't read past deflate stream's end" { +test "don't read past deflate stream's end" { try testDecompress(.zlib, &[_]u8{ 0x08, 0xd7, 0x63, 0xf8, 0xcf, 0xc0, 0xc0, 0x00, 0xc1, 0xff, 0xff, 0x43, 0x30, 0x03, 0x03, 0xc3, 0xff, 0xff, 0xff, 0x01, @@ -264,7 +264,7 @@ test "flate don't read past deflate stream's end" { }); } -test "flate zlib header" { +test "zlib header" { // Truncated header try testing.expectError( error.EndOfStream, @@ -292,7 +292,7 @@ test "flate zlib header" { ); } -test "flate gzip header" { +test "gzip header" { // Truncated header try testing.expectError( error.EndOfStream, @@ -353,7 +353,7 @@ test "flate gzip header" { }, ""); } -test "flate public interface" { +test "public interface" { if (builtin.target.cpu.arch == .wasm32) return error.SkipZigTest; const plain_data = [_]u8{ 'H', 'e', 'l', 'l', 'o', ' ', 'w', 'o', 'r', 'l', 'd', 0x0a }; diff --git a/lib/std/compress/flate/CircularBuffer.zig b/lib/std/compress/flate/CircularBuffer.zig index f25a231ee4..bb98173aad 100644 --- a/lib/std/compress/flate/CircularBuffer.zig +++ b/lib/std/compress/flate/CircularBuffer.zig @@ -130,7 +130,7 @@ pub fn full(self: *Self) bool { } // example from: https://youtu.be/SJPvNi4HrWQ?t=3558 -test "flate.CircularBuffer writeMatch" { +test "writeMatch" { var cb: Self = .{}; cb.writeAll("a salad; "); @@ -140,7 +140,7 @@ test "flate.CircularBuffer writeMatch" { try testing.expectEqualStrings("a salad; a salsal", cb.read()); } -test "flate.CircularBuffer writeMatch overlap" { +test "writeMatch overlap" { var cb: Self = .{}; cb.writeAll("a b c "); @@ -150,7 +150,7 @@ test "flate.CircularBuffer writeMatch overlap" { try testing.expectEqualStrings("a b c b c b c d", cb.read()); } -test "flate.CircularBuffer readAtMost" { +test "readAtMost" { var cb: Self = .{}; cb.writeAll("0123456789"); @@ -165,7 +165,7 @@ test "flate.CircularBuffer readAtMost" { try testing.expectEqualStrings("", cb.read()); } -test "flate.CircularBuffer" { +test "CircularBuffer" { var cb: Self = .{}; const data = "0123456789abcdef" ** (1024 / 16); @@ -201,7 +201,7 @@ test "flate.CircularBuffer" { try testing.expectEqual(@as(usize, 200), cb.read().len); // read the rest } -test "flate.CircularBuffer write overlap" { +test "write overlap" { var cb: Self = .{}; cb.wp = cb.buffer.len - 15; cb.rp = cb.wp; @@ -218,7 +218,7 @@ test "flate.CircularBuffer write overlap" { try testing.expect(cb.wp == cb.rp); } -test "flate.CircularBuffer writeMatch/read overlap" { +test "writeMatch/read overlap" { var cb: Self = .{}; cb.wp = cb.buffer.len - 15; cb.rp = cb.wp; diff --git a/lib/std/compress/flate/Lookup.zig b/lib/std/compress/flate/Lookup.zig index b5d1fd3c97..34ac38f5e8 100644 --- a/lib/std/compress/flate/Lookup.zig +++ b/lib/std/compress/flate/Lookup.zig @@ -83,7 +83,7 @@ fn hashu(v: u32) u32 { return @intCast((v *% prime4) >> consts.lookup.shift); } -test "flate.Lookup add/prev" { +test "add/prev" { const data = [_]u8{ 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, @@ -107,7 +107,7 @@ test "flate.Lookup add/prev" { try expect(h.chain[2 + 8] == 2); } -test "flate.Lookup bulkAdd" { +test "bulkAdd" { const data = "Lorem ipsum dolor sit amet, consectetur adipiscing elit."; // one by one diff --git a/lib/std/compress/flate/SlidingWindow.zig b/lib/std/compress/flate/SlidingWindow.zig index 2e935fa52b..684b91bacc 100644 --- a/lib/std/compress/flate/SlidingWindow.zig +++ b/lib/std/compress/flate/SlidingWindow.zig @@ -122,7 +122,7 @@ pub fn tokensBuffer(self: *Self) ?[]const u8 { return self.buffer[@intCast(self.fp)..self.rp]; } -test "flate.SlidingWindow match" { +test "match" { const data = "Blah blah blah blah blah!"; var win: Self = .{}; try expect(win.write(data) == data.len); @@ -142,7 +142,7 @@ test "flate.SlidingWindow match" { try expect(win.match(15, 20, 4) == 0); } -test "flate.SlidingWindow slide" { +test "slide" { var win: Self = .{}; win.wp = Self.buffer_len - 11; win.rp = Self.buffer_len - 111; diff --git a/lib/std/compress/flate/Token.zig b/lib/std/compress/flate/Token.zig index 7e067daf83..cec23a139c 100644 --- a/lib/std/compress/flate/Token.zig +++ b/lib/std/compress/flate/Token.zig @@ -275,12 +275,12 @@ const match_distances = [_]MatchDistance{ .{ .extra_bits = 13, .base_scaled = 0x6000, .code = 29, .base = 24577 }, }; -test "flate.Token size" { +test "size" { try expect(@sizeOf(Token) == 4); } // testing table https://datatracker.ietf.org/doc/html/rfc1951#page-12 -test "flate.Token MatchLength" { +test "MatchLength" { var c = Token.initMatch(1, 4).lengthEncoding(); try expect(c.code == 258); try expect(c.extra_bits == 0); @@ -302,7 +302,7 @@ test "flate.Token MatchLength" { try expect(c.extra_length == 130 - 115); } -test "flate.Token MatchDistance" { +test "MatchDistance" { var c = Token.initMatch(1, 4).distanceEncoding(); try expect(c.code == 0); try expect(c.extra_bits == 0); @@ -314,7 +314,7 @@ test "flate.Token MatchDistance" { try expect(c.extra_distance == 192 - 129); } -test "flate.Token match_lengths" { +test "match_lengths" { for (match_lengths, 0..) |ml, i| { try expect(@as(u16, ml.base_scaled) + 3 == ml.base); try expect(i + 257 == ml.code); diff --git a/lib/std/compress/flate/bit_reader.zig b/lib/std/compress/flate/bit_reader.zig index 40e9b76fb8..193849836e 100644 --- a/lib/std/compress/flate/bit_reader.zig +++ b/lib/std/compress/flate/bit_reader.zig @@ -218,7 +218,7 @@ pub fn BitReader(comptime ReaderType: type) type { }; } -test "flate.BitReader" { +test "BitReader" { var fbs = std.io.fixedBufferStream(&[_]u8{ 0xf3, 0x48, 0xcd, 0xc9, 0x00, 0x00 }); var br = bitReader(fbs.reader()); const F = BitReader(@TypeOf(fbs.reader())).flag; @@ -253,7 +253,7 @@ test "flate.BitReader" { try testing.expectEqual(@as(u16, 0xc), try br.readN(4, 0)); } -test "flate.BitReader read block type 1 data" { +test "read block type 1 data" { const data = [_]u8{ 0xf3, 0x48, 0xcd, 0xc9, 0xc9, 0x57, 0x28, 0xcf, // deflate data block type 1 0x2f, 0xca, 0x49, 0xe1, 0x02, 0x00, @@ -277,7 +277,7 @@ test "flate.BitReader read block type 1 data" { try testing.expectEqual(@as(u16, 0xddcc), try br.readF(u16, 0)); } -test "flate.BitReader init" { +test "init" { const data = [_]u8{ 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, @@ -302,7 +302,7 @@ test "flate.BitReader init" { try testing.expectEqual(@as(u64, 0x00_00_00_00_00_08_07_06), br.bits); } -test "flate.BitReader readAll" { +test "readAll" { const data = [_]u8{ 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, @@ -320,7 +320,7 @@ test "flate.BitReader readAll" { try testing.expectEqualSlices(u8, data[0..16], &out); } -test "flate.BitReader readFixedCode" { +test "readFixedCode" { const fixed_codes = @import("huffman_encoder.zig").fixed_codes; var fbs = std.io.fixedBufferStream(&fixed_codes); diff --git a/lib/std/compress/flate/block_writer.zig b/lib/std/compress/flate/block_writer.zig index 394f1cbec5..d2a8cc0dcd 100644 --- a/lib/std/compress/flate/block_writer.zig +++ b/lib/std/compress/flate/block_writer.zig @@ -596,20 +596,20 @@ const TestCase = @import("testdata/block_writer.zig").TestCase; const testCases = @import("testdata/block_writer.zig").testCases; // tests if the writeBlock encoding has changed. -test "flate.BlockWriter write" { +test "write" { inline for (0..testCases.len) |i| { try testBlock(testCases[i], .write_block); } } // tests if the writeBlockDynamic encoding has changed. -test "flate.BlockWriter dynamicBlock" { +test "dynamicBlock" { inline for (0..testCases.len) |i| { try testBlock(testCases[i], .write_dyn_block); } } -test "flate.BlockWriter huffmanBlock" { +test "huffmanBlock" { inline for (0..testCases.len) |i| { try testBlock(testCases[i], .write_huffman_block); } diff --git a/lib/std/compress/flate/huffman_decoder.zig b/lib/std/compress/flate/huffman_decoder.zig index a7c14f426b..bc8b59f492 100644 --- a/lib/std/compress/flate/huffman_decoder.zig +++ b/lib/std/compress/flate/huffman_decoder.zig @@ -93,7 +93,6 @@ fn HuffmanDecoder( var code: u16 = 0; var idx: u16 = 0; for (&self.symbols, 0..) |*sym, pos| { - //print("sym: {}\n", .{sym}); if (sym.code_bits == 0) continue; // skip unused sym.code = code; @@ -116,7 +115,6 @@ fn HuffmanDecoder( idx = next_idx; code = next_code; } - //print("decoder generate, code: {d}, idx: {d}\n", .{ code, idx }); } /// Given the list of code lengths check that it represents a canonical @@ -176,7 +174,7 @@ fn HuffmanDecoder( }; } -test "flate.HuffmanDecoder init/find" { +test "init/find" { // example data from: https://youtu.be/SJPvNi4HrWQ?t=8423 const code_lens = [_]u4{ 4, 3, 0, 2, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 3, 2 }; var h: CodegenDecoder = .{}; @@ -252,11 +250,7 @@ test "flate.HuffmanDecoder init/find" { try testing.expectEqual(16, (try h.find(@intCast(c))).symbol); } -const print = std.debug.print; -const assert = std.debug.assert; -const expect = std.testing.expect; - -test "flate.HuffmanDecoder encode/decode literals" { +test "encode/decode literals" { const LiteralEncoder = @import("huffman_encoder.zig").LiteralEncoder; for (1..286) |j| { // for all different number of codes @@ -292,7 +286,7 @@ test "flate.HuffmanDecoder encode/decode literals" { }; const c = enc.codes[symbol]; - try expect(c.code == c_code); + try testing.expect(c.code == c_code); } // find each symbol by code @@ -301,8 +295,8 @@ test "flate.HuffmanDecoder encode/decode literals" { const s_code: u15 = @bitReverse(@as(u15, @intCast(c.code))); const s = try dec.find(s_code); - try expect(s.code == s_code); - try expect(s.code_bits == c.len); + try testing.expect(s.code == s_code); + try testing.expect(s.code_bits == c.len); } } } diff --git a/lib/std/compress/flate/huffman_encoder.zig b/lib/std/compress/flate/huffman_encoder.zig index a8553ebb5e..067b5197d3 100644 --- a/lib/std/compress/flate/huffman_encoder.zig +++ b/lib/std/compress/flate/huffman_encoder.zig @@ -360,7 +360,7 @@ fn byFreq(context: void, a: LiteralNode, b: LiteralNode) bool { return a.freq < b.freq; } -test "flate.HuffmanEncoder generate a Huffman code from an array of frequencies" { +test "generate a Huffman code from an array of frequencies" { var freqs: [19]u16 = [_]u16{ 8, // 0 1, // 1 @@ -421,7 +421,7 @@ test "flate.HuffmanEncoder generate a Huffman code from an array of frequencies" try testing.expectEqual(@as(u16, 0x3f), enc.codes[16].code); } -test "flate.HuffmanEncoder generate a Huffman code for the fixed literal table specific to Deflate" { +test "generate a Huffman code for the fixed literal table specific to Deflate" { const enc = fixedLiteralEncoder(); for (enc.codes) |c| { switch (c.len) { @@ -443,7 +443,7 @@ test "flate.HuffmanEncoder generate a Huffman code for the fixed literal table s } } -test "flate.HuffmanEncoder generate a Huffman code for the 30 possible relative distances (LZ77 distances) of Deflate" { +test "generate a Huffman code for the 30 possible relative distances (LZ77 distances) of Deflate" { const enc = fixedDistanceEncoder(); for (enc.codes) |c| { const v = @bitReverse(@as(u5, @intCast(c.code))); @@ -458,7 +458,7 @@ fn bitReverse(comptime T: type, value: T, n: usize) T { return r >> @as(math.Log2Int(T), @intCast(@typeInfo(T).Int.bits - n)); } -test "flate bitReverse" { +test "bitReverse" { const ReverseBitsTest = struct { in: u16, bit_count: u5, @@ -482,7 +482,7 @@ test "flate bitReverse" { } } -test "flate.HuffmanEncoder fixedLiteralEncoder codes" { +test "fixedLiteralEncoder codes" { var al = std.ArrayList(u8).init(testing.allocator); defer al.deinit(); var bw = std.io.bitWriter(.little, al.writer()); diff --git a/lib/std/compress/flate/inflate.zig b/lib/std/compress/flate/inflate.zig index 5e286d2af3..a6aee7b56f 100644 --- a/lib/std/compress/flate/inflate.zig +++ b/lib/std/compress/flate/inflate.zig @@ -342,7 +342,7 @@ pub fn Inflate(comptime container: Container, comptime ReaderType: type) type { }; } -test "flate.Inflate decompress" { +test "decompress" { const cases = [_]struct { in: []const u8, out: []const u8, @@ -383,7 +383,7 @@ test "flate.Inflate decompress" { } } -test "flate.Inflate gzip decompress" { +test "gzip decompress" { const cases = [_]struct { in: []const u8, out: []const u8, @@ -440,7 +440,7 @@ test "flate.Inflate gzip decompress" { } } -test "flate.Inflate zlib decompress" { +test "zlib decompress" { const cases = [_]struct { in: []const u8, out: []const u8, @@ -466,7 +466,7 @@ test "flate.Inflate zlib decompress" { } } -test "flate.Inflate fuzzing tests" { +test "fuzzing tests" { const cases = [_]struct { input: []const u8, out: []const u8 = "", @@ -529,7 +529,7 @@ test "flate.Inflate fuzzing tests" { } } -test "flate bug 18966" { +test "bug 18966" { const input = @embedFile("testdata/fuzz/bug_18966.input"); const expect = @embedFile("testdata/fuzz/bug_18966.expect"); diff --git a/lib/std/compress/lzma/test.zig b/lib/std/compress/lzma/test.zig index bdfe2909d8..c85090730f 100644 --- a/lib/std/compress/lzma/test.zig +++ b/lib/std/compress/lzma/test.zig @@ -21,7 +21,7 @@ fn testDecompressError(expected: anyerror, compressed: []const u8) !void { return std.testing.expectError(expected, testDecompress(compressed)); } -test "LZMA: decompress empty world" { +test "decompress empty world" { try testDecompressEqual( "", &[_]u8{ @@ -31,7 +31,7 @@ test "LZMA: decompress empty world" { ); } -test "LZMA: decompress hello world" { +test "decompress hello world" { try testDecompressEqual( "Hello world\n", &[_]u8{ @@ -42,7 +42,7 @@ test "LZMA: decompress hello world" { ); } -test "LZMA: decompress huge dict" { +test "decompress huge dict" { try testDecompressEqual( "Hello world\n", &[_]u8{ @@ -53,35 +53,35 @@ test "LZMA: decompress huge dict" { ); } -test "LZMA: unknown size with end of payload marker" { +test "unknown size with end of payload marker" { try testDecompressEqual( "Hello\nWorld!\n", @embedFile("testdata/good-unknown_size-with_eopm.lzma"), ); } -test "LZMA: known size without end of payload marker" { +test "known size without end of payload marker" { try testDecompressEqual( "Hello\nWorld!\n", @embedFile("testdata/good-known_size-without_eopm.lzma"), ); } -test "LZMA: known size with end of payload marker" { +test "known size with end of payload marker" { try testDecompressEqual( "Hello\nWorld!\n", @embedFile("testdata/good-known_size-with_eopm.lzma"), ); } -test "LZMA: too big uncompressed size in header" { +test "too big uncompressed size in header" { try testDecompressError( error.CorruptInput, @embedFile("testdata/bad-too_big_size-with_eopm.lzma"), ); } -test "LZMA: too small uncompressed size in header" { +test "too small uncompressed size in header" { try testDecompressError( error.CorruptInput, @embedFile("testdata/bad-too_small_size-without_eopm-3.lzma"), diff --git a/lib/std/compress/lzma/vec2d.zig b/lib/std/compress/lzma/vec2d.zig index 1ea3d1e8d5..df61093b85 100644 --- a/lib/std/compress/lzma/vec2d.zig +++ b/lib/std/compress/lzma/vec2d.zig @@ -49,7 +49,7 @@ const testing = std.testing; const expectEqualSlices = std.testing.expectEqualSlices; const expectError = std.testing.expectError; -test "Vec2D.init" { +test "init" { const allocator = testing.allocator; var vec2d = try Vec2D(i32).init(allocator, 1, .{ 2, 3 }); defer vec2d.deinit(allocator); @@ -58,7 +58,7 @@ test "Vec2D.init" { try expectEqualSlices(i32, &.{ 1, 1, 1 }, try vec2d.get(1)); } -test "Vec2D.init overflow" { +test "init overflow" { const allocator = testing.allocator; try expectError( error.Overflow, @@ -66,7 +66,7 @@ test "Vec2D.init overflow" { ); } -test "Vec2D.fill" { +test "fill" { const allocator = testing.allocator; var vec2d = try Vec2D(i32).init(allocator, 0, .{ 2, 3 }); defer vec2d.deinit(allocator); @@ -77,7 +77,7 @@ test "Vec2D.fill" { try expectEqualSlices(i32, &.{ 7, 7, 7 }, try vec2d.get(1)); } -test "Vec2D.get" { +test "get" { var data = [_]i32{ 0, 1, 2, 3, 4, 5, 6, 7 }; const vec2d = Vec2D(i32){ .data = &data, @@ -90,7 +90,7 @@ test "Vec2D.get" { try expectEqualSlices(i32, &.{ 6, 7 }, try vec2d.get(3)); } -test "Vec2D.getMut" { +test "getMut" { var data = [_]i32{ 0, 1, 2, 3, 4, 5, 6, 7 }; var vec2d = Vec2D(i32){ .data = &data, @@ -107,7 +107,7 @@ test "Vec2D.getMut" { try expectEqualSlices(i32, &.{ 6, 7 }, try vec2d.get(3)); } -test "Vec2D.get multiplication overflow" { +test "get multiplication overflow" { const allocator = testing.allocator; var matrix = try Vec2D(i32).init(allocator, 0, .{ 3, 4 }); defer matrix.deinit(allocator); @@ -117,7 +117,7 @@ test "Vec2D.get multiplication overflow" { try expectError(error.Overflow, matrix.getMut(row)); } -test "Vec2D.get addition overflow" { +test "get addition overflow" { const allocator = testing.allocator; var matrix = try Vec2D(i32).init(allocator, 0, .{ 3, 5 }); defer matrix.deinit(allocator); diff --git a/lib/std/compress/zstandard.zig b/lib/std/compress/zstandard.zig index cfe5618bde..ff1616e020 100644 --- a/lib/std/compress/zstandard.zig +++ b/lib/std/compress/zstandard.zig @@ -222,7 +222,7 @@ fn testReader(data: []const u8, comptime expected: []const u8) !void { try std.testing.expectEqualSlices(u8, expected, buf); } -test "zstandard decompression" { +test "decompression" { const uncompressed = @embedFile("testdata/rfc8478.txt"); const compressed3 = @embedFile("testdata/rfc8478.txt.zst.3"); const compressed19 = @embedFile("testdata/rfc8478.txt.zst.19"); @@ -239,7 +239,7 @@ test "zstandard decompression" { try std.testing.expectEqualSlices(u8, uncompressed, buffer); } -test "zstandard streaming decompression" { +test "streaming decompression" { // default stack size for wasm32 is too low for Decompressor - slightly // over 1MiB stack space is needed via the --stack CLI flag if (@import("builtin").target.cpu.arch == .wasm32) return error.SkipZigTest; diff --git a/lib/std/comptime_string_map.zig b/lib/std/comptime_string_map.zig index 6a81bb7f3c..2bfcad1e77 100644 --- a/lib/std/comptime_string_map.zig +++ b/lib/std/comptime_string_map.zig @@ -142,7 +142,7 @@ const TestEnum = enum { E, }; -test "ComptimeStringMap list literal of list literals" { +test "list literal of list literals" { const map = ComptimeStringMap(TestEnum, .{ .{ "these", .D }, .{ "have", .A }, @@ -157,7 +157,7 @@ test "ComptimeStringMap list literal of list literals" { try std.testing.expect(null == map.get("NOTHING")); } -test "ComptimeStringMap array of structs" { +test "array of structs" { const KV = struct { []const u8, TestEnum }; const map = ComptimeStringMap(TestEnum, [_]KV{ .{ "these", .D }, @@ -170,7 +170,7 @@ test "ComptimeStringMap array of structs" { try testMap(map); } -test "ComptimeStringMap slice of structs" { +test "slice of structs" { const KV = struct { []const u8, TestEnum }; const slice: []const KV = &[_]KV{ .{ "these", .D }, @@ -198,7 +198,7 @@ fn testMap(comptime map: anytype) !void { try std.testing.expect(null == map.get("averylongstringthathasnomatches")); } -test "ComptimeStringMap void value type, slice of structs" { +test "void value type, slice of structs" { const KV = struct { []const u8 }; const slice: []const KV = &[_]KV{ .{"these"}, @@ -215,7 +215,7 @@ test "ComptimeStringMap void value type, slice of structs" { try std.testing.expect(null == map.get("NOTHING")); } -test "ComptimeStringMap void value type, list literal of list literals" { +test "void value type, list literal of list literals" { const map = ComptimeStringMap(void, .{ .{"these"}, .{"have"}, @@ -258,7 +258,7 @@ test "ComptimeStringMapWithEql" { try std.testing.expect(map.has("ThESe")); } -test "ComptimeStringMap empty" { +test "empty" { const m1 = ComptimeStringMap(usize, .{}); try std.testing.expect(null == m1.get("anything")); @@ -266,7 +266,7 @@ test "ComptimeStringMap empty" { try std.testing.expect(null == m2.get("anything")); } -test "ComptimeStringMap redundant entries" { +test "redundant entries" { const map = ComptimeStringMap(TestEnum, .{ .{ "redundant", .D }, .{ "theNeedle", .A }, @@ -284,7 +284,7 @@ test "ComptimeStringMap redundant entries" { try std.testing.expectEqual(TestEnum.A, map.get("theNeedle").?); } -test "ComptimeStringMap redundant insensitive" { +test "redundant insensitive" { const map = ComptimeStringMapWithEql(TestEnum, .{ .{ "redundant", .D }, .{ "theNeedle", .A }, @@ -300,7 +300,7 @@ test "ComptimeStringMap redundant insensitive" { try std.testing.expectEqual(TestEnum.A, map.get("theNeedle").?); } -test "ComptimeStringMap comptime-only value" { +test "comptime-only value" { const map = std.ComptimeStringMap(type, .{ .{ "a", struct { pub const foo = 1; diff --git a/lib/std/crypto/25519/curve25519.zig b/lib/std/crypto/25519/curve25519.zig index 48f167922e..0b1ecbecb1 100644 --- a/lib/std/crypto/25519/curve25519.zig +++ b/lib/std/crypto/25519/curve25519.zig @@ -137,7 +137,7 @@ test "non-affine edwards25519 to curve25519 projection" { try std.testing.expectEqualSlices(u8, &xp.toBytes(), &expected); } -test "curve25519 small order check" { +test "small order check" { var s: [32]u8 = [_]u8{1} ++ [_]u8{0} ** 31; const small_order_ss: [7][32]u8 = .{ .{ diff --git a/lib/std/crypto/25519/ed25519.zig b/lib/std/crypto/25519/ed25519.zig index 65f031ada7..d7b51271d2 100644 --- a/lib/std/crypto/25519/ed25519.zig +++ b/lib/std/crypto/25519/ed25519.zig @@ -482,7 +482,7 @@ pub const Ed25519 = struct { }; }; -test "ed25519 key pair creation" { +test "key pair creation" { var seed: [32]u8 = undefined; _ = try fmt.hexToBytes(seed[0..], "8052030376d47112be7f73ed7a019293dd12ad910b654455798b4667d73de166"); const key_pair = try Ed25519.KeyPair.create(seed); @@ -491,7 +491,7 @@ test "ed25519 key pair creation" { try std.testing.expectEqualStrings(try std.fmt.bufPrint(&buf, "{s}", .{std.fmt.fmtSliceHexUpper(&key_pair.public_key.toBytes())}), "2D6F7455D97B4A3A10D7293909D1A4F2058CB9A370E43FA8154BB280DB839083"); } -test "ed25519 signature" { +test "signature" { var seed: [32]u8 = undefined; _ = try fmt.hexToBytes(seed[0..], "8052030376d47112be7f73ed7a019293dd12ad910b654455798b4667d73de166"); const key_pair = try Ed25519.KeyPair.create(seed); @@ -503,7 +503,7 @@ test "ed25519 signature" { try std.testing.expectError(error.SignatureVerificationFailed, sig.verify("TEST", key_pair.public_key)); } -test "ed25519 batch verification" { +test "batch verification" { var i: usize = 0; while (i < 100) : (i += 1) { const key_pair = try Ed25519.KeyPair.create(null); @@ -532,7 +532,7 @@ test "ed25519 batch verification" { } } -test "ed25519 test vectors" { +test "test vectors" { const Vec = struct { msg_hex: *const [64:0]u8, public_key_hex: *const [64:0]u8, @@ -634,7 +634,7 @@ test "ed25519 test vectors" { } } -test "ed25519 with blind keys" { +test "with blind keys" { const BlindKeyPair = Ed25519.key_blinding.BlindKeyPair; // Create a standard Ed25519 key pair @@ -657,7 +657,7 @@ test "ed25519 with blind keys" { try std.testing.expectEqualSlices(u8, &pk.toBytes(), &kp.public_key.toBytes()); } -test "ed25519 signatures with streaming" { +test "signatures with streaming" { const kp = try Ed25519.KeyPair.create(null); var signer = try kp.signer(null); @@ -673,7 +673,7 @@ test "ed25519 signatures with streaming" { try verifier.verify(); } -test "ed25519 key pair from secret key" { +test "key pair from secret key" { const kp = try Ed25519.KeyPair.create(null); const kp2 = try Ed25519.KeyPair.fromSecretKey(kp.secret_key); try std.testing.expectEqualSlices(u8, &kp.secret_key.toBytes(), &kp2.secret_key.toBytes()); diff --git a/lib/std/crypto/25519/edwards25519.zig b/lib/std/crypto/25519/edwards25519.zig index 0d42073705..e00ca61697 100644 --- a/lib/std/crypto/25519/edwards25519.zig +++ b/lib/std/crypto/25519/edwards25519.zig @@ -493,7 +493,7 @@ pub const Edwards25519 = struct { const htest = @import("../test.zig"); -test "edwards25519 packing/unpacking" { +test "packing/unpacking" { const s = [_]u8{170} ++ [_]u8{0} ** 31; var b = Edwards25519.basePoint; const pk = try b.mul(s); @@ -529,7 +529,7 @@ test "edwards25519 packing/unpacking" { } } -test "edwards25519 point addition/subtraction" { +test "point addition/subtraction" { var s1: [32]u8 = undefined; var s2: [32]u8 = undefined; crypto.random.bytes(&s1); @@ -543,7 +543,7 @@ test "edwards25519 point addition/subtraction" { try std.testing.expectError(error.IdentityElement, p.sub(q).add(q).sub(p).rejectIdentity()); } -test "edwards25519 uniform-to-point" { +test "uniform-to-point" { var r = [32]u8{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31 }; var p = Edwards25519.fromUniform(r); try htest.assertEqual("0691eee3cf70a0056df6bfa03120635636581b5c4ea571dfc680f78c7e0b4137", p.toBytes()[0..]); @@ -554,7 +554,7 @@ test "edwards25519 uniform-to-point" { } // Test vectors from draft-irtf-cfrg-hash-to-curve-12 -test "edwards25519 hash-to-curve operation" { +test "hash-to-curve operation" { var p = Edwards25519.fromString(true, "QUUX-V01-CS02-with-edwards25519_XMD:SHA-512_ELL2_RO_", "abc"); try htest.assertEqual("31558a26887f23fb8218f143e69d5f0af2e7831130bd5b432ef23883b895839a", p.toBytes()[0..]); @@ -562,7 +562,7 @@ test "edwards25519 hash-to-curve operation" { try htest.assertEqual("42fa27c8f5a1ae0aa38bb59d5938e5145622ba5dedd11d11736fa2f9502d7367", p.toBytes()[0..]); } -test "edwards25519 implicit reduction of invalid scalars" { +test "implicit reduction of invalid scalars" { const s = [_]u8{0} ** 31 ++ [_]u8{255}; const p1 = try Edwards25519.basePoint.mulPublic(s); const p2 = try Edwards25519.basePoint.mul(s); diff --git a/lib/std/crypto/25519/x25519.zig b/lib/std/crypto/25519/x25519.zig index b746a51968..8bd5101b37 100644 --- a/lib/std/crypto/25519/x25519.zig +++ b/lib/std/crypto/25519/x25519.zig @@ -81,7 +81,7 @@ pub const X25519 = struct { const htest = @import("../test.zig"); -test "x25519 public key calculation from secret key" { +test "public key calculation from secret key" { var sk: [32]u8 = undefined; var pk_expected: [32]u8 = undefined; _ = try fmt.hexToBytes(sk[0..], "8052030376d47112be7f73ed7a019293dd12ad910b654455798b4667d73de166"); @@ -90,7 +90,7 @@ test "x25519 public key calculation from secret key" { try std.testing.expectEqual(pk_calculated, pk_expected); } -test "x25519 rfc7748 vector1" { +test "rfc7748 vector1" { const secret_key = [32]u8{ 0xa5, 0x46, 0xe3, 0x6b, 0xf0, 0x52, 0x7c, 0x9d, 0x3b, 0x16, 0x15, 0x4b, 0x82, 0x46, 0x5e, 0xdd, 0x62, 0x14, 0x4c, 0x0a, 0xc1, 0xfc, 0x5a, 0x18, 0x50, 0x6a, 0x22, 0x44, 0xba, 0x44, 0x9a, 0xc4 }; const public_key = [32]u8{ 0xe6, 0xdb, 0x68, 0x67, 0x58, 0x30, 0x30, 0xdb, 0x35, 0x94, 0xc1, 0xa4, 0x24, 0xb1, 0x5f, 0x7c, 0x72, 0x66, 0x24, 0xec, 0x26, 0xb3, 0x35, 0x3b, 0x10, 0xa9, 0x03, 0xa6, 0xd0, 0xab, 0x1c, 0x4c }; @@ -100,7 +100,7 @@ test "x25519 rfc7748 vector1" { try std.testing.expectEqual(output, expected_output); } -test "x25519 rfc7748 vector2" { +test "rfc7748 vector2" { const secret_key = [32]u8{ 0x4b, 0x66, 0xe9, 0xd4, 0xd1, 0xb4, 0x67, 0x3c, 0x5a, 0xd2, 0x26, 0x91, 0x95, 0x7d, 0x6a, 0xf5, 0xc1, 0x1b, 0x64, 0x21, 0xe0, 0xea, 0x01, 0xd4, 0x2c, 0xa4, 0x16, 0x9e, 0x79, 0x18, 0xba, 0x0d }; const public_key = [32]u8{ 0xe5, 0x21, 0x0f, 0x12, 0x78, 0x68, 0x11, 0xd3, 0xf4, 0xb7, 0x95, 0x9d, 0x05, 0x38, 0xae, 0x2c, 0x31, 0xdb, 0xe7, 0x10, 0x6f, 0xc0, 0x3c, 0x3e, 0xfc, 0x4c, 0xd5, 0x49, 0xc7, 0x15, 0xa4, 0x93 }; @@ -110,7 +110,7 @@ test "x25519 rfc7748 vector2" { try std.testing.expectEqual(output, expected_output); } -test "x25519 rfc7748 one iteration" { +test "rfc7748 one iteration" { const initial_value = [32]u8{ 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; const expected_output = [32]u8{ 0x42, 0x2c, 0x8e, 0x7a, 0x62, 0x27, 0xd7, 0xbc, 0xa1, 0x35, 0x0b, 0x3e, 0x2b, 0xb7, 0x27, 0x9f, 0x78, 0x97, 0xb8, 0x7b, 0xb6, 0x85, 0x4b, 0x78, 0x3c, 0x60, 0xe8, 0x03, 0x11, 0xae, 0x30, 0x79 }; @@ -127,7 +127,7 @@ test "x25519 rfc7748 one iteration" { try std.testing.expectEqual(k, expected_output); } -test "x25519 rfc7748 1,000 iterations" { +test "rfc7748 1,000 iterations" { // These iteration tests are slow so we always skip them. Results have been verified. if (true) { return error.SkipZigTest; @@ -149,7 +149,7 @@ test "x25519 rfc7748 1,000 iterations" { try std.testing.expectEqual(k, expected_output); } -test "x25519 rfc7748 1,000,000 iterations" { +test "rfc7748 1,000,000 iterations" { if (true) { return error.SkipZigTest; } diff --git a/lib/std/crypto/chacha20.zig b/lib/std/crypto/chacha20.zig index 7e0c891747..925fc0bfa6 100644 --- a/lib/std/crypto/chacha20.zig +++ b/lib/std/crypto/chacha20.zig @@ -758,7 +758,7 @@ fn XChaChaPoly1305(comptime rounds_nb: usize) type { }; } -test "chacha20 AEAD API" { +test "AEAD API" { const aeads = [_]type{ ChaCha20Poly1305, XChaCha20Poly1305 }; const m = "Ladies and Gentlemen of the class of '99: If I could offer you only one tip for the future, sunscreen would be it."; const ad = "Additional data"; @@ -779,7 +779,7 @@ test "chacha20 AEAD API" { } // https://tools.ietf.org/html/rfc7539#section-2.4.2 -test "crypto.chacha20 test vector sunscreen" { +test "test vector sunscreen" { const expected_result = [_]u8{ 0x6e, 0x2e, 0x35, 0x9a, 0x25, 0x68, 0xf9, 0x80, 0x41, 0xba, 0x07, 0x28, 0xdd, 0x0d, 0x69, 0x81, @@ -820,7 +820,7 @@ test "crypto.chacha20 test vector sunscreen" { } // https://tools.ietf.org/html/draft-agl-tls-chacha20poly1305-04#section-7 -test "crypto.chacha20 test vector 1" { +test "test vector 1" { const expected_result = [_]u8{ 0x76, 0xb8, 0xe0, 0xad, 0xa0, 0xf1, 0x3d, 0x90, 0x40, 0x5d, 0x6a, 0xe5, 0x53, 0x86, 0xbd, 0x28, @@ -854,7 +854,7 @@ test "crypto.chacha20 test vector 1" { try testing.expectEqualSlices(u8, &expected_result, &result); } -test "crypto.chacha20 test vector 2" { +test "test vector 2" { const expected_result = [_]u8{ 0x45, 0x40, 0xf0, 0x5a, 0x9f, 0x1f, 0xb2, 0x96, 0xd7, 0x73, 0x6e, 0x7b, 0x20, 0x8e, 0x3c, 0x96, @@ -888,7 +888,7 @@ test "crypto.chacha20 test vector 2" { try testing.expectEqualSlices(u8, &expected_result, &result); } -test "crypto.chacha20 test vector 3" { +test "test vector 3" { const expected_result = [_]u8{ 0xde, 0x9c, 0xba, 0x7b, 0xf3, 0xd6, 0x9e, 0xf5, 0xe7, 0x86, 0xdc, 0x63, 0x97, 0x3f, 0x65, 0x3a, @@ -922,7 +922,7 @@ test "crypto.chacha20 test vector 3" { try testing.expectEqualSlices(u8, &expected_result, &result); } -test "crypto.chacha20 test vector 4" { +test "test vector 4" { const expected_result = [_]u8{ 0xef, 0x3f, 0xdf, 0xd6, 0xc6, 0x15, 0x78, 0xfb, 0xf5, 0xcf, 0x35, 0xbd, 0x3d, 0xd3, 0x3b, 0x80, @@ -956,7 +956,7 @@ test "crypto.chacha20 test vector 4" { try testing.expectEqualSlices(u8, &expected_result, &result); } -test "crypto.chacha20 test vector 5" { +test "test vector 5" { const expected_result = [_]u8{ 0xf7, 0x98, 0xa1, 0x89, 0xf1, 0x95, 0xe6, 0x69, 0x82, 0x10, 0x5f, 0xfb, 0x64, 0x0b, 0xb7, 0x75, @@ -1142,7 +1142,7 @@ test "open" { } } -test "crypto.xchacha20" { +test "xchacha20" { const key = [_]u8{69} ** 32; const nonce = [_]u8{42} ** 24; const m = "Ladies and Gentlemen of the class of '99: If I could offer you only one tip for the future, sunscreen would be it."; diff --git a/lib/std/crypto/ecdsa.zig b/lib/std/crypto/ecdsa.zig index 7c4df6e35d..70362470c3 100644 --- a/lib/std/crypto/ecdsa.zig +++ b/lib/std/crypto/ecdsa.zig @@ -371,7 +371,7 @@ pub fn Ecdsa(comptime Curve: type, comptime Hash: type) type { }; } -test "ECDSA - Basic operations over EcdsaP384Sha384" { +test "Basic operations over EcdsaP384Sha384" { if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; const Scheme = EcdsaP384Sha384; @@ -387,7 +387,7 @@ test "ECDSA - Basic operations over EcdsaP384Sha384" { try sig2.verify(msg, kp.public_key); } -test "ECDSA - Basic operations over Secp256k1" { +test "Basic operations over Secp256k1" { if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; const Scheme = EcdsaSecp256k1Sha256oSha256; @@ -403,7 +403,7 @@ test "ECDSA - Basic operations over Secp256k1" { try sig2.verify(msg, kp.public_key); } -test "ECDSA - Basic operations over EcdsaP384Sha256" { +test "Basic operations over EcdsaP384Sha256" { if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; const Scheme = Ecdsa(crypto.ecc.P384, crypto.hash.sha2.Sha256); @@ -419,7 +419,7 @@ test "ECDSA - Basic operations over EcdsaP384Sha256" { try sig2.verify(msg, kp.public_key); } -test "ECDSA - Verifying a existing signature with EcdsaP384Sha256" { +test "Verifying a existing signature with EcdsaP384Sha256" { if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; const Scheme = Ecdsa(crypto.ecc.P384, crypto.hash.sha2.Sha256); @@ -463,7 +463,7 @@ const TestVector = struct { result: enum { valid, invalid, acceptable }, }; -test "ECDSA - Test vectors from Project Wycheproof" { +test "Test vectors from Project Wycheproof" { if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; const vectors = [_]TestVector{ @@ -877,7 +877,7 @@ fn tvTry(vector: TestVector) !void { try sig.verify(msg, pk); } -test "ECDSA - Sec1 encoding/decoding" { +test "Sec1 encoding/decoding" { if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; const Scheme = EcdsaP384Sha384; diff --git a/lib/std/crypto/hmac.zig b/lib/std/crypto/hmac.zig index 8d0daa3032..b87d65edb3 100644 --- a/lib/std/crypto/hmac.zig +++ b/lib/std/crypto/hmac.zig @@ -76,7 +76,7 @@ pub fn Hmac(comptime Hash: type) type { const htest = @import("test.zig"); -test "hmac md5" { +test "md5" { var out: [HmacMd5.mac_length]u8 = undefined; HmacMd5.create(out[0..], "", ""); try htest.assertEqual("74e6f7298a9c2d168935f58c001bad88", out[0..]); @@ -85,7 +85,7 @@ test "hmac md5" { try htest.assertEqual("80070713463e7749b90c2dc24911e275", out[0..]); } -test "hmac sha1" { +test "sha1" { var out: [HmacSha1.mac_length]u8 = undefined; HmacSha1.create(out[0..], "", ""); try htest.assertEqual("fbdb1d1b18aa6c08324b7d64b71fb76370690e1d", out[0..]); @@ -94,7 +94,7 @@ test "hmac sha1" { try htest.assertEqual("de7c9b85b8b78aa6bc8a7a36f70a90701c9db4d9", out[0..]); } -test "hmac sha256" { +test "sha256" { var out: [sha2.HmacSha256.mac_length]u8 = undefined; sha2.HmacSha256.create(out[0..], "", ""); try htest.assertEqual("b613679a0814d9ec772f95d778c35fc5ff1697c493715653c6c712144292c5ad", out[0..]); diff --git a/lib/std/crypto/md5.zig b/lib/std/crypto/md5.zig index 2fcdbbcc8c..92c8dac796 100644 --- a/lib/std/crypto/md5.zig +++ b/lib/std/crypto/md5.zig @@ -232,7 +232,7 @@ pub const Md5 = struct { const htest = @import("test.zig"); -test "md5 single" { +test "single" { try htest.assertEqualHash(Md5, "d41d8cd98f00b204e9800998ecf8427e", ""); try htest.assertEqualHash(Md5, "0cc175b9c0f1b6a831c399e269772661", "a"); try htest.assertEqualHash(Md5, "900150983cd24fb0d6963f7d28e17f72", "abc"); @@ -242,7 +242,7 @@ test "md5 single" { try htest.assertEqualHash(Md5, "57edf4a22be3c955ac49da2e2107b67a", "12345678901234567890123456789012345678901234567890123456789012345678901234567890"); } -test "md5 streaming" { +test "streaming" { var h = Md5.init(.{}); var out: [16]u8 = undefined; @@ -263,7 +263,7 @@ test "md5 streaming" { try htest.assertEqual("900150983cd24fb0d6963f7d28e17f72", out[0..]); } -test "md5 aligned final" { +test "aligned final" { var block = [_]u8{0} ** Md5.block_length; var out: [Md5.digest_length]u8 = undefined; diff --git a/lib/std/crypto/poly1305.zig b/lib/std/crypto/poly1305.zig index d9fd344c19..4db3816266 100644 --- a/lib/std/crypto/poly1305.zig +++ b/lib/std/crypto/poly1305.zig @@ -195,7 +195,7 @@ pub const Poly1305 = struct { } }; -test "poly1305 rfc7439 vector1" { +test "rfc7439 vector1" { const expected_mac = "\xa8\x06\x1d\xc1\x30\x51\x36\xc6\xc2\x2b\x8b\xaf\x0c\x01\x27\xa9"; const msg = "Cryptographic Forum Research Group"; @@ -208,7 +208,7 @@ test "poly1305 rfc7439 vector1" { try std.testing.expectEqualSlices(u8, expected_mac, &mac); } -test "poly1305 requiring a final reduction" { +test "requiring a final reduction" { const expected_mac = [_]u8{ 25, 13, 249, 42, 164, 57, 99, 60, 149, 181, 74, 74, 13, 63, 121, 6 }; const msg = [_]u8{ 253, 193, 249, 146, 70, 6, 214, 226, 131, 213, 241, 116, 20, 24, 210, 224, 65, 151, 255, 104, 133 }; const key = [_]u8{ 190, 63, 95, 57, 155, 103, 77, 170, 7, 98, 106, 44, 117, 186, 90, 185, 109, 118, 184, 24, 69, 41, 166, 243, 119, 132, 151, 61, 52, 43, 64, 250 }; diff --git a/lib/std/crypto/utils.zig b/lib/std/crypto/utils.zig index 85e0730a44..37f2b06a5e 100644 --- a/lib/std/crypto/utils.zig +++ b/lib/std/crypto/utils.zig @@ -138,7 +138,7 @@ pub inline fn secureZero(comptime T: type, s: []T) void { @memset(@as([]volatile T, s), 0); } -test "crypto.utils.timingSafeEql" { +test "timingSafeEql" { var a: [100]u8 = undefined; var b: [100]u8 = undefined; random.bytes(a[0..]); @@ -148,7 +148,7 @@ test "crypto.utils.timingSafeEql" { try testing.expect(timingSafeEql([100]u8, a, b)); } -test "crypto.utils.timingSafeEql (vectors)" { +test "timingSafeEql (vectors)" { if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; var a: [100]u8 = undefined; @@ -162,7 +162,7 @@ test "crypto.utils.timingSafeEql (vectors)" { try testing.expect(timingSafeEql(@Vector(100, u8), v1, v3)); } -test "crypto.utils.timingSafeCompare" { +test "timingSafeCompare" { var a = [_]u8{10} ** 32; var b = [_]u8{10} ** 32; try testing.expectEqual(timingSafeCompare(u8, &a, &b, .big), .eq); @@ -175,7 +175,7 @@ test "crypto.utils.timingSafeCompare" { try testing.expectEqual(timingSafeCompare(u8, &a, &b, .little), .lt); } -test "crypto.utils.timingSafe{Add,Sub}" { +test "timingSafe{Add,Sub}" { const len = 32; var a: [len]u8 = undefined; var b: [len]u8 = undefined; @@ -195,7 +195,7 @@ test "crypto.utils.timingSafe{Add,Sub}" { } } -test "crypto.utils.secureZero" { +test "secureZero" { var a = [_]u8{0xfe} ** 8; var b = [_]u8{0xfe} ** 8; diff --git a/lib/std/enums.zig b/lib/std/enums.zig index 872b752a40..f992276431 100644 --- a/lib/std/enums.zig +++ b/lib/std/enums.zig @@ -120,7 +120,7 @@ pub fn directEnumArray( return directEnumArrayDefault(E, Data, null, max_unused_slots, init_values); } -test "std.enums.directEnumArray" { +test "directEnumArray" { const E = enum(i4) { a = 4, b = 6, c = 2 }; var runtime_false: bool = false; _ = &runtime_false; @@ -163,7 +163,7 @@ pub fn directEnumArrayDefault( return result; } -test "std.enums.directEnumArrayDefault" { +test "directEnumArrayDefault" { const E = enum(i4) { a = 4, b = 6, c = 2 }; var runtime_false: bool = false; _ = &runtime_false; @@ -178,7 +178,7 @@ test "std.enums.directEnumArrayDefault" { try testing.expectEqual(false, array[2]); } -test "std.enums.directEnumArrayDefault slice" { +test "directEnumArrayDefault slice" { const E = enum(i4) { a = 4, b = 6, c = 2 }; var runtime_b = "b"; _ = &runtime_b; @@ -214,7 +214,7 @@ pub fn nameCast(comptime E: type, comptime value: anytype) E { }; } -test "std.enums.nameCast" { +test "nameCast" { const A = enum(u1) { a = 0, b = 1 }; const B = enum(u1) { a = 1, b = 0 }; try testing.expectEqual(A.a, nameCast(A, .a)); @@ -983,7 +983,7 @@ test "pure EnumSet fns" { try testing.expect(full.differenceWith(black).eql(red)); } -test "std.enums.EnumSet empty" { +test "EnumSet empty" { const E = enum {}; const empty = EnumSet(E).initEmpty(); const full = EnumSet(E).initFull(); @@ -994,7 +994,7 @@ test "std.enums.EnumSet empty" { try std.testing.expect(empty.eql(full.complement())); } -test "std.enums.EnumSet const iterator" { +test "EnumSet const iterator" { const Direction = enum { up, down, left, right }; const diag_move = init: { var move = EnumSet(Direction).initEmpty(); @@ -1298,7 +1298,7 @@ pub fn ensureIndexer(comptime T: type) void { } } -test "std.enums.ensureIndexer" { +test "ensureIndexer" { ensureIndexer(struct { pub const Key = u32; pub const count: comptime_int = 8; @@ -1463,7 +1463,7 @@ test "EnumIndexer non-exhaustive" { } } -test "std.enums.EnumIndexer dense zeroed" { +test "EnumIndexer dense zeroed" { const E = enum(u2) { b = 1, a = 0, c = 2 }; const Indexer = EnumIndexer(E); ensureIndexer(Indexer); @@ -1479,7 +1479,7 @@ test "std.enums.EnumIndexer dense zeroed" { try testing.expectEqual(E.c, Indexer.keyForIndex(2)); } -test "std.enums.EnumIndexer dense positive" { +test "EnumIndexer dense positive" { const E = enum(u4) { c = 6, a = 4, b = 5 }; const Indexer = EnumIndexer(E); ensureIndexer(Indexer); @@ -1495,7 +1495,7 @@ test "std.enums.EnumIndexer dense positive" { try testing.expectEqual(E.c, Indexer.keyForIndex(2)); } -test "std.enums.EnumIndexer dense negative" { +test "EnumIndexer dense negative" { const E = enum(i4) { a = -6, c = -4, b = -5 }; const Indexer = EnumIndexer(E); ensureIndexer(Indexer); @@ -1511,7 +1511,7 @@ test "std.enums.EnumIndexer dense negative" { try testing.expectEqual(E.c, Indexer.keyForIndex(2)); } -test "std.enums.EnumIndexer sparse" { +test "EnumIndexer sparse" { const E = enum(i4) { a = -2, c = 6, b = 4 }; const Indexer = EnumIndexer(E); ensureIndexer(Indexer); @@ -1527,7 +1527,7 @@ test "std.enums.EnumIndexer sparse" { try testing.expectEqual(E.c, Indexer.keyForIndex(2)); } -test "std.enums.EnumIndexer empty" { +test "EnumIndexer empty" { const E = enum {}; const Indexer = EnumIndexer(E); ensureIndexer(Indexer); diff --git a/lib/std/fmt/parse_float.zig b/lib/std/fmt/parse_float.zig index d2589b8ff1..2f75e83966 100644 --- a/lib/std/fmt/parse_float.zig +++ b/lib/std/fmt/parse_float.zig @@ -12,7 +12,7 @@ const epsilon = 1e-7; // See https://github.com/tiehuis/parse-number-fxx-test-data for a wider-selection of test-data. -test "fmt.parseFloat" { +test "parseFloat" { inline for ([_]type{ f16, f32, f64, f128 }) |T| { try testing.expectError(error.InvalidCharacter, parseFloat(T, "")); try testing.expectError(error.InvalidCharacter, parseFloat(T, " 1")); @@ -68,7 +68,7 @@ test "fmt.parseFloat" { } } -test "fmt.parseFloat nan and inf" { +test "nan and inf" { inline for ([_]type{ f16, f32, f64, f128 }) |T| { const Z = std.meta.Int(.unsigned, @typeInfo(T).Float.bits); @@ -78,24 +78,24 @@ test "fmt.parseFloat nan and inf" { } } -test "fmt.parseFloat largest normals" { +test "largest normals" { try expectEqual(@as(u16, @bitCast(try parseFloat(f16, "65504"))), 0x7bff); try expectEqual(@as(u32, @bitCast(try parseFloat(f32, "3.4028234664E38"))), 0x7f7f_ffff); try expectEqual(@as(u64, @bitCast(try parseFloat(f64, "1.7976931348623157E308"))), 0x7fef_ffff_ffff_ffff); try expectEqual(@as(u128, @bitCast(try parseFloat(f128, "1.1897314953572317650857593266280070162E4932"))), 0x7ffe_ffff_ffff_ffff_ffff_ffff_ffff_ffff); } -test "fmt.parseFloat #11169" { +test "#11169" { try expectEqual(try parseFloat(f128, "9007199254740993.0"), 9007199254740993.0); } -test "fmt.parseFloat hex.special" { +test "hex.special" { try testing.expect(math.isNan(try parseFloat(f32, "nAn"))); try testing.expect(math.isPositiveInf(try parseFloat(f32, "iNf"))); try testing.expect(math.isPositiveInf(try parseFloat(f32, "+Inf"))); try testing.expect(math.isNegativeInf(try parseFloat(f32, "-iNf"))); } -test "fmt.parseFloat hex.zero" { +test "hex.zero" { try testing.expectEqual(@as(f32, 0.0), try parseFloat(f32, "0x0")); try testing.expectEqual(@as(f32, 0.0), try parseFloat(f32, "-0x0")); try testing.expectEqual(@as(f32, 0.0), try parseFloat(f32, "0x0p42")); @@ -103,7 +103,7 @@ test "fmt.parseFloat hex.zero" { try testing.expectEqual(@as(f32, 0.0), try parseFloat(f32, "0x0.00000p666")); } -test "fmt.parseFloat hex.f16" { +test "hex.f16" { try testing.expectEqual(try parseFloat(f16, "0x1p0"), 1.0); try testing.expectEqual(try parseFloat(f16, "-0x1p-1"), -0.5); try testing.expectEqual(try parseFloat(f16, "0x10p+10"), 16384.0); @@ -119,7 +119,7 @@ test "fmt.parseFloat hex.f16" { try testing.expectEqual(try parseFloat(f16, "-0x1p-24"), -math.floatTrueMin(f16)); } -test "fmt.parseFloat hex.f32" { +test "hex.f32" { try testing.expectError(error.InvalidCharacter, parseFloat(f32, "0x")); try testing.expectEqual(try parseFloat(f32, "0x1p0"), 1.0); try testing.expectEqual(try parseFloat(f32, "-0x1p-1"), -0.5); @@ -138,7 +138,7 @@ test "fmt.parseFloat hex.f32" { try testing.expectEqual(try parseFloat(f32, "-0x1P-149"), -math.floatTrueMin(f32)); } -test "fmt.parseFloat hex.f64" { +test "hex.f64" { try testing.expectEqual(try parseFloat(f64, "0x1p0"), 1.0); try testing.expectEqual(try parseFloat(f64, "-0x1p-1"), -0.5); try testing.expectEqual(try parseFloat(f64, "0x10p+10"), 16384.0); @@ -153,7 +153,7 @@ test "fmt.parseFloat hex.f64" { try testing.expectEqual(try parseFloat(f64, "0x1p-1074"), math.floatTrueMin(f64)); try testing.expectEqual(try parseFloat(f64, "-0x1p-1074"), -math.floatTrueMin(f64)); } -test "fmt.parseFloat hex.f128" { +test "hex.f128" { try testing.expectEqual(try parseFloat(f128, "0x1p0"), 1.0); try testing.expectEqual(try parseFloat(f128, "-0x1p-1"), -0.5); try testing.expectEqual(try parseFloat(f128, "0x10p+10"), 16384.0); diff --git a/lib/std/hash_map.zig b/lib/std/hash_map.zig index 7db2c40559..1ee225c4af 100644 --- a/lib/std/hash_map.zig +++ b/lib/std/hash_map.zig @@ -1612,7 +1612,7 @@ const testing = std.testing; const expect = std.testing.expect; const expectEqual = std.testing.expectEqual; -test "std.hash_map basic usage" { +test "basic usage" { var map = AutoHashMap(u32, u32).init(std.testing.allocator); defer map.deinit(); @@ -1640,7 +1640,7 @@ test "std.hash_map basic usage" { try expectEqual(total, sum); } -test "std.hash_map ensureTotalCapacity" { +test "ensureTotalCapacity" { var map = AutoHashMap(i32, i32).init(std.testing.allocator); defer map.deinit(); @@ -1655,7 +1655,7 @@ test "std.hash_map ensureTotalCapacity" { try testing.expect(initial_capacity == map.capacity()); } -test "std.hash_map ensureUnusedCapacity with tombstones" { +test "ensureUnusedCapacity with tombstones" { var map = AutoHashMap(i32, i32).init(std.testing.allocator); defer map.deinit(); @@ -1667,7 +1667,7 @@ test "std.hash_map ensureUnusedCapacity with tombstones" { } } -test "std.hash_map clearRetainingCapacity" { +test "clearRetainingCapacity" { var map = AutoHashMap(u32, u32).init(std.testing.allocator); defer map.deinit(); @@ -1692,7 +1692,7 @@ test "std.hash_map clearRetainingCapacity" { try expect(!map.contains(1)); } -test "std.hash_map grow" { +test "grow" { var map = AutoHashMap(u32, u32).init(std.testing.allocator); defer map.deinit(); @@ -1718,7 +1718,7 @@ test "std.hash_map grow" { } } -test "std.hash_map clone" { +test "clone" { var map = AutoHashMap(u32, u32).init(std.testing.allocator); defer map.deinit(); @@ -1756,7 +1756,7 @@ test "std.hash_map clone" { } } -test "std.hash_map ensureTotalCapacity with existing elements" { +test "ensureTotalCapacity with existing elements" { var map = AutoHashMap(u32, u32).init(std.testing.allocator); defer map.deinit(); @@ -1769,7 +1769,7 @@ test "std.hash_map ensureTotalCapacity with existing elements" { try expectEqual(map.capacity(), 128); } -test "std.hash_map ensureTotalCapacity satisfies max load factor" { +test "ensureTotalCapacity satisfies max load factor" { var map = AutoHashMap(u32, u32).init(std.testing.allocator); defer map.deinit(); @@ -1777,7 +1777,7 @@ test "std.hash_map ensureTotalCapacity satisfies max load factor" { try expectEqual(map.capacity(), 256); } -test "std.hash_map remove" { +test "remove" { var map = AutoHashMap(u32, u32).init(std.testing.allocator); defer map.deinit(); @@ -1809,7 +1809,7 @@ test "std.hash_map remove" { } } -test "std.hash_map reverse removes" { +test "reverse removes" { var map = AutoHashMap(u32, u32).init(std.testing.allocator); defer map.deinit(); @@ -1831,7 +1831,7 @@ test "std.hash_map reverse removes" { try expectEqual(map.count(), 0); } -test "std.hash_map multiple removes on same metadata" { +test "multiple removes on same metadata" { var map = AutoHashMap(u32, u32).init(std.testing.allocator); defer map.deinit(); @@ -1868,7 +1868,7 @@ test "std.hash_map multiple removes on same metadata" { } } -test "std.hash_map put and remove loop in random order" { +test "put and remove loop in random order" { var map = AutoHashMap(u32, u32).init(std.testing.allocator); defer map.deinit(); @@ -1900,7 +1900,7 @@ test "std.hash_map put and remove loop in random order" { } } -test "std.hash_map remove one million elements in random order" { +test "remove one million elements in random order" { const Map = AutoHashMap(u32, u32); const n = 1000 * 1000; var map = Map.init(std.heap.page_allocator); @@ -1930,7 +1930,7 @@ test "std.hash_map remove one million elements in random order" { } } -test "std.hash_map put" { +test "put" { var map = AutoHashMap(u32, u32).init(std.testing.allocator); defer map.deinit(); @@ -1955,7 +1955,7 @@ test "std.hash_map put" { } } -test "std.hash_map putAssumeCapacity" { +test "putAssumeCapacity" { var map = AutoHashMap(u32, u32).init(std.testing.allocator); defer map.deinit(); @@ -1985,7 +1985,7 @@ test "std.hash_map putAssumeCapacity" { try expectEqual(sum, 20); } -test "std.hash_map repeat putAssumeCapacity/remove" { +test "repeat putAssumeCapacity/remove" { var map = AutoHashMap(u32, u32).init(std.testing.allocator); defer map.deinit(); @@ -2017,7 +2017,7 @@ test "std.hash_map repeat putAssumeCapacity/remove" { try expectEqual(map.unmanaged.count(), limit); } -test "std.hash_map getOrPut" { +test "getOrPut" { var map = AutoHashMap(u32, u32).init(std.testing.allocator); defer map.deinit(); @@ -2040,7 +2040,7 @@ test "std.hash_map getOrPut" { try expectEqual(sum, 30); } -test "std.hash_map basic hash map usage" { +test "basic hash map usage" { var map = AutoHashMap(i32, i32).init(std.testing.allocator); defer map.deinit(); @@ -2085,7 +2085,7 @@ test "std.hash_map basic hash map usage" { try testing.expect(map.remove(3) == true); } -test "std.hash_map getOrPutAdapted" { +test "getOrPutAdapted" { const AdaptedContext = struct { fn eql(self: @This(), adapted_key: []const u8, test_key: u64) bool { _ = self; @@ -2134,7 +2134,7 @@ test "std.hash_map getOrPutAdapted" { } } -test "std.hash_map ensureUnusedCapacity" { +test "ensureUnusedCapacity" { var map = AutoHashMap(u64, u64).init(testing.allocator); defer map.deinit(); @@ -2147,7 +2147,7 @@ test "std.hash_map ensureUnusedCapacity" { try testing.expectEqual(capacity, map.capacity()); } -test "std.hash_map removeByPtr" { +test "removeByPtr" { var map = AutoHashMap(i32, u64).init(testing.allocator); defer map.deinit(); @@ -2173,7 +2173,7 @@ test "std.hash_map removeByPtr" { try testing.expect(map.count() == 0); } -test "std.hash_map removeByPtr 0 sized key" { +test "removeByPtr 0 sized key" { var map = AutoHashMap(u0, u64).init(testing.allocator); defer map.deinit(); @@ -2191,7 +2191,7 @@ test "std.hash_map removeByPtr 0 sized key" { try testing.expect(map.count() == 0); } -test "std.hash_map repeat fetchRemove" { +test "repeat fetchRemove" { var map = AutoHashMapUnmanaged(u64, void){}; defer map.deinit(testing.allocator); diff --git a/lib/std/heap/arena_allocator.zig b/lib/std/heap/arena_allocator.zig index bde62ce8c2..8ba3cc9826 100644 --- a/lib/std/heap/arena_allocator.zig +++ b/lib/std/heap/arena_allocator.zig @@ -246,7 +246,7 @@ pub const ArenaAllocator = struct { } }; -test "ArenaAllocator (reset with preheating)" { +test "reset with preheating" { var arena_allocator = ArenaAllocator.init(std.testing.allocator); defer arena_allocator.deinit(); // provides some variance in the allocated data @@ -269,7 +269,7 @@ test "ArenaAllocator (reset with preheating)" { } } -test "ArenaAllocator (reset while retaining a buffer)" { +test "reset while retaining a buffer" { var arena_allocator = ArenaAllocator.init(std.testing.allocator); defer arena_allocator.deinit(); const a = arena_allocator.allocator(); diff --git a/lib/std/heap/memory_pool.zig b/lib/std/heap/memory_pool.zig index 01adde470b..5bfc4a60f6 100644 --- a/lib/std/heap/memory_pool.zig +++ b/lib/std/heap/memory_pool.zig @@ -145,7 +145,7 @@ pub fn MemoryPoolExtra(comptime Item: type, comptime pool_options: Options) type }; } -test "memory pool: basic" { +test "basic" { var pool = MemoryPool(u32).init(std.testing.allocator); defer pool.deinit(); @@ -165,7 +165,7 @@ test "memory pool: basic" { try std.testing.expect(p2 == p4); } -test "memory pool: preheating (success)" { +test "preheating (success)" { var pool = try MemoryPool(u32).initPreheated(std.testing.allocator, 4); defer pool.deinit(); @@ -174,12 +174,12 @@ test "memory pool: preheating (success)" { _ = try pool.create(); } -test "memory pool: preheating (failure)" { +test "preheating (failure)" { const failer = std.testing.failing_allocator; try std.testing.expectError(error.OutOfMemory, MemoryPool(u32).initPreheated(failer, 5)); } -test "memory pool: growable" { +test "growable" { var pool = try MemoryPoolExtra(u32, .{ .growable = false }).initPreheated(std.testing.allocator, 4); defer pool.deinit(); @@ -191,7 +191,7 @@ test "memory pool: growable" { try std.testing.expectError(error.OutOfMemory, pool.create()); } -test "memory pool: greater than pointer default alignment" { +test "greater than pointer default alignment" { const Foo = struct { data: u64 align(16), }; @@ -203,7 +203,7 @@ test "memory pool: greater than pointer default alignment" { _ = foo; } -test "memory pool: greater than pointer manual alignment" { +test "greater than pointer manual alignment" { const Foo = struct { data: u64, }; diff --git a/lib/std/io/Reader/test.zig b/lib/std/io/Reader/test.zig index 166a94fbcf..e92d1ec4db 100644 --- a/lib/std/io/Reader/test.zig +++ b/lib/std/io/Reader/test.zig @@ -15,14 +15,14 @@ test "Reader" { try testing.expectError(error.EndOfStream, reader.readByte()); } -test "Reader.isBytes" { +test "isBytes" { var fis = std.io.fixedBufferStream("foobar"); const reader = fis.reader(); try testing.expectEqual(true, try reader.isBytes("foo")); try testing.expectEqual(false, try reader.isBytes("qux")); } -test "Reader.skipBytes" { +test "skipBytes" { var fis = std.io.fixedBufferStream("foobar"); const reader = fis.reader(); try reader.skipBytes(3, .{}); @@ -31,7 +31,7 @@ test "Reader.skipBytes" { try testing.expectError(error.EndOfStream, reader.skipBytes(1, .{})); } -test "Reader.readUntilDelimiterArrayList returns ArrayLists with bytes read until the delimiter, then EndOfStream" { +test "readUntilDelimiterArrayList returns ArrayLists with bytes read until the delimiter, then EndOfStream" { const a = std.testing.allocator; var list = std.ArrayList(u8).init(a); defer list.deinit(); @@ -46,7 +46,7 @@ test "Reader.readUntilDelimiterArrayList returns ArrayLists with bytes read unti try std.testing.expectError(error.EndOfStream, reader.readUntilDelimiterArrayList(&list, '\n', 5)); } -test "Reader.readUntilDelimiterArrayList returns an empty ArrayList" { +test "readUntilDelimiterArrayList returns an empty ArrayList" { const a = std.testing.allocator; var list = std.ArrayList(u8).init(a); defer list.deinit(); @@ -58,7 +58,7 @@ test "Reader.readUntilDelimiterArrayList returns an empty ArrayList" { try std.testing.expectEqualStrings("", list.items); } -test "Reader.readUntilDelimiterArrayList returns StreamTooLong, then an ArrayList with bytes read until the delimiter" { +test "readUntilDelimiterArrayList returns StreamTooLong, then an ArrayList with bytes read until the delimiter" { const a = std.testing.allocator; var list = std.ArrayList(u8).init(a); defer list.deinit(); @@ -72,7 +72,7 @@ test "Reader.readUntilDelimiterArrayList returns StreamTooLong, then an ArrayLis try std.testing.expectEqualStrings("67", list.items); } -test "Reader.readUntilDelimiterArrayList returns EndOfStream" { +test "readUntilDelimiterArrayList returns EndOfStream" { const a = std.testing.allocator; var list = std.ArrayList(u8).init(a); defer list.deinit(); @@ -84,7 +84,7 @@ test "Reader.readUntilDelimiterArrayList returns EndOfStream" { try std.testing.expectEqualStrings("1234", list.items); } -test "Reader.readUntilDelimiterAlloc returns ArrayLists with bytes read until the delimiter, then EndOfStream" { +test "readUntilDelimiterAlloc returns ArrayLists with bytes read until the delimiter, then EndOfStream" { const a = std.testing.allocator; var fis = std.io.fixedBufferStream("0000\n1234\n"); @@ -105,7 +105,7 @@ test "Reader.readUntilDelimiterAlloc returns ArrayLists with bytes read until th try std.testing.expectError(error.EndOfStream, reader.readUntilDelimiterAlloc(a, '\n', 5)); } -test "Reader.readUntilDelimiterAlloc returns an empty ArrayList" { +test "readUntilDelimiterAlloc returns an empty ArrayList" { const a = std.testing.allocator; var fis = std.io.fixedBufferStream("\n"); @@ -118,7 +118,7 @@ test "Reader.readUntilDelimiterAlloc returns an empty ArrayList" { } } -test "Reader.readUntilDelimiterAlloc returns StreamTooLong, then an ArrayList with bytes read until the delimiter" { +test "readUntilDelimiterAlloc returns StreamTooLong, then an ArrayList with bytes read until the delimiter" { const a = std.testing.allocator; var fis = std.io.fixedBufferStream("1234567\n"); @@ -131,7 +131,7 @@ test "Reader.readUntilDelimiterAlloc returns StreamTooLong, then an ArrayList wi try std.testing.expectEqualStrings("67", result); } -test "Reader.readUntilDelimiterAlloc returns EndOfStream" { +test "readUntilDelimiterAlloc returns EndOfStream" { const a = std.testing.allocator; var fis = std.io.fixedBufferStream("1234"); @@ -140,7 +140,7 @@ test "Reader.readUntilDelimiterAlloc returns EndOfStream" { try std.testing.expectError(error.EndOfStream, reader.readUntilDelimiterAlloc(a, '\n', 5)); } -test "Reader.readUntilDelimiter returns bytes read until the delimiter" { +test "readUntilDelimiter returns bytes read until the delimiter" { var buf: [5]u8 = undefined; var fis = std.io.fixedBufferStream("0000\n1234\n"); const reader = fis.reader(); @@ -148,14 +148,14 @@ test "Reader.readUntilDelimiter returns bytes read until the delimiter" { try std.testing.expectEqualStrings("1234", try reader.readUntilDelimiter(&buf, '\n')); } -test "Reader.readUntilDelimiter returns an empty string" { +test "readUntilDelimiter returns an empty string" { var buf: [5]u8 = undefined; var fis = std.io.fixedBufferStream("\n"); const reader = fis.reader(); try std.testing.expectEqualStrings("", try reader.readUntilDelimiter(&buf, '\n')); } -test "Reader.readUntilDelimiter returns StreamTooLong, then an empty string" { +test "readUntilDelimiter returns StreamTooLong, then an empty string" { var buf: [5]u8 = undefined; var fis = std.io.fixedBufferStream("12345\n"); const reader = fis.reader(); @@ -163,7 +163,7 @@ test "Reader.readUntilDelimiter returns StreamTooLong, then an empty string" { try std.testing.expectEqualStrings("", try reader.readUntilDelimiter(&buf, '\n')); } -test "Reader.readUntilDelimiter returns StreamTooLong, then bytes read until the delimiter" { +test "readUntilDelimiter returns StreamTooLong, then bytes read until the delimiter" { var buf: [5]u8 = undefined; var fis = std.io.fixedBufferStream("1234567\n"); const reader = fis.reader(); @@ -171,7 +171,7 @@ test "Reader.readUntilDelimiter returns StreamTooLong, then bytes read until the try std.testing.expectEqualStrings("67", try reader.readUntilDelimiter(&buf, '\n')); } -test "Reader.readUntilDelimiter returns EndOfStream" { +test "readUntilDelimiter returns EndOfStream" { { var buf: [5]u8 = undefined; var fis = std.io.fixedBufferStream(""); @@ -186,7 +186,7 @@ test "Reader.readUntilDelimiter returns EndOfStream" { } } -test "Reader.readUntilDelimiter returns bytes read until delimiter, then EndOfStream" { +test "readUntilDelimiter returns bytes read until delimiter, then EndOfStream" { var buf: [5]u8 = undefined; var fis = std.io.fixedBufferStream("1234\n"); const reader = fis.reader(); @@ -194,7 +194,7 @@ test "Reader.readUntilDelimiter returns bytes read until delimiter, then EndOfSt try std.testing.expectError(error.EndOfStream, reader.readUntilDelimiter(&buf, '\n')); } -test "Reader.readUntilDelimiter returns StreamTooLong, then EndOfStream" { +test "readUntilDelimiter returns StreamTooLong, then EndOfStream" { var buf: [5]u8 = undefined; var fis = std.io.fixedBufferStream("12345"); const reader = fis.reader(); @@ -202,7 +202,7 @@ test "Reader.readUntilDelimiter returns StreamTooLong, then EndOfStream" { try std.testing.expectError(error.EndOfStream, reader.readUntilDelimiter(&buf, '\n')); } -test "Reader.readUntilDelimiter writes all bytes read to the output buffer" { +test "readUntilDelimiter writes all bytes read to the output buffer" { var buf: [5]u8 = undefined; var fis = std.io.fixedBufferStream("0000\n12345"); const reader = fis.reader(); @@ -212,7 +212,7 @@ test "Reader.readUntilDelimiter writes all bytes read to the output buffer" { try std.testing.expectEqualStrings("12345", &buf); } -test "Reader.readUntilDelimiterOrEofAlloc returns ArrayLists with bytes read until the delimiter, then EndOfStream" { +test "readUntilDelimiterOrEofAlloc returns ArrayLists with bytes read until the delimiter, then EndOfStream" { const a = std.testing.allocator; var fis = std.io.fixedBufferStream("0000\n1234\n"); @@ -233,7 +233,7 @@ test "Reader.readUntilDelimiterOrEofAlloc returns ArrayLists with bytes read unt try std.testing.expect((try reader.readUntilDelimiterOrEofAlloc(a, '\n', 5)) == null); } -test "Reader.readUntilDelimiterOrEofAlloc returns an empty ArrayList" { +test "readUntilDelimiterOrEofAlloc returns an empty ArrayList" { const a = std.testing.allocator; var fis = std.io.fixedBufferStream("\n"); @@ -246,7 +246,7 @@ test "Reader.readUntilDelimiterOrEofAlloc returns an empty ArrayList" { } } -test "Reader.readUntilDelimiterOrEofAlloc returns StreamTooLong, then an ArrayList with bytes read until the delimiter" { +test "readUntilDelimiterOrEofAlloc returns StreamTooLong, then an ArrayList with bytes read until the delimiter" { const a = std.testing.allocator; var fis = std.io.fixedBufferStream("1234567\n"); @@ -259,7 +259,7 @@ test "Reader.readUntilDelimiterOrEofAlloc returns StreamTooLong, then an ArrayLi try std.testing.expectEqualStrings("67", result); } -test "Reader.readUntilDelimiterOrEof returns bytes read until the delimiter" { +test "readUntilDelimiterOrEof returns bytes read until the delimiter" { var buf: [5]u8 = undefined; var fis = std.io.fixedBufferStream("0000\n1234\n"); const reader = fis.reader(); @@ -267,14 +267,14 @@ test "Reader.readUntilDelimiterOrEof returns bytes read until the delimiter" { try std.testing.expectEqualStrings("1234", (try reader.readUntilDelimiterOrEof(&buf, '\n')).?); } -test "Reader.readUntilDelimiterOrEof returns an empty string" { +test "readUntilDelimiterOrEof returns an empty string" { var buf: [5]u8 = undefined; var fis = std.io.fixedBufferStream("\n"); const reader = fis.reader(); try std.testing.expectEqualStrings("", (try reader.readUntilDelimiterOrEof(&buf, '\n')).?); } -test "Reader.readUntilDelimiterOrEof returns StreamTooLong, then an empty string" { +test "readUntilDelimiterOrEof returns StreamTooLong, then an empty string" { var buf: [5]u8 = undefined; var fis = std.io.fixedBufferStream("12345\n"); const reader = fis.reader(); @@ -282,7 +282,7 @@ test "Reader.readUntilDelimiterOrEof returns StreamTooLong, then an empty string try std.testing.expectEqualStrings("", (try reader.readUntilDelimiterOrEof(&buf, '\n')).?); } -test "Reader.readUntilDelimiterOrEof returns StreamTooLong, then bytes read until the delimiter" { +test "readUntilDelimiterOrEof returns StreamTooLong, then bytes read until the delimiter" { var buf: [5]u8 = undefined; var fis = std.io.fixedBufferStream("1234567\n"); const reader = fis.reader(); @@ -290,14 +290,14 @@ test "Reader.readUntilDelimiterOrEof returns StreamTooLong, then bytes read unti try std.testing.expectEqualStrings("67", (try reader.readUntilDelimiterOrEof(&buf, '\n')).?); } -test "Reader.readUntilDelimiterOrEof returns null" { +test "readUntilDelimiterOrEof returns null" { var buf: [5]u8 = undefined; var fis = std.io.fixedBufferStream(""); const reader = fis.reader(); try std.testing.expect((try reader.readUntilDelimiterOrEof(&buf, '\n')) == null); } -test "Reader.readUntilDelimiterOrEof returns bytes read until delimiter, then null" { +test "readUntilDelimiterOrEof returns bytes read until delimiter, then null" { var buf: [5]u8 = undefined; var fis = std.io.fixedBufferStream("1234\n"); const reader = fis.reader(); @@ -305,14 +305,14 @@ test "Reader.readUntilDelimiterOrEof returns bytes read until delimiter, then nu try std.testing.expect((try reader.readUntilDelimiterOrEof(&buf, '\n')) == null); } -test "Reader.readUntilDelimiterOrEof returns bytes read until end-of-stream" { +test "readUntilDelimiterOrEof returns bytes read until end-of-stream" { var buf: [5]u8 = undefined; var fis = std.io.fixedBufferStream("1234"); const reader = fis.reader(); try std.testing.expectEqualStrings("1234", (try reader.readUntilDelimiterOrEof(&buf, '\n')).?); } -test "Reader.readUntilDelimiterOrEof returns StreamTooLong, then bytes read until end-of-stream" { +test "readUntilDelimiterOrEof returns StreamTooLong, then bytes read until end-of-stream" { var buf: [5]u8 = undefined; var fis = std.io.fixedBufferStream("1234567"); const reader = fis.reader(); @@ -320,7 +320,7 @@ test "Reader.readUntilDelimiterOrEof returns StreamTooLong, then bytes read unti try std.testing.expectEqualStrings("67", (try reader.readUntilDelimiterOrEof(&buf, '\n')).?); } -test "Reader.readUntilDelimiterOrEof writes all bytes read to the output buffer" { +test "readUntilDelimiterOrEof writes all bytes read to the output buffer" { var buf: [5]u8 = undefined; var fis = std.io.fixedBufferStream("0000\n12345"); const reader = fis.reader(); @@ -330,7 +330,7 @@ test "Reader.readUntilDelimiterOrEof writes all bytes read to the output buffer" try std.testing.expectEqualStrings("12345", &buf); } -test "Reader.streamUntilDelimiter writes all bytes without delimiter to the output" { +test "streamUntilDelimiter writes all bytes without delimiter to the output" { const input_string = "some_string_with_delimiter!"; var input_fbs = std.io.fixedBufferStream(input_string); const reader = input_fbs.reader(); @@ -349,7 +349,7 @@ test "Reader.streamUntilDelimiter writes all bytes without delimiter to the outp try std.testing.expectError(error.StreamTooLong, reader.streamUntilDelimiter(writer, '!', 5)); } -test "Reader.readBoundedBytes correctly reads into a new bounded array" { +test "readBoundedBytes correctly reads into a new bounded array" { const test_string = "abcdefg"; var fis = std.io.fixedBufferStream(test_string); const reader = fis.reader(); @@ -358,7 +358,7 @@ test "Reader.readBoundedBytes correctly reads into a new bounded array" { try testing.expectEqualStrings(array.slice(), test_string); } -test "Reader.readIntoBoundedBytes correctly reads into a provided bounded array" { +test "readIntoBoundedBytes correctly reads into a provided bounded array" { const test_string = "abcdefg"; var fis = std.io.fixedBufferStream(test_string); const reader = fis.reader(); diff --git a/lib/std/io/buffered_reader.zig b/lib/std/io/buffered_reader.zig index 40a81e3956..ca132202a7 100644 --- a/lib/std/io/buffered_reader.zig +++ b/lib/std/io/buffered_reader.zig @@ -53,7 +53,7 @@ pub fn bufferedReaderSize(comptime size: usize, reader: anytype) BufferedReader( return .{ .unbuffered_reader = reader }; } -test "io.BufferedReader OneByte" { +test "OneByte" { const OneByteReadReader = struct { str: []const u8, curr: usize, @@ -96,7 +96,7 @@ test "io.BufferedReader OneByte" { fn smallBufferedReader(underlying_stream: anytype) BufferedReader(8, @TypeOf(underlying_stream)) { return .{ .unbuffered_reader = underlying_stream }; } -test "io.BufferedReader Block" { +test "Block" { const BlockReader = struct { block: []const u8, reads_allowed: usize, diff --git a/lib/std/io/buffered_tee.zig b/lib/std/io/buffered_tee.zig index 304b360c41..d5748c3a52 100644 --- a/lib/std/io/buffered_tee.zig +++ b/lib/std/io/buffered_tee.zig @@ -146,7 +146,7 @@ fn bufferedReader(reader: anytype) BufferedReader(4096, @TypeOf(reader)) { }; } -test "io.BufferedTee io.BufferedReader OneByte" { +test "OneByte" { const OneByteReadReader = struct { str: []const u8, curr: usize, @@ -186,7 +186,7 @@ test "io.BufferedTee io.BufferedReader OneByte" { try testing.expectEqualSlices(u8, str, res); } -test "io.BufferedTee io.BufferedReader Block" { +test "Block" { const BlockReader = struct { block: []const u8, reads_allowed: usize, @@ -289,7 +289,7 @@ test "io.BufferedTee io.BufferedReader Block" { } } -test "io.BufferedTee with zero lookahead" { +test "with zero lookahead" { // output has same bytes as consumer const data = [_]u8{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 } ** 12; var in = io.fixedBufferStream(&data); @@ -308,7 +308,7 @@ test "io.BufferedTee with zero lookahead" { } } -test "io.BufferedTee with lookahead" { +test "with lookahead" { // output is lookahead bytes behind consumer inline for (1..8) |lookahead| { const data = [_]u8{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 } ** 12; @@ -333,7 +333,7 @@ test "io.BufferedTee with lookahead" { } } -test "io.BufferedTee internal state" { +test "internal state" { const data = [_]u8{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 } ** 2; var in = io.fixedBufferStream(&data); var out = std.ArrayList(u8).init(testing.allocator); diff --git a/lib/std/io/counting_reader.zig b/lib/std/io/counting_reader.zig index 54e8e6f531..2ff9b8a08f 100644 --- a/lib/std/io/counting_reader.zig +++ b/lib/std/io/counting_reader.zig @@ -27,7 +27,7 @@ pub fn countingReader(reader: anytype) CountingReader(@TypeOf(reader)) { return .{ .child_reader = reader }; } -test "io.CountingReader" { +test CountingReader { const bytes = "yay" ** 100; var fbs = io.fixedBufferStream(bytes); diff --git a/lib/std/io/counting_writer.zig b/lib/std/io/counting_writer.zig index ee86c2a9b1..9043e1a47c 100644 --- a/lib/std/io/counting_writer.zig +++ b/lib/std/io/counting_writer.zig @@ -29,7 +29,7 @@ pub fn countingWriter(child_stream: anytype) CountingWriter(@TypeOf(child_stream return .{ .bytes_written = 0, .child_stream = child_stream }; } -test "io.CountingWriter" { +test CountingWriter { var counting_stream = countingWriter(std.io.null_writer); const stream = counting_stream.writer(); diff --git a/lib/std/io/fixed_buffer_stream.zig b/lib/std/io/fixed_buffer_stream.zig index 8b64923fe7..14e5e5de43 100644 --- a/lib/std/io/fixed_buffer_stream.zig +++ b/lib/std/io/fixed_buffer_stream.zig @@ -132,7 +132,7 @@ fn Slice(comptime T: type) type { } } -test "FixedBufferStream output" { +test "output" { var buf: [255]u8 = undefined; var fbs = fixedBufferStream(&buf); const stream = fbs.writer(); @@ -141,7 +141,7 @@ test "FixedBufferStream output" { try testing.expectEqualSlices(u8, "HelloWorld!", fbs.getWritten()); } -test "FixedBufferStream output at comptime" { +test "output at comptime" { comptime { var buf: [255]u8 = undefined; var fbs = fixedBufferStream(&buf); @@ -152,7 +152,7 @@ test "FixedBufferStream output at comptime" { } } -test "FixedBufferStream output 2" { +test "output 2" { var buffer: [10]u8 = undefined; var fbs = fixedBufferStream(&buffer); @@ -175,7 +175,7 @@ test "FixedBufferStream output 2" { try testing.expectError(error.NoSpaceLeft, fbs.writer().writeAll("H")); } -test "FixedBufferStream input" { +test "input" { const bytes = [_]u8{ 1, 2, 3, 4, 5, 6, 7 }; var fbs = fixedBufferStream(&bytes); diff --git a/lib/std/io/stream_source.zig b/lib/std/io/stream_source.zig index eea6deff67..6e06af8204 100644 --- a/lib/std/io/stream_source.zig +++ b/lib/std/io/stream_source.zig @@ -99,11 +99,11 @@ pub const StreamSource = union(enum) { } }; -test "StreamSource (refs)" { +test "refs" { std.testing.refAllDecls(StreamSource); } -test "StreamSource (mutable buffer)" { +test "mutable buffer" { var buffer: [64]u8 = undefined; var source = StreamSource{ .buffer = std.io.fixedBufferStream(&buffer) }; @@ -114,7 +114,7 @@ test "StreamSource (mutable buffer)" { try std.testing.expectEqualStrings("Hello, World!", source.buffer.getWritten()); } -test "StreamSource (const buffer)" { +test "const buffer" { const buffer: [64]u8 = "Hello, World!".* ++ ([1]u8{0xAA} ** 51); var source = StreamSource{ .const_buffer = std.io.fixedBufferStream(&buffer) }; diff --git a/lib/std/json/scanner_test.zig b/lib/std/json/scanner_test.zig index be9249fa65..8e0727a3b4 100644 --- a/lib/std/json/scanner_test.zig +++ b/lib/std/json/scanner_test.zig @@ -35,7 +35,7 @@ fn expectPeekNext(scanner_or_reader: anytype, expected_token_type: TokenType, ex try expectEqualTokens(expected_token, try scanner_or_reader.next()); } -test "json.token" { +test "token" { var scanner = JsonScanner.initCompleteInput(std.testing.allocator, example_document_str); defer scanner.deinit(); @@ -153,7 +153,7 @@ test "peek all types" { try testAllTypes(&tiny_json_reader, false); } -test "json.token mismatched close" { +test "token mismatched close" { var scanner = JsonScanner.initCompleteInput(std.testing.allocator, "[102, 111, 111 }"); defer scanner.deinit(); try expectNext(&scanner, .array_begin); @@ -163,7 +163,7 @@ test "json.token mismatched close" { try std.testing.expectError(error.SyntaxError, scanner.next()); } -test "json.token premature object close" { +test "token premature object close" { var scanner = JsonScanner.initCompleteInput(std.testing.allocator, "{ \"key\": }"); defer scanner.deinit(); try expectNext(&scanner, .object_begin); @@ -353,7 +353,7 @@ test "BufferUnderrun" { } } -test "json.validate" { +test "validate" { try std.testing.expectEqual(true, try validate(std.testing.allocator, "{}")); try std.testing.expectEqual(true, try validate(std.testing.allocator, "[]")); try std.testing.expectEqual(false, try validate(std.testing.allocator, "[{[[[[{}]]]]}]")); diff --git a/lib/std/math.zig b/lib/std/math.zig index d223b79484..11ab9189fa 100644 --- a/lib/std/math.zig +++ b/lib/std/math.zig @@ -1298,7 +1298,7 @@ pub fn log2_int_ceil(comptime T: type, x: T) Log2IntCeil(T) { return log2_val + 1; } -test "std.math.log2_int_ceil" { +test log2_int_ceil { try testing.expect(log2_int_ceil(u32, 1) == 0); try testing.expect(log2_int_ceil(u32, 2) == 1); try testing.expect(log2_int_ceil(u32, 3) == 2); diff --git a/lib/std/math/acos.zig b/lib/std/math/acos.zig index b451664885..6adc00b4f7 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..7bc9c06fc2 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..885ab35b9b 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..81e1abc7b8 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..b6cf2310c4 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..77ceff37d2 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..51051c5902 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..35df8f9018 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..140b06f4e5 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..77a1e5b839 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..4a246daa85 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..596bf2a296 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 "onj" { 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..85ab07bf4b 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..ffaff9932a 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..457bddc1e2 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..12329380bd 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..d675f56739 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..7026977b36 100644 --- a/lib/std/math/complex/proj.zig +++ b/lib/std/math/complex/proj.zig @@ -17,7 +17,7 @@ pub fn proj(z: anytype) Complex(@TypeOf(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..4ea4ca5be1 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..c8fce46947 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..6a1f9d21c7 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..de7f340450 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..554b83f46f 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..8b46081de1 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..81ffe16bd7 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 "exp1m" { 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..bd510baefa 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..15967f1afa 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..92e0c1eb13 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..48a57366b7 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/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..cb539136e4 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..85ed538d34 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..a5cb8bc2da 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..c32a60957b 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); diff --git a/lib/std/meta.zig b/lib/std/meta.zig index 17df0650f3..80e9874782 100644 --- a/lib/std/meta.zig +++ b/lib/std/meta.zig @@ -46,7 +46,7 @@ pub fn stringToEnum(comptime T: type, str: []const u8) ?T { } } -test "std.meta.stringToEnum" { +test "stringToEnum" { const E1 = enum { A, B, @@ -73,7 +73,7 @@ pub fn alignment(comptime T: type) comptime_int { }; } -test "std.meta.alignment" { +test "alignment" { try testing.expect(alignment(u8) == 1); try testing.expect(alignment(*align(1) u8) == 1); try testing.expect(alignment(*align(2) u8) == 2); @@ -94,7 +94,7 @@ pub fn Child(comptime T: type) type { }; } -test "std.meta.Child" { +test "Child" { try testing.expect(Child([1]u8) == u8); try testing.expect(Child(*u8) == u8); try testing.expect(Child([]u8) == u8); @@ -121,7 +121,7 @@ pub fn Elem(comptime T: type) type { @compileError("Expected pointer, slice, array or vector type, found '" ++ @typeName(T) ++ "'"); } -test "std.meta.Elem" { +test "Elem" { try testing.expect(Elem([1]u8) == u8); try testing.expect(Elem([*]u8) == u8); try testing.expect(Elem([]u8) == u8); @@ -255,7 +255,7 @@ pub fn containerLayout(comptime T: type) Type.ContainerLayout { }; } -test "std.meta.containerLayout" { +test "containerLayout" { const S1 = struct {}; const S2 = packed struct {}; const S3 = extern struct {}; @@ -289,7 +289,7 @@ pub fn declarations(comptime T: type) []const Type.Declaration { }; } -test "std.meta.declarations" { +test "declarations" { const E1 = enum { A, @@ -329,7 +329,7 @@ pub fn declarationInfo(comptime T: type, comptime decl_name: []const u8) Type.De @compileError("'" ++ @typeName(T) ++ "' has no declaration '" ++ decl_name ++ "'"); } -test "std.meta.declarationInfo" { +test "declarationInfo" { const E1 = enum { A, @@ -370,7 +370,7 @@ pub fn fields(comptime T: type) switch (@typeInfo(T)) { }; } -test "std.meta.fields" { +test "fields" { const E1 = enum { A, }; @@ -409,7 +409,7 @@ pub fn fieldInfo(comptime T: type, comptime field: FieldEnum(T)) switch (@typeIn return fields(T)[@intFromEnum(field)]; } -test "std.meta.fieldInfo" { +test "fieldInfo" { const E1 = enum { A, }; @@ -442,7 +442,7 @@ pub fn FieldType(comptime T: type, comptime field: FieldEnum(T)) type { return fieldInfo(T, field).type; } -test "std.meta.FieldType" { +test "FieldType" { const S = struct { a: u8, b: u16, @@ -470,7 +470,7 @@ pub fn fieldNames(comptime T: type) *const [fields(T).len][:0]const u8 { }; } -test "std.meta.fieldNames" { +test "fieldNames" { const E1 = enum { A, B }; const E2 = error{A}; const S1 = struct { @@ -511,7 +511,7 @@ pub fn tags(comptime T: type) *const [fields(T).len]T { }; } -test "std.meta.tags" { +test "tags" { const E1 = enum { A, B }; const E2 = error{A}; @@ -604,7 +604,7 @@ fn expectEqualEnum(expected: anytype, actual: @TypeOf(expected)) !void { ); } -test "std.meta.FieldEnum" { +test "FieldEnum" { try expectEqualEnum(enum {}, FieldEnum(struct {})); try expectEqualEnum(enum { a }, FieldEnum(struct { a: u8 })); try expectEqualEnum(enum { a, b, c }, FieldEnum(struct { a: u8, b: void, c: f32 })); @@ -639,7 +639,7 @@ pub fn DeclEnum(comptime T: type) type { }); } -test "std.meta.DeclEnum" { +test "DeclEnum" { const A = struct { pub const a: u8 = 0; }; @@ -670,7 +670,7 @@ pub fn Tag(comptime T: type) type { }; } -test "std.meta.Tag" { +test "Tag" { const E = enum(u8) { C = 33, D, @@ -690,7 +690,7 @@ pub fn activeTag(u: anytype) Tag(@TypeOf(u)) { return @as(Tag(T), u); } -test "std.meta.activeTag" { +test "activeTag" { const UE = enum { Int, Float, @@ -727,7 +727,7 @@ pub fn TagPayload(comptime U: type, comptime tag: Tag(U)) type { return TagPayloadByName(U, @tagName(tag)); } -test "std.meta.TagPayload" { +test "TagPayload" { const Event = union(enum) { Moved: struct { from: i32, @@ -802,7 +802,7 @@ pub fn eql(a: anytype, b: @TypeOf(a)) bool { } } -test "std.meta.eql" { +test "eql" { const S = struct { a: u32, b: f64, @@ -965,7 +965,7 @@ pub fn Float(comptime bit_count: u8) type { }); } -test "std.meta.Float" { +test "Float" { try testing.expectEqual(f16, Float(16)); try testing.expectEqual(f32, Float(32)); try testing.expectEqual(f64, Float(64)); diff --git a/lib/std/os/test.zig b/lib/std/os/test.zig index 6794e9ec88..a006e6f1bc 100644 --- a/lib/std/os/test.zig +++ b/lib/std/os/test.zig @@ -393,7 +393,7 @@ fn testThreadIdFn(thread_id: *Thread.Id) void { thread_id.* = Thread.getCurrentId(); } -test "std.Thread.getCurrentId" { +test "Thread.getCurrentId" { if (builtin.single_threaded) return error.SkipZigTest; var thread_current_id: Thread.Id = undefined; diff --git a/lib/std/priority_dequeue.zig b/lib/std/priority_dequeue.zig index 1b4a82aac3..7b03beb170 100644 --- a/lib/std/priority_dequeue.zig +++ b/lib/std/priority_dequeue.zig @@ -467,7 +467,7 @@ fn lessThanComparison(context: void, a: u32, b: u32) Order { const PDQ = PriorityDequeue(u32, void, lessThanComparison); -test "std.PriorityDequeue: add and remove min" { +test "add and remove min" { var queue = PDQ.init(testing.allocator, {}); defer queue.deinit(); @@ -486,7 +486,7 @@ test "std.PriorityDequeue: add and remove min" { try expectEqual(@as(u32, 54), queue.removeMin()); } -test "std.PriorityDequeue: add and remove min structs" { +test "add and remove min structs" { const S = struct { size: u32, }; @@ -513,7 +513,7 @@ test "std.PriorityDequeue: add and remove min structs" { try expectEqual(@as(u32, 54), queue.removeMin().size); } -test "std.PriorityDequeue: add and remove max" { +test "add and remove max" { var queue = PDQ.init(testing.allocator, {}); defer queue.deinit(); @@ -532,7 +532,7 @@ test "std.PriorityDequeue: add and remove max" { try expectEqual(@as(u32, 7), queue.removeMax()); } -test "std.PriorityDequeue: add and remove same min" { +test "add and remove same min" { var queue = PDQ.init(testing.allocator, {}); defer queue.deinit(); @@ -551,7 +551,7 @@ test "std.PriorityDequeue: add and remove same min" { try expectEqual(@as(u32, 2), queue.removeMin()); } -test "std.PriorityDequeue: add and remove same max" { +test "add and remove same max" { var queue = PDQ.init(testing.allocator, {}); defer queue.deinit(); @@ -570,7 +570,7 @@ test "std.PriorityDequeue: add and remove same max" { try expectEqual(@as(u32, 1), queue.removeMax()); } -test "std.PriorityDequeue: removeOrNull empty" { +test "removeOrNull empty" { var queue = PDQ.init(testing.allocator, {}); defer queue.deinit(); @@ -578,7 +578,7 @@ test "std.PriorityDequeue: removeOrNull empty" { try expect(queue.removeMaxOrNull() == null); } -test "std.PriorityDequeue: edge case 3 elements" { +test "edge case 3 elements" { var queue = PDQ.init(testing.allocator, {}); defer queue.deinit(); @@ -591,7 +591,7 @@ test "std.PriorityDequeue: edge case 3 elements" { try expectEqual(@as(u32, 9), queue.removeMin()); } -test "std.PriorityDequeue: edge case 3 elements max" { +test "edge case 3 elements max" { var queue = PDQ.init(testing.allocator, {}); defer queue.deinit(); @@ -604,7 +604,7 @@ test "std.PriorityDequeue: edge case 3 elements max" { try expectEqual(@as(u32, 2), queue.removeMax()); } -test "std.PriorityDequeue: peekMin" { +test "peekMin" { var queue = PDQ.init(testing.allocator, {}); defer queue.deinit(); @@ -618,7 +618,7 @@ test "std.PriorityDequeue: peekMin" { try expect(queue.peekMin().? == 2); } -test "std.PriorityDequeue: peekMax" { +test "peekMax" { var queue = PDQ.init(testing.allocator, {}); defer queue.deinit(); @@ -632,7 +632,7 @@ test "std.PriorityDequeue: peekMax" { try expect(queue.peekMax().? == 9); } -test "std.PriorityDequeue: sift up with odd indices, removeMin" { +test "sift up with odd indices, removeMin" { var queue = PDQ.init(testing.allocator, {}); defer queue.deinit(); const items = [_]u32{ 15, 7, 21, 14, 13, 22, 12, 6, 7, 25, 5, 24, 11, 16, 15, 24, 2, 1 }; @@ -646,7 +646,7 @@ test "std.PriorityDequeue: sift up with odd indices, removeMin" { } } -test "std.PriorityDequeue: sift up with odd indices, removeMax" { +test "sift up with odd indices, removeMax" { var queue = PDQ.init(testing.allocator, {}); defer queue.deinit(); const items = [_]u32{ 15, 7, 21, 14, 13, 22, 12, 6, 7, 25, 5, 24, 11, 16, 15, 24, 2, 1 }; @@ -660,7 +660,7 @@ test "std.PriorityDequeue: sift up with odd indices, removeMax" { } } -test "std.PriorityDequeue: addSlice min" { +test "addSlice min" { var queue = PDQ.init(testing.allocator, {}); defer queue.deinit(); const items = [_]u32{ 15, 7, 21, 14, 13, 22, 12, 6, 7, 25, 5, 24, 11, 16, 15, 24, 2, 1 }; @@ -672,7 +672,7 @@ test "std.PriorityDequeue: addSlice min" { } } -test "std.PriorityDequeue: addSlice max" { +test "addSlice max" { var queue = PDQ.init(testing.allocator, {}); defer queue.deinit(); const items = [_]u32{ 15, 7, 21, 14, 13, 22, 12, 6, 7, 25, 5, 24, 11, 16, 15, 24, 2, 1 }; @@ -684,7 +684,7 @@ test "std.PriorityDequeue: addSlice max" { } } -test "std.PriorityDequeue: fromOwnedSlice trivial case 0" { +test "fromOwnedSlice trivial case 0" { const items = [0]u32{}; const queue_items = try testing.allocator.dupe(u32, &items); var queue = PDQ.fromOwnedSlice(testing.allocator, queue_items[0..], {}); @@ -693,7 +693,7 @@ test "std.PriorityDequeue: fromOwnedSlice trivial case 0" { try expect(queue.removeMinOrNull() == null); } -test "std.PriorityDequeue: fromOwnedSlice trivial case 1" { +test "fromOwnedSlice trivial case 1" { const items = [1]u32{1}; const queue_items = try testing.allocator.dupe(u32, &items); var queue = PDQ.fromOwnedSlice(testing.allocator, queue_items[0..], {}); @@ -704,7 +704,7 @@ test "std.PriorityDequeue: fromOwnedSlice trivial case 1" { try expect(queue.removeMinOrNull() == null); } -test "std.PriorityDequeue: fromOwnedSlice" { +test "fromOwnedSlice" { const items = [_]u32{ 15, 7, 21, 14, 13, 22, 12, 6, 7, 25, 5, 24, 11, 16, 15, 24, 2, 1 }; const queue_items = try testing.allocator.dupe(u32, items[0..]); var queue = PDQ.fromOwnedSlice(testing.allocator, queue_items[0..], {}); @@ -716,7 +716,7 @@ test "std.PriorityDequeue: fromOwnedSlice" { } } -test "std.PriorityDequeue: update min queue" { +test "update min queue" { var queue = PDQ.init(testing.allocator, {}); defer queue.deinit(); @@ -731,7 +731,7 @@ test "std.PriorityDequeue: update min queue" { try expectEqual(@as(u32, 5), queue.removeMin()); } -test "std.PriorityDequeue: update same min queue" { +test "update same min queue" { var queue = PDQ.init(testing.allocator, {}); defer queue.deinit(); @@ -747,7 +747,7 @@ test "std.PriorityDequeue: update same min queue" { try expectEqual(@as(u32, 5), queue.removeMin()); } -test "std.PriorityDequeue: update max queue" { +test "update max queue" { var queue = PDQ.init(testing.allocator, {}); defer queue.deinit(); @@ -763,7 +763,7 @@ test "std.PriorityDequeue: update max queue" { try expectEqual(@as(u32, 1), queue.removeMax()); } -test "std.PriorityDequeue: update same max queue" { +test "update same max queue" { var queue = PDQ.init(testing.allocator, {}); defer queue.deinit(); @@ -779,7 +779,7 @@ test "std.PriorityDequeue: update same max queue" { try expectEqual(@as(u32, 1), queue.removeMax()); } -test "std.PriorityDequeue: update after remove" { +test "update after remove" { var queue = PDQ.init(testing.allocator, {}); defer queue.deinit(); @@ -788,7 +788,7 @@ test "std.PriorityDequeue: update after remove" { try expectError(error.ElementNotFound, queue.update(1, 1)); } -test "std.PriorityDequeue: iterator" { +test "iterator" { var queue = PDQ.init(testing.allocator, {}); var map = std.AutoHashMap(u32, void).init(testing.allocator); defer { @@ -810,7 +810,7 @@ test "std.PriorityDequeue: iterator" { try expectEqual(@as(usize, 0), map.count()); } -test "std.PriorityDequeue: remove at index" { +test "remove at index" { var queue = PDQ.init(testing.allocator, {}); defer queue.deinit(); @@ -833,7 +833,7 @@ test "std.PriorityDequeue: remove at index" { try expectEqual(queue.removeMinOrNull(), null); } -test "std.PriorityDequeue: iterator while empty" { +test "iterator while empty" { var queue = PDQ.init(testing.allocator, {}); defer queue.deinit(); @@ -842,7 +842,7 @@ test "std.PriorityDequeue: iterator while empty" { try expectEqual(it.next(), null); } -test "std.PriorityDequeue: shrinkAndFree" { +test "shrinkAndFree" { var queue = PDQ.init(testing.allocator, {}); defer queue.deinit(); @@ -865,7 +865,7 @@ test "std.PriorityDequeue: shrinkAndFree" { try expect(queue.removeMaxOrNull() == null); } -test "std.PriorityDequeue: fuzz testing min" { +test "fuzz testing min" { var prng = std.Random.DefaultPrng.init(0x12345678); const random = prng.random(); @@ -894,7 +894,7 @@ fn fuzzTestMin(rng: std.Random, comptime queue_size: usize) !void { } } -test "std.PriorityDequeue: fuzz testing max" { +test "fuzz testing max" { var prng = std.Random.DefaultPrng.init(0x87654321); const random = prng.random(); @@ -923,7 +923,7 @@ fn fuzzTestMax(rng: std.Random, queue_size: usize) !void { } } -test "std.PriorityDequeue: fuzz testing min and max" { +test "fuzz testing min and max" { var prng = std.Random.DefaultPrng.init(0x87654321); const random = prng.random(); @@ -982,7 +982,7 @@ fn contextLessThanComparison(context: []const u32, a: usize, b: usize) Order { const CPDQ = PriorityDequeue(usize, []const u32, contextLessThanComparison); -test "std.PriorityDequeue: add and remove" { +test "add and remove" { const context = [_]u32{ 5, 3, 4, 2, 2, 8, 0 }; var queue = CPDQ.init(testing.allocator, context[0..]); @@ -1006,7 +1006,7 @@ test "std.PriorityDequeue: add and remove" { var all_cmps_unique = true; -test "std.PriorityDeque: don't compare a value to a copy of itself" { +test "don't compare a value to a copy of itself" { var depq = PriorityDequeue(u32, void, struct { fn uniqueLessThan(_: void, a: u32, b: u32) Order { all_cmps_unique = all_cmps_unique and (a != b); diff --git a/lib/std/priority_queue.zig b/lib/std/priority_queue.zig index 74f7cb6885..ae6621cf8f 100644 --- a/lib/std/priority_queue.zig +++ b/lib/std/priority_queue.zig @@ -271,7 +271,7 @@ fn greaterThan(context: void, a: u32, b: u32) Order { const PQlt = PriorityQueue(u32, void, lessThan); const PQgt = PriorityQueue(u32, void, greaterThan); -test "std.PriorityQueue: add and remove min heap" { +test "add and remove min heap" { var queue = PQlt.init(testing.allocator, {}); defer queue.deinit(); @@ -289,7 +289,7 @@ test "std.PriorityQueue: add and remove min heap" { try expectEqual(@as(u32, 54), queue.remove()); } -test "std.PriorityQueue: add and remove same min heap" { +test "add and remove same min heap" { var queue = PQlt.init(testing.allocator, {}); defer queue.deinit(); @@ -307,14 +307,14 @@ test "std.PriorityQueue: add and remove same min heap" { try expectEqual(@as(u32, 2), queue.remove()); } -test "std.PriorityQueue: removeOrNull on empty" { +test "removeOrNull on empty" { var queue = PQlt.init(testing.allocator, {}); defer queue.deinit(); try expect(queue.removeOrNull() == null); } -test "std.PriorityQueue: edge case 3 elements" { +test "edge case 3 elements" { var queue = PQlt.init(testing.allocator, {}); defer queue.deinit(); @@ -326,7 +326,7 @@ test "std.PriorityQueue: edge case 3 elements" { try expectEqual(@as(u32, 9), queue.remove()); } -test "std.PriorityQueue: peek" { +test "peek" { var queue = PQlt.init(testing.allocator, {}); defer queue.deinit(); @@ -338,7 +338,7 @@ test "std.PriorityQueue: peek" { try expectEqual(@as(u32, 2), queue.peek().?); } -test "std.PriorityQueue: sift up with odd indices" { +test "sift up with odd indices" { var queue = PQlt.init(testing.allocator, {}); defer queue.deinit(); const items = [_]u32{ 15, 7, 21, 14, 13, 22, 12, 6, 7, 25, 5, 24, 11, 16, 15, 24, 2, 1 }; @@ -352,7 +352,7 @@ test "std.PriorityQueue: sift up with odd indices" { } } -test "std.PriorityQueue: addSlice" { +test "addSlice" { var queue = PQlt.init(testing.allocator, {}); defer queue.deinit(); const items = [_]u32{ 15, 7, 21, 14, 13, 22, 12, 6, 7, 25, 5, 24, 11, 16, 15, 24, 2, 1 }; @@ -364,7 +364,7 @@ test "std.PriorityQueue: addSlice" { } } -test "std.PriorityQueue: fromOwnedSlice trivial case 0" { +test "fromOwnedSlice trivial case 0" { const items = [0]u32{}; const queue_items = try testing.allocator.dupe(u32, &items); var queue = PQlt.fromOwnedSlice(testing.allocator, queue_items[0..], {}); @@ -373,7 +373,7 @@ test "std.PriorityQueue: fromOwnedSlice trivial case 0" { try expect(queue.removeOrNull() == null); } -test "std.PriorityQueue: fromOwnedSlice trivial case 1" { +test "fromOwnedSlice trivial case 1" { const items = [1]u32{1}; const queue_items = try testing.allocator.dupe(u32, &items); var queue = PQlt.fromOwnedSlice(testing.allocator, queue_items[0..], {}); @@ -384,7 +384,7 @@ test "std.PriorityQueue: fromOwnedSlice trivial case 1" { try expect(queue.removeOrNull() == null); } -test "std.PriorityQueue: fromOwnedSlice" { +test "fromOwnedSlice" { const items = [_]u32{ 15, 7, 21, 14, 13, 22, 12, 6, 7, 25, 5, 24, 11, 16, 15, 24, 2, 1 }; const heap_items = try testing.allocator.dupe(u32, items[0..]); var queue = PQlt.fromOwnedSlice(testing.allocator, heap_items[0..], {}); @@ -396,7 +396,7 @@ test "std.PriorityQueue: fromOwnedSlice" { } } -test "std.PriorityQueue: add and remove max heap" { +test "add and remove max heap" { var queue = PQgt.init(testing.allocator, {}); defer queue.deinit(); @@ -414,7 +414,7 @@ test "std.PriorityQueue: add and remove max heap" { try expectEqual(@as(u32, 7), queue.remove()); } -test "std.PriorityQueue: add and remove same max heap" { +test "add and remove same max heap" { var queue = PQgt.init(testing.allocator, {}); defer queue.deinit(); @@ -432,7 +432,7 @@ test "std.PriorityQueue: add and remove same max heap" { try expectEqual(@as(u32, 1), queue.remove()); } -test "std.PriorityQueue: iterator" { +test "iterator" { var queue = PQlt.init(testing.allocator, {}); var map = std.AutoHashMap(u32, void).init(testing.allocator); defer { @@ -454,7 +454,7 @@ test "std.PriorityQueue: iterator" { try expectEqual(@as(usize, 0), map.count()); } -test "std.PriorityQueue: remove at index" { +test "remove at index" { var queue = PQlt.init(testing.allocator, {}); defer queue.deinit(); @@ -480,7 +480,7 @@ test "std.PriorityQueue: remove at index" { try expectEqual(queue.removeOrNull(), null); } -test "std.PriorityQueue: iterator while empty" { +test "iterator while empty" { var queue = PQlt.init(testing.allocator, {}); defer queue.deinit(); @@ -489,7 +489,7 @@ test "std.PriorityQueue: iterator while empty" { try expectEqual(it.next(), null); } -test "std.PriorityQueue: shrinkAndFree" { +test "shrinkAndFree" { var queue = PQlt.init(testing.allocator, {}); defer queue.deinit(); @@ -512,7 +512,7 @@ test "std.PriorityQueue: shrinkAndFree" { try expect(queue.removeOrNull() == null); } -test "std.PriorityQueue: update min heap" { +test "update min heap" { var queue = PQlt.init(testing.allocator, {}); defer queue.deinit(); @@ -527,7 +527,7 @@ test "std.PriorityQueue: update min heap" { try expectEqual(@as(u32, 5), queue.remove()); } -test "std.PriorityQueue: update same min heap" { +test "update same min heap" { var queue = PQlt.init(testing.allocator, {}); defer queue.deinit(); @@ -543,7 +543,7 @@ test "std.PriorityQueue: update same min heap" { try expectEqual(@as(u32, 5), queue.remove()); } -test "std.PriorityQueue: update max heap" { +test "update max heap" { var queue = PQgt.init(testing.allocator, {}); defer queue.deinit(); @@ -558,7 +558,7 @@ test "std.PriorityQueue: update max heap" { try expectEqual(@as(u32, 1), queue.remove()); } -test "std.PriorityQueue: update same max heap" { +test "update same max heap" { var queue = PQgt.init(testing.allocator, {}); defer queue.deinit(); @@ -574,7 +574,7 @@ test "std.PriorityQueue: update same max heap" { try expectEqual(@as(u32, 1), queue.remove()); } -test "std.PriorityQueue: update after remove" { +test "update after remove" { var queue = PQlt.init(testing.allocator, {}); defer queue.deinit(); @@ -583,7 +583,7 @@ test "std.PriorityQueue: update after remove" { try expectError(error.ElementNotFound, queue.update(1, 1)); } -test "std.PriorityQueue: siftUp in remove" { +test "siftUp in remove" { var queue = PQlt.init(testing.allocator, {}); defer queue.deinit(); @@ -603,7 +603,7 @@ fn contextLessThan(context: []const u32, a: usize, b: usize) Order { const CPQlt = PriorityQueue(usize, []const u32, contextLessThan); -test "std.PriorityQueue: add and remove min heap with contextful comparator" { +test "add and remove min heap with contextful comparator" { const context = [_]u32{ 5, 3, 4, 2, 2, 8, 0 }; var queue = CPQlt.init(testing.allocator, context[0..]); diff --git a/lib/std/segmented_list.zig b/lib/std/segmented_list.zig index 1c9cffa766..a729c368ed 100644 --- a/lib/std/segmented_list.zig +++ b/lib/std/segmented_list.zig @@ -408,7 +408,7 @@ pub fn SegmentedList(comptime T: type, comptime prealloc_item_count: usize) type }; } -test "SegmentedList basic usage" { +test "basic usage" { try testSegmentedList(0); try testSegmentedList(1); try testSegmentedList(2); @@ -507,7 +507,7 @@ fn testSegmentedList(comptime prealloc: usize) !void { try list.setCapacity(testing.allocator, 0); } -test "std.segmented_list clearRetainingCapacity" { +test "clearRetainingCapacity" { var list = SegmentedList(i32, 1){}; defer list.deinit(testing.allocator); diff --git a/lib/std/treap.zig b/lib/std/treap.zig index a7633d082a..46a51c6d5e 100644 --- a/lib/std/treap.zig +++ b/lib/std/treap.zig @@ -349,7 +349,7 @@ fn SliceIterRandomOrder(comptime T: type) type { const TestTreap = Treap(u64, std.math.order); const TestNode = TestTreap.Node; -test "std.Treap: insert, find, replace, remove" { +test "insert, find, replace, remove" { var treap = TestTreap{}; var nodes: [10]TestNode = undefined; diff --git a/lib/std/wasm.zig b/lib/std/wasm.zig index 07b8155b76..8996a174f1 100644 --- a/lib/std/wasm.zig +++ b/lib/std/wasm.zig @@ -201,7 +201,7 @@ pub fn opcode(op: Opcode) u8 { return @intFromEnum(op); } -test "Wasm - opcodes" { +test "opcodes" { // Ensure our opcodes values remain intact as certain values are skipped due to them being reserved const i32_const = opcode(.i32_const); const end = opcode(.end); @@ -625,7 +625,7 @@ pub fn reftype(value: RefType) u8 { return @intFromEnum(value); } -test "Wasm - valtypes" { +test "valtypes" { const _i32 = valtype(.i32); const _i64 = valtype(.i64); const _f32 = valtype(.f32);