| author | |
| committer | |
| log | 5c8f7f81cdd10d4cc4c30e46cf37006a2f74f829 |
| tree | ce9cd2bb4e0190e901613eb6cad8afdaf6484d2e |
| parent | 030f00391af6a46697db8031d5bd58e78eca2454 |
7 files changed, 25 insertions(+), 30 deletions(-)
lib/std/heap.zig+1-1| ... | ... | @@ -736,7 +736,7 @@ test "WasmPageAllocator internals" { |
| 736 | 736 | if (comptime std.Target.current.isWasm()) { |
| 737 | 737 | const conventional_memsize = WasmPageAllocator.conventional.totalPages() * mem.page_size; |
| 738 | 738 | const initial = try page_allocator.alloc(u8, mem.page_size); |
| 739 | std.debug.assert(@ptrToInt(initial.ptr) < conventional_memsize); // If this isn't conventional, the rest of these tests don't make sense. Also we have a serious memory leak in the test suite. | |
| 739 | testing.expect(@ptrToInt(initial.ptr) < conventional_memsize); // If this isn't conventional, the rest of these tests don't make sense. Also we have a serious memory leak in the test suite. | |
| 740 | 740 | |
| 741 | 741 | var inplace = try page_allocator.realloc(initial, 1); |
| 742 | 742 | testing.expectEqual(initial.ptr, inplace.ptr); |
lib/std/heap/logging_allocator.zig+1-1| ... | ... | @@ -93,7 +93,7 @@ test "LoggingAllocator" { |
| 93 | 93 | |
| 94 | 94 | var a = try allocator.alloc(u8, 10); |
| 95 | 95 | a = allocator.shrink(a, 5); |
| 96 | std.debug.assert(a.len == 5); | |
| 96 | std.testing.expect(a.len == 5); | |
| 97 | 97 | std.testing.expectError(error.OutOfMemory, allocator.resize(a, 20)); |
| 98 | 98 | allocator.free(a); |
| 99 | 99 |
lib/std/io/test.zig+1-5| ... | ... | @@ -40,11 +40,7 @@ test "write a file, read it, then delete it" { |
| 40 | 40 | |
| 41 | 41 | { |
| 42 | 42 | // Make sure the exclusive flag is honored. |
| 43 | if (tmp.dir.createFile(tmp_file_name, .{ .exclusive = true })) |file| { | |
| 44 | unreachable; | |
| 45 | } else |err| { | |
| 46 | std.debug.assert(err == File.OpenError.PathAlreadyExists); | |
| 47 | } | |
| 43 | expectError(File.OpenError.PathAlreadyExists, tmp.dir.createFile(tmp_file_name, .{ .exclusive = true })); | |
| 48 | 44 | } |
| 49 | 45 | |
| 50 | 46 | { |
lib/std/math/exp.zig+17-18| ... | ... | @@ -11,8 +11,7 @@ |
| 11 | 11 | |
| 12 | 12 | const std = @import("../std.zig"); |
| 13 | 13 | const math = std.math; |
| 14 | const assert = std.debug.assert; | |
| 15 | const builtin = @import("builtin"); | |
| 14 | const expect = std.testing.expect; | |
| 16 | 15 | |
| 17 | 16 | /// Returns e raised to the power of x (e^x). |
| 18 | 17 | /// |
| ... | ... | @@ -188,36 +187,36 @@ fn exp64(x_: f64) f64 { |
| 188 | 187 | } |
| 189 | 188 | |
| 190 | 189 | test "math.exp" { |
| 191 | assert(exp(@as(f32, 0.0)) == exp32(0.0)); | |
| 192 | assert(exp(@as(f64, 0.0)) == exp64(0.0)); | |
| 190 | expect(exp(@as(f32, 0.0)) == exp32(0.0)); | |
| 191 | expect(exp(@as(f64, 0.0)) == exp64(0.0)); | |
| 193 | 192 | } |
| 194 | 193 | |
| 195 | 194 | test "math.exp32" { |
| 196 | 195 | const epsilon = 0.000001; |
| 197 | 196 | |
| 198 | assert(exp32(0.0) == 1.0); | |
| 199 | assert(math.approxEqAbs(f32, exp32(0.0), 1.0, epsilon)); | |
| 200 | assert(math.approxEqAbs(f32, exp32(0.2), 1.221403, epsilon)); | |
| 201 | assert(math.approxEqAbs(f32, exp32(0.8923), 2.440737, epsilon)); | |
| 202 | assert(math.approxEqAbs(f32, exp32(1.5), 4.481689, epsilon)); | |
| 197 | expect(exp32(0.0) == 1.0); | |
| 198 | expect(math.approxEqAbs(f32, exp32(0.0), 1.0, epsilon)); | |
| 199 | expect(math.approxEqAbs(f32, exp32(0.2), 1.221403, epsilon)); | |
| 200 | expect(math.approxEqAbs(f32, exp32(0.8923), 2.440737, epsilon)); | |
| 201 | expect(math.approxEqAbs(f32, exp32(1.5), 4.481689, epsilon)); | |
| 203 | 202 | } |
| 204 | 203 | |
| 205 | 204 | test "math.exp64" { |
| 206 | 205 | const epsilon = 0.000001; |
| 207 | 206 | |
| 208 | assert(exp64(0.0) == 1.0); | |
| 209 | assert(math.approxEqAbs(f64, exp64(0.0), 1.0, epsilon)); | |
| 210 | assert(math.approxEqAbs(f64, exp64(0.2), 1.221403, epsilon)); | |
| 211 | assert(math.approxEqAbs(f64, exp64(0.8923), 2.440737, epsilon)); | |
| 212 | assert(math.approxEqAbs(f64, exp64(1.5), 4.481689, epsilon)); | |
| 207 | expect(exp64(0.0) == 1.0); | |
| 208 | expect(math.approxEqAbs(f64, exp64(0.0), 1.0, epsilon)); | |
| 209 | expect(math.approxEqAbs(f64, exp64(0.2), 1.221403, epsilon)); | |
| 210 | expect(math.approxEqAbs(f64, exp64(0.8923), 2.440737, epsilon)); | |
| 211 | expect(math.approxEqAbs(f64, exp64(1.5), 4.481689, epsilon)); | |
| 213 | 212 | } |
| 214 | 213 | |
| 215 | 214 | test "math.exp32.special" { |
| 216 | assert(math.isPositiveInf(exp32(math.inf(f32)))); | |
| 217 | assert(math.isNan(exp32(math.nan(f32)))); | |
| 215 | expect(math.isPositiveInf(exp32(math.inf(f32)))); | |
| 216 | expect(math.isNan(exp32(math.nan(f32)))); | |
| 218 | 217 | } |
| 219 | 218 | |
| 220 | 219 | test "math.exp64.special" { |
| 221 | assert(math.isPositiveInf(exp64(math.inf(f64)))); | |
| 222 | assert(math.isNan(exp64(math.nan(f64)))); | |
| 220 | expect(math.isPositiveInf(exp64(math.inf(f64)))); | |
| 221 | expect(math.isNan(exp64(math.nan(f64)))); | |
| 223 | 222 | } |
lib/std/rand.zig+1-1| ... | ... | @@ -1152,7 +1152,7 @@ test "CSPRNG" { |
| 1152 | 1152 | const a = csprng.random.int(u64); |
| 1153 | 1153 | const b = csprng.random.int(u64); |
| 1154 | 1154 | const c = csprng.random.int(u64); |
| 1155 | assert(a ^ b ^ c != 0); | |
| 1155 | expect(a ^ b ^ c != 0); | |
| 1156 | 1156 | } |
| 1157 | 1157 | |
| 1158 | 1158 | test "" { |
test/stage1/behavior/bugs/421.zig+2-2| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | const assert = @import("std").debug.assert; | |
| 1 | const expect = @import("std").testing.expect; | |
| 2 | 2 | |
| 3 | 3 | test "bitCast to array" { |
| 4 | 4 | comptime testBitCastArray(); |
| ... | ... | @@ -6,7 +6,7 @@ test "bitCast to array" { |
| 6 | 6 | } |
| 7 | 7 | |
| 8 | 8 | fn testBitCastArray() void { |
| 9 | assert(extractOne64(0x0123456789abcdef0123456789abcdef) == 0x0123456789abcdef); | |
| 9 | expect(extractOne64(0x0123456789abcdef0123456789abcdef) == 0x0123456789abcdef); | |
| 10 | 10 | } |
| 11 | 11 | |
| 12 | 12 | fn extractOne64(a: u128) u64 { |
test/standalone/use_alias/main.zig+2-2| ... | ... | @@ -1,10 +1,10 @@ |
| 1 | 1 | const c = @import("c.zig"); |
| 2 | const assert = @import("std").debug.assert; | |
| 2 | const expect = @import("std").testing.expect; | |
| 3 | 3 | |
| 4 | 4 | test "symbol exists" { |
| 5 | 5 | var foo = c.Foo{ |
| 6 | 6 | .a = 1, |
| 7 | 7 | .b = 1, |
| 8 | 8 | }; |
| 9 | assert(foo.a + foo.b == 2); | |
| 9 | expect(foo.a + foo.b == 2); | |
| 10 | 10 | } |