mirror of
https://github.com/ziglang/zig.git
synced 2024-11-29 07:40:14 +00:00
Revert "Merge pull request #17637 from jacobly0/x86_64-test-std"
This reverts commit0c99ba1eab
, reversing changes made to5f92b070bf
. This caused a CI failure when it landed in master branch due to a 128-bit `@byteSwap` in std.mem.
This commit is contained in:
parent
9f0359d78f
commit
6f0198cadb
@ -4,7 +4,6 @@
|
||||
// https://github.com/llvm/llvm-project/blob/02d85149a05cb1f6dc49f0ba7a2ceca53718ae17/compiler-rt/test/builtins/Unit/subtf3_test.c
|
||||
|
||||
const std = @import("std");
|
||||
const builtin = @import("builtin");
|
||||
const math = std.math;
|
||||
const qnan128: f128 = @bitCast(@as(u128, 0x7fff800000000000) << 64);
|
||||
|
||||
@ -35,8 +34,6 @@ fn test__addtf3(a: f128, b: f128, expected_hi: u64, expected_lo: u64) !void {
|
||||
}
|
||||
|
||||
test "addtf3" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try test__addtf3(qnan128, 0x1.23456789abcdefp+5, 0x7fff800000000000, 0x0);
|
||||
|
||||
// NaN + any = NaN
|
||||
@ -76,9 +73,6 @@ fn test__subtf3(a: f128, b: f128, expected_hi: u64, expected_lo: u64) !void {
|
||||
}
|
||||
|
||||
test "subtf3" {
|
||||
if (builtin.zig_backend == .stage2_x86_64 and
|
||||
!comptime std.Target.x86.featureSetHasAll(builtin.cpu.features, .{ .bmi, .lzcnt })) return error.SkipZigTest;
|
||||
|
||||
// qNaN - any = qNaN
|
||||
try test__subtf3(qnan128, 0x1.23456789abcdefp+5, 0x7fff800000000000, 0x0);
|
||||
|
||||
@ -109,8 +103,6 @@ fn test__addxf3(a: f80, b: f80, expected: u80) !void {
|
||||
}
|
||||
|
||||
test "addxf3" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
// NaN + any = NaN
|
||||
try test__addxf3(qnan80, 0x1.23456789abcdefp+5, @as(u80, @bitCast(qnan80)));
|
||||
try test__addxf3(@as(f80, @bitCast(@as(u80, 0x7fff_8000_8000_3000_0000))), 0x1.23456789abcdefp+5, @as(u80, @bitCast(qnan80)));
|
||||
|
@ -23,8 +23,6 @@ fn simple_addoti4(a: i128, b: i128, overflow: *c_int) i128 {
|
||||
}
|
||||
|
||||
test "addoti4" {
|
||||
if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const min: i128 = math.minInt(i128);
|
||||
const max: i128 = math.maxInt(i128);
|
||||
var i: i128 = 1;
|
||||
|
@ -98,8 +98,6 @@ pub inline fn cmp_f80(comptime RT: type, a: f80, b: f80) RT {
|
||||
}
|
||||
|
||||
test "cmp_f80" {
|
||||
if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
inline for (.{ LE, GE }) |RT| {
|
||||
try std.testing.expect(cmp_f80(RT, 1.0, 1.0) == RT.Equal);
|
||||
try std.testing.expect(cmp_f80(RT, 0.0, -0.0) == RT.Equal);
|
||||
|
@ -1,4 +1,6 @@
|
||||
const std = @import("std");
|
||||
const builtin = @import("builtin");
|
||||
const arch = builtin.cpu.arch;
|
||||
const math = std.math;
|
||||
const expect = std.testing.expect;
|
||||
const common = @import("common.zig");
|
||||
@ -134,8 +136,6 @@ pub fn cosl(x: c_longdouble) callconv(.C) c_longdouble {
|
||||
}
|
||||
|
||||
test "cos32" {
|
||||
if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const epsilon = 0.00001;
|
||||
|
||||
try expect(math.approxEqAbs(f32, cosf(0.0), 1.0, epsilon));
|
||||
|
@ -1,5 +1,4 @@
|
||||
const std = @import("std");
|
||||
const builtin = @import("builtin");
|
||||
const math = std.math;
|
||||
const testing = std.testing;
|
||||
|
||||
@ -31,9 +30,6 @@ fn test__divtf3(a: f128, b: f128, expectedHi: u64, expectedLo: u64) !void {
|
||||
}
|
||||
|
||||
test "divtf3" {
|
||||
if (builtin.zig_backend == .stage2_x86_64 and
|
||||
!comptime std.Target.x86.featureSetHasAll(builtin.cpu.features, .{ .bmi, .lzcnt })) return error.SkipZigTest;
|
||||
|
||||
// NaN / any = NaN
|
||||
try test__divtf3(math.nan(f128), 0x1.23456789abcdefp+5, 0x7fff800000000000, 0);
|
||||
// inf / any(except inf and nan) = inf
|
||||
|
@ -39,8 +39,6 @@ fn test__divxf3(a: f80, b: f80) !void {
|
||||
}
|
||||
|
||||
test "divxf3" {
|
||||
if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
// NaN / any = NaN
|
||||
try expect__divxf3_result(math.nan(f80), 0x1.23456789abcdefp+5, 0x7fffC000000000000000);
|
||||
// inf / any(except inf and nan) = inf
|
||||
|
@ -1,5 +1,4 @@
|
||||
const std = @import("std");
|
||||
const builtin = @import("builtin");
|
||||
const testing = std.testing;
|
||||
const math = std.math;
|
||||
|
||||
@ -126,9 +125,6 @@ fn test__floatuntisf(a: u128, expected: f32) !void {
|
||||
}
|
||||
|
||||
test "floattisf" {
|
||||
if (builtin.zig_backend == .stage2_x86_64 and
|
||||
!comptime std.Target.x86.featureSetHasAll(builtin.cpu.features, .{ .bmi, .lzcnt })) return error.SkipZigTest;
|
||||
|
||||
try test__floattisf(0, 0.0);
|
||||
|
||||
try test__floattisf(1, 1.0);
|
||||
@ -175,9 +171,6 @@ test "floattisf" {
|
||||
}
|
||||
|
||||
test "floatuntisf" {
|
||||
if (builtin.zig_backend == .stage2_x86_64 and
|
||||
!comptime std.Target.x86.featureSetHasAll(builtin.cpu.features, .{ .bmi, .lzcnt })) return error.SkipZigTest;
|
||||
|
||||
try test__floatuntisf(0, 0.0);
|
||||
|
||||
try test__floatuntisf(1, 1.0);
|
||||
@ -374,9 +367,6 @@ fn test__floatuntidf(a: u128, expected: f64) !void {
|
||||
}
|
||||
|
||||
test "floattidf" {
|
||||
if (builtin.zig_backend == .stage2_x86_64 and
|
||||
!comptime std.Target.x86.featureSetHasAll(builtin.cpu.features, .{ .bmi, .lzcnt })) return error.SkipZigTest;
|
||||
|
||||
try test__floattidf(0, 0.0);
|
||||
|
||||
try test__floattidf(1, 1.0);
|
||||
@ -447,9 +437,6 @@ test "floattidf" {
|
||||
}
|
||||
|
||||
test "floatuntidf" {
|
||||
if (builtin.zig_backend == .stage2_x86_64 and
|
||||
!comptime std.Target.x86.featureSetHasAll(builtin.cpu.features, .{ .bmi, .lzcnt })) return error.SkipZigTest;
|
||||
|
||||
try test__floatuntidf(0, 0.0);
|
||||
|
||||
try test__floatuntidf(1, 1.0);
|
||||
@ -595,9 +582,6 @@ test "floatditf" {
|
||||
}
|
||||
|
||||
test "floatunditf" {
|
||||
if (builtin.zig_backend == .stage2_x86_64 and
|
||||
!comptime std.Target.x86.featureSetHasAll(builtin.cpu.features, .{ .bmi, .lzcnt })) return error.SkipZigTest;
|
||||
|
||||
try test__floatunditf(0xffffffffffffffff, 0x403effffffffffff, 0xfffe000000000000);
|
||||
try test__floatunditf(0xfffffffffffffffe, 0x403effffffffffff, 0xfffc000000000000);
|
||||
try test__floatunditf(0x8000000000000000, 0x403e000000000000, 0x0);
|
||||
@ -619,9 +603,6 @@ fn test__floatuntitf(a: u128, expected: f128) !void {
|
||||
}
|
||||
|
||||
test "floattitf" {
|
||||
if (builtin.zig_backend == .stage2_x86_64 and
|
||||
!comptime std.Target.x86.featureSetHasAll(builtin.cpu.features, .{ .bmi, .lzcnt })) return error.SkipZigTest;
|
||||
|
||||
try test__floattitf(0, 0.0);
|
||||
|
||||
try test__floattitf(1, 1.0);
|
||||
@ -704,9 +685,6 @@ test "floattitf" {
|
||||
}
|
||||
|
||||
test "floatuntitf" {
|
||||
if (builtin.zig_backend == .stage2_x86_64 and
|
||||
!comptime std.Target.x86.featureSetHasAll(builtin.cpu.features, .{ .bmi, .lzcnt })) return error.SkipZigTest;
|
||||
|
||||
try test__floatuntitf(0, 0.0);
|
||||
|
||||
try test__floatuntitf(1, 1.0);
|
||||
|
@ -343,9 +343,6 @@ test "64" {
|
||||
}
|
||||
|
||||
test "128" {
|
||||
if (builtin.zig_backend == .stage2_x86_64 and
|
||||
!comptime std.Target.x86.featureSetHasAll(builtin.cpu.features, .{ .bmi, .lzcnt })) return error.SkipZigTest;
|
||||
|
||||
const epsilon = 0.000001;
|
||||
|
||||
try expect(math.approxEqAbs(f128, fmaq(0.0, 5.0, 9.124), 9.124, epsilon));
|
||||
|
@ -1,5 +1,4 @@
|
||||
const std = @import("std");
|
||||
const builtin = @import("builtin");
|
||||
const fmod = @import("fmod.zig");
|
||||
const testing = std.testing;
|
||||
|
||||
@ -23,9 +22,6 @@ fn test_fmodx_infs() !void {
|
||||
}
|
||||
|
||||
test "fmodx" {
|
||||
if (builtin.zig_backend == .stage2_x86_64 and
|
||||
!comptime std.Target.x86.featureSetHasAll(builtin.cpu.features, .{ .bmi, .lzcnt })) return error.SkipZigTest;
|
||||
|
||||
try test_fmodx(6.4, 4.0, 2.4);
|
||||
try test_fmodx(6.4, -4.0, 2.4);
|
||||
try test_fmodx(-6.4, 4.0, -2.4);
|
||||
|
@ -42,8 +42,6 @@ pub fn __divmodti4(a: i128, b: i128, rem: *i128) callconv(.C) i128 {
|
||||
}
|
||||
|
||||
test "test_divmodti4" {
|
||||
if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const cases = [_][4]i128{
|
||||
[_]i128{ 0, 1, 0, 0 },
|
||||
[_]i128{ 0, -1, 0, 0 },
|
||||
|
@ -1,5 +1,4 @@
|
||||
const std = @import("std");
|
||||
const builtin = @import("builtin");
|
||||
const testing = std.testing;
|
||||
const math = std.math;
|
||||
|
||||
@ -41,8 +40,6 @@ fn test__fixunssfsi(a: f32, expected: u32) !void {
|
||||
}
|
||||
|
||||
test "fixsfsi" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try test__fixsfsi(-math.floatMax(f32), math.minInt(i32));
|
||||
|
||||
try test__fixsfsi(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i32));
|
||||
@ -106,8 +103,6 @@ test "fixsfsi" {
|
||||
}
|
||||
|
||||
test "fixunssfsi" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try test__fixunssfsi(0.0, 0);
|
||||
|
||||
try test__fixunssfsi(0.5, 0);
|
||||
@ -147,8 +142,6 @@ fn test__fixunssfdi(a: f32, expected: u64) !void {
|
||||
}
|
||||
|
||||
test "fixsfdi" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try test__fixsfdi(-math.floatMax(f32), math.minInt(i64));
|
||||
|
||||
try test__fixsfdi(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i64));
|
||||
@ -204,8 +197,6 @@ test "fixsfdi" {
|
||||
}
|
||||
|
||||
test "fixunssfdi" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try test__fixunssfdi(0.0, 0);
|
||||
|
||||
try test__fixunssfdi(0.5, 0);
|
||||
@ -244,8 +235,6 @@ fn test__fixunssfti(a: f32, expected: u128) !void {
|
||||
}
|
||||
|
||||
test "fixsfti" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try test__fixsfti(-math.floatMax(f32), math.minInt(i128));
|
||||
|
||||
try test__fixsfti(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i128));
|
||||
@ -317,8 +306,6 @@ test "fixsfti" {
|
||||
}
|
||||
|
||||
test "fixunssfti" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try test__fixunssfti(0.0, 0);
|
||||
|
||||
try test__fixunssfti(0.5, 0);
|
||||
@ -365,8 +352,6 @@ fn test__fixunsdfsi(a: f64, expected: u32) !void {
|
||||
}
|
||||
|
||||
test "fixdfsi" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try test__fixdfsi(-math.floatMax(f64), math.minInt(i32));
|
||||
|
||||
try test__fixdfsi(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i32));
|
||||
@ -428,8 +413,6 @@ test "fixdfsi" {
|
||||
}
|
||||
|
||||
test "fixunsdfsi" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try test__fixunsdfsi(0.0, 0);
|
||||
|
||||
try test__fixunsdfsi(0.5, 0);
|
||||
@ -472,8 +455,6 @@ fn test__fixunsdfdi(a: f64, expected: u64) !void {
|
||||
}
|
||||
|
||||
test "fixdfdi" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try test__fixdfdi(-math.floatMax(f64), math.minInt(i64));
|
||||
|
||||
try test__fixdfdi(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i64));
|
||||
@ -527,8 +508,6 @@ test "fixdfdi" {
|
||||
}
|
||||
|
||||
test "fixunsdfdi" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try test__fixunsdfdi(0.0, 0);
|
||||
try test__fixunsdfdi(0.5, 0);
|
||||
try test__fixunsdfdi(0.99, 0);
|
||||
@ -571,8 +550,6 @@ fn test__fixunsdfti(a: f64, expected: u128) !void {
|
||||
}
|
||||
|
||||
test "fixdfti" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try test__fixdfti(-math.floatMax(f64), math.minInt(i128));
|
||||
|
||||
try test__fixdfti(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i128));
|
||||
@ -626,8 +603,6 @@ test "fixdfti" {
|
||||
}
|
||||
|
||||
test "fixunsdfti" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try test__fixunsdfti(0.0, 0);
|
||||
|
||||
try test__fixunsdfti(0.5, 0);
|
||||
@ -677,8 +652,6 @@ fn test__fixunstfsi(a: f128, expected: u32) !void {
|
||||
}
|
||||
|
||||
test "fixtfsi" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try test__fixtfsi(-math.floatMax(f128), math.minInt(i32));
|
||||
|
||||
try test__fixtfsi(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i32));
|
||||
@ -742,8 +715,6 @@ test "fixtfsi" {
|
||||
}
|
||||
|
||||
test "fixunstfsi" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try test__fixunstfsi(math.inf(f128), 0xffffffff);
|
||||
try test__fixunstfsi(0, 0x0);
|
||||
try test__fixunstfsi(0x1.23456789abcdefp+5, 0x24);
|
||||
@ -767,8 +738,6 @@ fn test__fixunstfdi(a: f128, expected: u64) !void {
|
||||
}
|
||||
|
||||
test "fixtfdi" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try test__fixtfdi(-math.floatMax(f128), math.minInt(i64));
|
||||
|
||||
try test__fixtfdi(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i64));
|
||||
@ -832,8 +801,6 @@ test "fixtfdi" {
|
||||
}
|
||||
|
||||
test "fixunstfdi" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try test__fixunstfdi(0.0, 0);
|
||||
|
||||
try test__fixunstfdi(0.5, 0);
|
||||
@ -886,8 +853,6 @@ fn test__fixunstfti(a: f128, expected: u128) !void {
|
||||
}
|
||||
|
||||
test "fixtfti" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try test__fixtfti(-math.floatMax(f128), math.minInt(i128));
|
||||
|
||||
try test__fixtfti(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i128));
|
||||
@ -969,8 +934,6 @@ fn test__fixunshfti(a: f16, expected: u128) !void {
|
||||
}
|
||||
|
||||
test "fixunshfti for f16" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try test__fixunshfti(math.inf(f16), math.maxInt(u128));
|
||||
try test__fixunshfti(math.floatMax(f16), 65504);
|
||||
}
|
||||
|
@ -3,7 +3,6 @@
|
||||
// https://github.com/llvm/llvm-project/blob/2ffb1b0413efa9a24eb3c49e710e36f92e2cb50b/compiler-rt/test/builtins/Unit/multf3_test.c
|
||||
|
||||
const std = @import("std");
|
||||
const builtin = @import("builtin");
|
||||
const math = std.math;
|
||||
const qnan128: f128 = @bitCast(@as(u128, 0x7fff800000000000) << 64);
|
||||
const inf128: f128 = @bitCast(@as(u128, 0x7fff000000000000) << 64);
|
||||
@ -49,9 +48,6 @@ fn makeNaN128(rand: u64) f128 {
|
||||
return @bitCast(int_result);
|
||||
}
|
||||
test "multf3" {
|
||||
if (builtin.zig_backend == .stage2_x86_64 and
|
||||
!comptime std.Target.x86.featureSetHasAll(builtin.cpu.features, .{ .bmi, .lzcnt })) return error.SkipZigTest;
|
||||
|
||||
// qNaN * any = qNaN
|
||||
try test__multf3(qnan128, 0x1.23456789abcdefp+5, 0x7fff800000000000, 0x0);
|
||||
|
||||
|
@ -6,9 +6,7 @@ fn test__negti2(a: i128, expected: i128) !void {
|
||||
try testing.expectEqual(expected, result);
|
||||
}
|
||||
|
||||
test "negti2" {
|
||||
if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
test "negdi2" {
|
||||
// TODO ensuring that math.minInt(i128); returns error
|
||||
|
||||
try test__negti2(-3, 3);
|
||||
|
@ -3,10 +3,8 @@
|
||||
// powihf2 adapted from powisf2 tests
|
||||
|
||||
const powiXf2 = @import("powiXf2.zig");
|
||||
const std = @import("std");
|
||||
const builtin = @import("builtin");
|
||||
const testing = std.testing;
|
||||
const math = std.math;
|
||||
const testing = @import("std").testing;
|
||||
const math = @import("std").math;
|
||||
|
||||
fn test__powihf2(a: f16, b: i32, expected: f16) !void {
|
||||
var result = powiXf2.__powihf2(a, b);
|
||||
@ -34,9 +32,6 @@ fn test__powixf2(a: f80, b: i32, expected: f80) !void {
|
||||
}
|
||||
|
||||
test "powihf2" {
|
||||
if (builtin.zig_backend == .stage2_x86_64 and
|
||||
!comptime std.Target.x86.featureSetHas(builtin.cpu.features, .f16c)) return error.SkipZigTest;
|
||||
|
||||
const inf_f16 = math.inf(f16);
|
||||
try test__powisf2(0, 0, 1);
|
||||
try test__powihf2(1, 0, 1);
|
||||
@ -356,8 +351,6 @@ test "powidf2" {
|
||||
}
|
||||
|
||||
test "powitf2" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const inf_f128 = math.inf(f128);
|
||||
try test__powitf2(0, 0, 1);
|
||||
try test__powitf2(1, 0, 1);
|
||||
@ -463,8 +456,6 @@ test "powitf2" {
|
||||
}
|
||||
|
||||
test "powixf2" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const inf_f80 = math.inf(f80);
|
||||
try test__powixf2(0, 0, 1);
|
||||
try test__powixf2(1, 0, 1);
|
||||
|
@ -140,8 +140,6 @@ pub fn sinl(x: c_longdouble) callconv(.C) c_longdouble {
|
||||
}
|
||||
|
||||
test "sin32" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const epsilon = 0.00001;
|
||||
|
||||
try expect(math.approxEqAbs(f32, sinf(0.0), 0.0, epsilon));
|
||||
|
@ -27,8 +27,6 @@ pub fn simple_suboti4(a: i128, b: i128, overflow: *c_int) i128 {
|
||||
}
|
||||
|
||||
test "suboti3" {
|
||||
if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const min: i128 = math.minInt(i128);
|
||||
const max: i128 = math.maxInt(i128);
|
||||
var i: i128 = 1;
|
||||
|
@ -131,8 +131,6 @@ test "tan" {
|
||||
}
|
||||
|
||||
test "tan32" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const epsilon = 0.00001;
|
||||
|
||||
try expect(math.approxEqAbs(f32, tanf(0.0), 0.0, epsilon));
|
||||
@ -144,8 +142,6 @@ test "tan32" {
|
||||
}
|
||||
|
||||
test "tan64" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const epsilon = 0.000001;
|
||||
|
||||
try expect(math.approxEqAbs(f64, tan(0.0), 0.0, epsilon));
|
||||
|
@ -129,10 +129,7 @@ pub fn __umodei4(r_p: [*]u32, u_p: [*]const u32, v_p: [*]const u32, bits: usize)
|
||||
}
|
||||
|
||||
test "__udivei4/__umodei4" {
|
||||
switch (builtin.zig_backend) {
|
||||
.stage2_c, .stage2_x86_64 => return error.SkipZigTest,
|
||||
else => {},
|
||||
}
|
||||
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
|
||||
|
||||
const RndGen = std.rand.DefaultPrng;
|
||||
var rnd = RndGen.init(42);
|
||||
|
@ -1007,8 +1007,6 @@ test "cache file and then recall it" {
|
||||
return error.SkipZigTest;
|
||||
}
|
||||
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var tmp = testing.tmpDir(.{});
|
||||
defer tmp.cleanup();
|
||||
|
||||
@ -1074,9 +1072,6 @@ test "check that changing a file makes cache fail" {
|
||||
// https://github.com/ziglang/zig/issues/5437
|
||||
return error.SkipZigTest;
|
||||
}
|
||||
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var tmp = testing.tmpDir(.{});
|
||||
defer tmp.cleanup();
|
||||
|
||||
@ -1151,8 +1146,6 @@ test "no file inputs" {
|
||||
return error.SkipZigTest;
|
||||
}
|
||||
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var tmp = testing.tmpDir(.{});
|
||||
defer tmp.cleanup();
|
||||
|
||||
@ -1200,9 +1193,6 @@ test "Manifest with files added after initial hash work" {
|
||||
// https://github.com/ziglang/zig/issues/5437
|
||||
return error.SkipZigTest;
|
||||
}
|
||||
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var tmp = testing.tmpDir(.{});
|
||||
defer tmp.cleanup();
|
||||
|
||||
|
@ -296,8 +296,6 @@ const Arg = struct {
|
||||
test Options {
|
||||
if (builtin.os.tag == .wasi) return error.SkipZigTest;
|
||||
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var arena = std.heap.ArenaAllocator.init(std.testing.allocator);
|
||||
defer arena.deinit();
|
||||
|
||||
|
@ -369,8 +369,6 @@ test "Condition - signal" {
|
||||
return error.SkipZigTest;
|
||||
}
|
||||
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const num_threads = 4;
|
||||
|
||||
const SignalTest = struct {
|
||||
@ -500,8 +498,6 @@ test "Condition - broadcasting" {
|
||||
return error.SkipZigTest;
|
||||
}
|
||||
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const num_threads = 10;
|
||||
|
||||
const BroadcastTest = struct {
|
||||
@ -569,8 +565,6 @@ test "Condition - broadcasting - wake all threads" {
|
||||
return error.SkipZigTest;
|
||||
}
|
||||
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var num_runs: usize = 1;
|
||||
const num_threads = 10;
|
||||
|
||||
|
@ -289,8 +289,6 @@ test "Mutex - many contended" {
|
||||
return error.SkipZigTest;
|
||||
}
|
||||
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const num_threads = 4;
|
||||
const num_increments = 1000;
|
||||
|
||||
|
@ -297,8 +297,6 @@ test "RwLock - concurrent access" {
|
||||
if (builtin.single_threaded)
|
||||
return;
|
||||
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const num_writers: usize = 2;
|
||||
const num_readers: usize = 4;
|
||||
const num_writes: usize = 10000;
|
||||
|
@ -685,8 +685,6 @@ test "Special test" {
|
||||
}
|
||||
|
||||
test "URI escaping" {
|
||||
if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const input = "\\ö/ äöß ~~.adas-https://canvas:123/#ads&&sad";
|
||||
const expected = "%5C%C3%B6%2F%20%C3%A4%C3%B6%C3%9F%20~~.adas-https%3A%2F%2Fcanvas%3A123%2F%23ads%26%26sad";
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
const std = @import("std.zig");
|
||||
const builtin = @import("builtin");
|
||||
const debug = std.debug;
|
||||
const assert = debug.assert;
|
||||
const testing = std.testing;
|
||||
@ -2138,8 +2137,6 @@ test "ensure capacity leak" {
|
||||
}
|
||||
|
||||
test "big map" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var map = AutoArrayHashMap(i32, i32).init(std.testing.allocator);
|
||||
defer map.deinit();
|
||||
|
||||
@ -2193,8 +2190,6 @@ test "big map" {
|
||||
}
|
||||
|
||||
test "clone" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var original = AutoArrayHashMap(i32, i32).init(std.testing.allocator);
|
||||
defer original.deinit();
|
||||
|
||||
@ -2221,8 +2216,6 @@ test "clone" {
|
||||
}
|
||||
|
||||
test "shrink" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var map = AutoArrayHashMap(i32, i32).init(std.testing.allocator);
|
||||
defer map.deinit();
|
||||
|
||||
@ -2263,8 +2256,6 @@ test "shrink" {
|
||||
}
|
||||
|
||||
test "pop" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var map = AutoArrayHashMap(i32, i32).init(std.testing.allocator);
|
||||
defer map.deinit();
|
||||
|
||||
@ -2283,8 +2274,6 @@ test "pop" {
|
||||
}
|
||||
|
||||
test "popOrNull" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var map = AutoArrayHashMap(i32, i32).init(std.testing.allocator);
|
||||
defer map.deinit();
|
||||
|
||||
@ -2305,8 +2294,6 @@ test "popOrNull" {
|
||||
}
|
||||
|
||||
test "reIndex" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var map = ArrayHashMap(i32, i32, AutoContext(i32), true).init(std.testing.allocator);
|
||||
defer map.deinit();
|
||||
|
||||
@ -2351,8 +2338,6 @@ test "auto store_hash" {
|
||||
}
|
||||
|
||||
test "sort" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var map = AutoArrayHashMap(i32, i32).init(std.testing.allocator);
|
||||
defer map.deinit();
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
const std = @import("std.zig");
|
||||
const builtin = @import("builtin");
|
||||
const debug = std.debug;
|
||||
const assert = debug.assert;
|
||||
const testing = std.testing;
|
||||
@ -1184,8 +1183,6 @@ test "std.ArrayList/ArrayListUnmanaged.initCapacity" {
|
||||
}
|
||||
|
||||
test "std.ArrayList/ArrayListUnmanaged.clone" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const a = testing.allocator;
|
||||
{
|
||||
var array = ArrayList(i32).init(a);
|
||||
@ -1227,8 +1224,6 @@ test "std.ArrayList/ArrayListUnmanaged.clone" {
|
||||
}
|
||||
|
||||
test "std.ArrayList/ArrayListUnmanaged.basic" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const a = testing.allocator;
|
||||
{
|
||||
var list = ArrayList(i32).init(a);
|
||||
@ -1513,8 +1508,6 @@ test "std.ArrayList/ArrayListUnmanaged.insert" {
|
||||
}
|
||||
|
||||
test "std.ArrayList/ArrayListUnmanaged.insertSlice" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const a = testing.allocator;
|
||||
{
|
||||
var list = ArrayList(i32).init(a);
|
||||
@ -1561,8 +1554,6 @@ test "std.ArrayList/ArrayListUnmanaged.insertSlice" {
|
||||
}
|
||||
|
||||
test "std.ArrayList/ArrayListUnmanaged.replaceRange" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var arena = std.heap.ArenaAllocator.init(testing.allocator);
|
||||
defer arena.deinit();
|
||||
const a = arena.allocator();
|
||||
@ -1734,8 +1725,6 @@ test "shrink still sets length when resizing is disabled" {
|
||||
}
|
||||
|
||||
test "shrinkAndFree with a copy" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var failing_allocator = testing.FailingAllocator.init(testing.allocator, .{ .resize_fail_index = 0 });
|
||||
const a = failing_allocator.allocator();
|
||||
|
||||
|
@ -374,8 +374,6 @@ const atomic_rmw_orderings = [_]Ordering{
|
||||
};
|
||||
|
||||
test "Atomic.swap" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
inline for (atomic_rmw_orderings) |ordering| {
|
||||
var x = Atomic(usize).init(5);
|
||||
try testing.expectEqual(x.swap(10, ordering), 5);
|
||||
@ -469,8 +467,6 @@ test "Atomic.fetchSub" {
|
||||
}
|
||||
|
||||
test "Atomic.fetchMin" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
inline for (atomicIntTypes()) |Int| {
|
||||
inline for (atomic_rmw_orderings) |ordering| {
|
||||
var x = Atomic(Int).init(5);
|
||||
|
@ -175,8 +175,6 @@ const puts_per_thread = 500;
|
||||
const put_thread_count = 3;
|
||||
|
||||
test "std.atomic.Queue" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var plenty_of_memory = try std.heap.page_allocator.alloc(u8, 300 * 1024);
|
||||
defer std.heap.page_allocator.free(plenty_of_memory);
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
const std = @import("std.zig");
|
||||
const assert = std.debug.assert;
|
||||
const builtin = @import("builtin");
|
||||
const testing = std.testing;
|
||||
const mem = std.mem;
|
||||
|
||||
@ -355,16 +354,12 @@ pub const Base64DecoderWithIgnore = struct {
|
||||
};
|
||||
|
||||
test "base64" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
@setEvalBranchQuota(8000);
|
||||
try testBase64();
|
||||
try comptime testAllApis(standard, "comptime", "Y29tcHRpbWU=");
|
||||
}
|
||||
|
||||
test "base64 padding dest overflow" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const input = "foo";
|
||||
|
||||
var expect: [128]u8 = undefined;
|
||||
@ -379,8 +374,6 @@ test "base64 padding dest overflow" {
|
||||
}
|
||||
|
||||
test "base64 url_safe_no_pad" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
@setEvalBranchQuota(8000);
|
||||
try testBase64UrlSafeNoPad();
|
||||
try comptime testAllApis(url_safe_no_pad, "comptime", "Y29tcHRpbWU");
|
||||
|
@ -33,7 +33,6 @@
|
||||
const std = @import("std.zig");
|
||||
const assert = std.debug.assert;
|
||||
const Allocator = std.mem.Allocator;
|
||||
const builtin = @import("builtin");
|
||||
|
||||
/// Returns the optimal static bit set type for the specified number
|
||||
/// of elements: either `IntegerBitSet` or `ArrayBitSet`,
|
||||
@ -1637,10 +1636,7 @@ fn testStaticBitSet(comptime Set: type) !void {
|
||||
}
|
||||
|
||||
test "IntegerBitSet" {
|
||||
switch (builtin.zig_backend) {
|
||||
.stage2_c, .stage2_x86_64 => return error.SkipZigTest,
|
||||
else => {},
|
||||
}
|
||||
if (@import("builtin").zig_backend == .stage2_c) return error.SkipZigTest;
|
||||
|
||||
try testStaticBitSet(IntegerBitSet(0));
|
||||
try testStaticBitSet(IntegerBitSet(1));
|
||||
@ -1653,11 +1649,6 @@ test "IntegerBitSet" {
|
||||
}
|
||||
|
||||
test "ArrayBitSet" {
|
||||
switch (builtin.zig_backend) {
|
||||
.stage2_x86_64 => return error.SkipZigTest,
|
||||
else => {},
|
||||
}
|
||||
|
||||
inline for (.{ 0, 1, 2, 31, 32, 33, 63, 64, 65, 254, 500, 3000 }) |size| {
|
||||
try testStaticBitSet(ArrayBitSet(u8, size));
|
||||
try testStaticBitSet(ArrayBitSet(u16, size));
|
||||
@ -1668,8 +1659,6 @@ test "ArrayBitSet" {
|
||||
}
|
||||
|
||||
test "DynamicBitSetUnmanaged" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const allocator = std.testing.allocator;
|
||||
var a = try DynamicBitSetUnmanaged.initEmpty(allocator, 300);
|
||||
try testing.expectEqual(@as(usize, 0), a.count());
|
||||
@ -1723,8 +1712,6 @@ test "DynamicBitSetUnmanaged" {
|
||||
}
|
||||
|
||||
test "DynamicBitSet" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const allocator = std.testing.allocator;
|
||||
var a = try DynamicBitSet.initEmpty(allocator, 300);
|
||||
try testing.expectEqual(@as(usize, 0), a.count());
|
||||
|
@ -1069,8 +1069,6 @@ var deflate_tests = [_]DeflateTest{
|
||||
};
|
||||
|
||||
test "deflate" {
|
||||
if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
for (deflate_tests) |dt| {
|
||||
var output = ArrayList(u8).init(testing.allocator);
|
||||
defer output.deinit();
|
||||
|
@ -154,8 +154,6 @@ fn testToFromWithLimit(input: []const u8, limit: [11]u32) !void {
|
||||
}
|
||||
|
||||
test "deflate/inflate" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var limits = [_]u32{0} ** 11;
|
||||
|
||||
var test0 = [_]u8{};
|
||||
@ -180,8 +178,6 @@ test "deflate/inflate" {
|
||||
}
|
||||
|
||||
test "very long sparse chunk" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
// A SparseReader returns a stream consisting of 0s ending with 65,536 (1<<16) 1s.
|
||||
// This tests missing hash references in a very large input.
|
||||
const SparseReader = struct {
|
||||
@ -243,8 +239,6 @@ test "very long sparse chunk" {
|
||||
}
|
||||
|
||||
test "compressor reset" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
for (std.enums.values(deflate.Compression)) |c| {
|
||||
try testWriterReset(c, null);
|
||||
try testWriterReset(c, "dict");
|
||||
@ -295,8 +289,6 @@ fn testWriterReset(level: deflate.Compression, dict: ?[]const u8) !void {
|
||||
}
|
||||
|
||||
test "decompressor dictionary" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const dict = "hello world"; // dictionary
|
||||
const text = "hello again world";
|
||||
|
||||
@ -337,8 +329,6 @@ test "decompressor dictionary" {
|
||||
}
|
||||
|
||||
test "compressor dictionary" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const dict = "hello world";
|
||||
const text = "hello again world";
|
||||
|
||||
@ -385,8 +375,6 @@ test "compressor dictionary" {
|
||||
// Update the hash for best_speed only if d.index < d.maxInsertIndex
|
||||
// See https://golang.org/issue/2508
|
||||
test "Go non-regression test for 2508" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var comp = try compressor(
|
||||
testing.allocator,
|
||||
io.null_writer,
|
||||
@ -404,8 +392,6 @@ test "Go non-regression test for 2508" {
|
||||
}
|
||||
|
||||
test "deflate/inflate string" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const StringTest = struct {
|
||||
filename: []const u8,
|
||||
limit: [11]u32,
|
||||
@ -453,8 +439,6 @@ test "deflate/inflate string" {
|
||||
}
|
||||
|
||||
test "inflate reset" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const strings = [_][]const u8{
|
||||
"lorem ipsum izzle fo rizzle",
|
||||
"the quick brown fox jumped over",
|
||||
@ -501,8 +485,6 @@ test "inflate reset" {
|
||||
}
|
||||
|
||||
test "inflate reset dictionary" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const dict = "the lorem fox";
|
||||
const strings = [_][]const u8{
|
||||
"lorem ipsum izzle fo rizzle",
|
||||
|
@ -649,8 +649,6 @@ test "best speed shift offsets" {
|
||||
}
|
||||
|
||||
test "best speed reset" {
|
||||
if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
// test that encoding is consistent across a warparound of the table offset.
|
||||
// See https://github.com/golang/go/issues/34121
|
||||
const fmt = std.fmt;
|
||||
|
@ -1,5 +1,4 @@
|
||||
const std = @import("std");
|
||||
const builtin = @import("builtin");
|
||||
const expect = std.testing.expect;
|
||||
const io = std.io;
|
||||
const mem = std.mem;
|
||||
@ -12,8 +11,6 @@ const inflate = @import("decompressor.zig");
|
||||
const deflate_const = @import("deflate_const.zig");
|
||||
|
||||
test "best speed" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
// Tests that round-tripping through deflate and then inflate recovers the original input.
|
||||
// The Write sizes are near the thresholds in the compressor.encSpeed method (0, 16, 128), as well
|
||||
// as near `deflate_const.max_store_block_size` (65535).
|
||||
@ -96,8 +93,6 @@ test "best speed" {
|
||||
}
|
||||
|
||||
test "best speed max match offset" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const abc = "abcdefgh";
|
||||
const xyz = "stuvwxyz";
|
||||
const input_margin = 16 - 1;
|
||||
|
@ -845,8 +845,6 @@ const testing = std.testing;
|
||||
const ArrayList = std.ArrayList;
|
||||
|
||||
test "writeBlockHuff" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
// Tests huffman encoding against reference files to detect possible regressions.
|
||||
// If encoding/bit allocation changes you can regenerate these files
|
||||
|
||||
@ -1571,8 +1569,6 @@ const TestType = enum {
|
||||
};
|
||||
|
||||
test "writeBlock" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
// tests if the writeBlock encoding has changed.
|
||||
|
||||
const ttype: TestType = .write_block;
|
||||
@ -1588,8 +1584,6 @@ test "writeBlock" {
|
||||
}
|
||||
|
||||
test "writeBlockDynamic" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
// tests if the writeBlockDynamic encoding has changed.
|
||||
|
||||
const ttype: TestType = .write_dyn_block;
|
||||
|
@ -360,8 +360,6 @@ fn byFreq(context: void, a: LiteralNode, b: LiteralNode) bool {
|
||||
}
|
||||
|
||||
test "generate a Huffman code from an array of frequencies" {
|
||||
if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var freqs: [19]u16 = [_]u16{
|
||||
8, // 0
|
||||
1, // 1
|
||||
|
@ -174,8 +174,6 @@ fn testReader(data: []const u8, comptime expected: []const u8) !void {
|
||||
// https://tools.ietf.org/rfc/rfc1952.txt length=25037 bytes
|
||||
// SHA256=164ef0897b4cbec63abf1b57f069f3599bd0fb7c72c2a4dee21bd7e03ec9af67
|
||||
test "compressed data" {
|
||||
if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try testReader(
|
||||
@embedFile("testdata/rfc1952.txt.gz"),
|
||||
@embedFile("testdata/rfc1952.txt"),
|
||||
|
@ -1,5 +1,4 @@
|
||||
const std = @import("../../std.zig");
|
||||
const builtin = @import("builtin");
|
||||
const lzma = @import("../lzma.zig");
|
||||
|
||||
fn testDecompress(compressed: []const u8) ![]u8 {
|
||||
@ -23,8 +22,6 @@ fn testDecompressError(expected: anyerror, compressed: []const u8) !void {
|
||||
}
|
||||
|
||||
test "LZMA: decompress empty world" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try testDecompressEqual(
|
||||
"",
|
||||
&[_]u8{
|
||||
@ -35,8 +32,6 @@ test "LZMA: decompress empty world" {
|
||||
}
|
||||
|
||||
test "LZMA: decompress hello world" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try testDecompressEqual(
|
||||
"Hello world\n",
|
||||
&[_]u8{
|
||||
@ -48,8 +43,6 @@ test "LZMA: decompress hello world" {
|
||||
}
|
||||
|
||||
test "LZMA: decompress huge dict" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try testDecompressEqual(
|
||||
"Hello world\n",
|
||||
&[_]u8{
|
||||
@ -61,8 +54,6 @@ test "LZMA: decompress huge dict" {
|
||||
}
|
||||
|
||||
test "LZMA: unknown size with end of payload marker" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try testDecompressEqual(
|
||||
"Hello\nWorld!\n",
|
||||
@embedFile("testdata/good-unknown_size-with_eopm.lzma"),
|
||||
@ -70,8 +61,6 @@ test "LZMA: unknown size with end of payload marker" {
|
||||
}
|
||||
|
||||
test "LZMA: known size without end of payload marker" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try testDecompressEqual(
|
||||
"Hello\nWorld!\n",
|
||||
@embedFile("testdata/good-known_size-without_eopm.lzma"),
|
||||
@ -79,8 +68,6 @@ test "LZMA: known size without end of payload marker" {
|
||||
}
|
||||
|
||||
test "LZMA: known size with end of payload marker" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try testDecompressEqual(
|
||||
"Hello\nWorld!\n",
|
||||
@embedFile("testdata/good-known_size-with_eopm.lzma"),
|
||||
@ -88,8 +75,6 @@ test "LZMA: known size with end of payload marker" {
|
||||
}
|
||||
|
||||
test "LZMA: too big uncompressed size in header" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try testDecompressError(
|
||||
error.CorruptInput,
|
||||
@embedFile("testdata/bad-too_big_size-with_eopm.lzma"),
|
||||
@ -97,8 +82,6 @@ test "LZMA: too big uncompressed size in header" {
|
||||
}
|
||||
|
||||
test "LZMA: too small uncompressed size in header" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try testDecompressError(
|
||||
error.CorruptInput,
|
||||
@embedFile("testdata/bad-too_small_size-without_eopm-3.lzma"),
|
||||
|
@ -50,8 +50,6 @@ const expectEqualSlices = std.testing.expectEqualSlices;
|
||||
const expectError = std.testing.expectError;
|
||||
|
||||
test "Vec2D.init" {
|
||||
if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const allocator = testing.allocator;
|
||||
var vec2d = try Vec2D(i32).init(allocator, 1, .{ 2, 3 });
|
||||
defer vec2d.deinit(allocator);
|
||||
|
@ -19,8 +19,6 @@ fn testReader(data: []const u8, comptime expected: []const u8) !void {
|
||||
}
|
||||
|
||||
test "compressed data" {
|
||||
if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try testReader(@embedFile("testdata/good-0-empty.xz"), "");
|
||||
|
||||
inline for ([_][]const u8{
|
||||
|
@ -199,8 +199,6 @@ fn testDecompress(data: []const u8, expected: []const u8) !void {
|
||||
// https://tools.ietf.org/rfc/rfc1951.txt length=36944 bytes
|
||||
// SHA256=5ebf4b5b7fe1c3a0c0ab9aa3ac8c0f3853a7dc484905e76e03b0b0f301350009
|
||||
test "compressed data" {
|
||||
if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const rfc1951_txt = @embedFile("testdata/rfc1951.txt");
|
||||
|
||||
// Compressed with compression level = 0
|
||||
@ -266,8 +264,6 @@ test "sanity checks" {
|
||||
}
|
||||
|
||||
test "compress data" {
|
||||
if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const allocator = testing.allocator;
|
||||
const rfc1951_txt = @embedFile("testdata/rfc1951.txt");
|
||||
|
||||
|
@ -264,8 +264,6 @@ fn testReader(data: []const u8, comptime expected: []const u8) !void {
|
||||
}
|
||||
|
||||
test "zstandard decompression" {
|
||||
if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const uncompressed = @embedFile("testdata/rfc8478.txt");
|
||||
const compressed3 = @embedFile("testdata/rfc8478.txt.zst.3");
|
||||
const compressed19 = @embedFile("testdata/rfc8478.txt.zst.19");
|
||||
|
@ -314,8 +314,6 @@ test "CSPRNG" {
|
||||
}
|
||||
|
||||
test "issue #4532: no index out of bounds" {
|
||||
if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const types = [_]type{
|
||||
hash.Md5,
|
||||
hash.Sha1,
|
||||
|
@ -1,5 +1,4 @@
|
||||
const std = @import("std");
|
||||
const builtin = @import("builtin");
|
||||
const crypto = std.crypto;
|
||||
|
||||
const IdentityElementError = crypto.errors.IdentityElementError;
|
||||
@ -112,8 +111,6 @@ pub const Curve25519 = struct {
|
||||
};
|
||||
|
||||
test "curve25519" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var s = [32]u8{ 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8 };
|
||||
const p = try Curve25519.basePoint.clampedMul(s);
|
||||
try p.rejectIdentity();
|
||||
@ -128,8 +125,6 @@ test "curve25519" {
|
||||
}
|
||||
|
||||
test "curve25519 small order check" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var s: [32]u8 = [_]u8{1} ++ [_]u8{0} ** 31;
|
||||
const small_order_ss: [7][32]u8 = .{
|
||||
.{
|
||||
|
@ -1,5 +1,5 @@
|
||||
const std = @import("std");
|
||||
const builtin = @import("builtin");
|
||||
const std = @import("std");
|
||||
const crypto = std.crypto;
|
||||
const debug = std.debug;
|
||||
const fmt = std.fmt;
|
||||
@ -484,8 +484,6 @@ pub const Ed25519 = struct {
|
||||
};
|
||||
|
||||
test "ed25519 key pair creation" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var seed: [32]u8 = undefined;
|
||||
_ = try fmt.hexToBytes(seed[0..], "8052030376d47112be7f73ed7a019293dd12ad910b654455798b4667d73de166");
|
||||
const key_pair = try Ed25519.KeyPair.create(seed);
|
||||
@ -495,8 +493,6 @@ test "ed25519 key pair creation" {
|
||||
}
|
||||
|
||||
test "ed25519 signature" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var seed: [32]u8 = undefined;
|
||||
_ = try fmt.hexToBytes(seed[0..], "8052030376d47112be7f73ed7a019293dd12ad910b654455798b4667d73de166");
|
||||
const key_pair = try Ed25519.KeyPair.create(seed);
|
||||
@ -509,8 +505,6 @@ test "ed25519 signature" {
|
||||
}
|
||||
|
||||
test "ed25519 batch verification" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var i: usize = 0;
|
||||
while (i < 100) : (i += 1) {
|
||||
const key_pair = try Ed25519.KeyPair.create(null);
|
||||
@ -540,8 +534,6 @@ test "ed25519 batch verification" {
|
||||
}
|
||||
|
||||
test "ed25519 test vectors" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const Vec = struct {
|
||||
msg_hex: *const [64:0]u8,
|
||||
public_key_hex: *const [64:0]u8,
|
||||
@ -644,8 +636,6 @@ test "ed25519 test vectors" {
|
||||
}
|
||||
|
||||
test "ed25519 with blind keys" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const BlindKeyPair = Ed25519.key_blinding.BlindKeyPair;
|
||||
|
||||
// Create a standard Ed25519 key pair
|
||||
@ -669,8 +659,6 @@ test "ed25519 with blind keys" {
|
||||
}
|
||||
|
||||
test "ed25519 signatures with streaming" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const kp = try Ed25519.KeyPair.create(null);
|
||||
|
||||
var signer = try kp.signer(null);
|
||||
@ -687,8 +675,6 @@ test "ed25519 signatures with streaming" {
|
||||
}
|
||||
|
||||
test "ed25519 key pair from secret key" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
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());
|
||||
|
@ -1,5 +1,4 @@
|
||||
const std = @import("std");
|
||||
const builtin = @import("builtin");
|
||||
const crypto = std.crypto;
|
||||
const debug = std.debug;
|
||||
const fmt = std.fmt;
|
||||
@ -495,8 +494,6 @@ pub const Edwards25519 = struct {
|
||||
const htest = @import("../test.zig");
|
||||
|
||||
test "edwards25519 packing/unpacking" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const s = [_]u8{170} ++ [_]u8{0} ** 31;
|
||||
var b = Edwards25519.basePoint;
|
||||
const pk = try b.mul(s);
|
||||
@ -533,8 +530,6 @@ test "edwards25519 packing/unpacking" {
|
||||
}
|
||||
|
||||
test "edwards25519 point addition/subtraction" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var s1: [32]u8 = undefined;
|
||||
var s2: [32]u8 = undefined;
|
||||
crypto.random.bytes(&s1);
|
||||
@ -549,8 +544,6 @@ test "edwards25519 point addition/subtraction" {
|
||||
}
|
||||
|
||||
test "edwards25519 uniform-to-point" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
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..]);
|
||||
@ -562,8 +555,6 @@ test "edwards25519 uniform-to-point" {
|
||||
|
||||
// Test vectors from draft-irtf-cfrg-hash-to-curve-12
|
||||
test "edwards25519 hash-to-curve operation" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var p = Edwards25519.fromString(true, "QUUX-V01-CS02-with-edwards25519_XMD:SHA-512_ELL2_RO_", "abc");
|
||||
try htest.assertEqual("31558a26887f23fb8218f143e69d5f0af2e7831130bd5b432ef23883b895839a", p.toBytes()[0..]);
|
||||
|
||||
@ -572,8 +563,6 @@ test "edwards25519 hash-to-curve operation" {
|
||||
}
|
||||
|
||||
test "edwards25519 implicit reduction of invalid scalars" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const s = [_]u8{0} ** 31 ++ [_]u8{255};
|
||||
const p1 = try Edwards25519.basePoint.mulPublic(s);
|
||||
const p2 = try Edwards25519.basePoint.mul(s);
|
||||
|
@ -168,8 +168,6 @@ pub const Ristretto255 = struct {
|
||||
};
|
||||
|
||||
test "ristretto255" {
|
||||
if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const p = Ristretto255.basePoint;
|
||||
var buf: [256]u8 = undefined;
|
||||
try std.testing.expectEqualStrings(try std.fmt.bufPrint(&buf, "{s}", .{std.fmt.fmtSliceHexUpper(&p.toBytes())}), "E2F2AE0A6ABC4E71A884A961C500515F58E30B6AA582DD8DB6A65945E08D2D76");
|
||||
|
@ -1,5 +1,4 @@
|
||||
const std = @import("std");
|
||||
const builtin = @import("builtin");
|
||||
const crypto = std.crypto;
|
||||
const mem = std.mem;
|
||||
const fmt = std.fmt;
|
||||
@ -83,8 +82,6 @@ pub const X25519 = struct {
|
||||
const htest = @import("../test.zig");
|
||||
|
||||
test "x25519 public key calculation from secret key" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var sk: [32]u8 = undefined;
|
||||
var pk_expected: [32]u8 = undefined;
|
||||
_ = try fmt.hexToBytes(sk[0..], "8052030376d47112be7f73ed7a019293dd12ad910b654455798b4667d73de166");
|
||||
@ -94,8 +91,6 @@ test "x25519 public key calculation from secret key" {
|
||||
}
|
||||
|
||||
test "x25519 rfc7748 vector1" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
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 };
|
||||
|
||||
@ -106,8 +101,6 @@ test "x25519 rfc7748 vector1" {
|
||||
}
|
||||
|
||||
test "x25519 rfc7748 vector2" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
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 };
|
||||
|
||||
@ -118,8 +111,6 @@ test "x25519 rfc7748 vector2" {
|
||||
}
|
||||
|
||||
test "x25519 rfc7748 one iteration" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
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 };
|
||||
|
||||
@ -137,8 +128,6 @@ test "x25519 rfc7748 one iteration" {
|
||||
}
|
||||
|
||||
test "x25519 rfc7748 1,000 iterations" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
// These iteration tests are slow so we always skip them. Results have been verified.
|
||||
if (true) {
|
||||
return error.SkipZigTest;
|
||||
@ -161,8 +150,6 @@ test "x25519 rfc7748 1,000 iterations" {
|
||||
}
|
||||
|
||||
test "x25519 rfc7748 1,000,000 iterations" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
if (true) {
|
||||
return error.SkipZigTest;
|
||||
}
|
||||
@ -184,8 +171,6 @@ test "x25519 rfc7748 1,000,000 iterations" {
|
||||
}
|
||||
|
||||
test "edwards25519 -> curve25519 map" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const ed_kp = try crypto.sign.Ed25519.KeyPair.create([_]u8{0x42} ** 32);
|
||||
const mont_kp = try X25519.KeyPair.fromEd25519(ed_kp);
|
||||
try htest.assertEqual("90e7595fc89e52fdfddce9c6a43d74dbf6047025ee0462d2d172e8b6a2841d6e", &mont_kp.secret_key);
|
||||
|
@ -624,8 +624,6 @@ pub fn parseTimeDigits(text: *const [2]u8, min: u8, max: u8) !u8 {
|
||||
}
|
||||
|
||||
test parseTimeDigits {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const expectEqual = std.testing.expectEqual;
|
||||
try expectEqual(@as(u8, 0), try parseTimeDigits("00", 0, 99));
|
||||
try expectEqual(@as(u8, 99), try parseTimeDigits("99", 0, 99));
|
||||
@ -647,8 +645,6 @@ pub fn parseYear4(text: *const [4]u8) !u16 {
|
||||
}
|
||||
|
||||
test parseYear4 {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const expectEqual = std.testing.expectEqual;
|
||||
try expectEqual(@as(u16, 0), try parseYear4("0000"));
|
||||
try expectEqual(@as(u16, 9999), try parseYear4("9999"));
|
||||
@ -1123,5 +1119,3 @@ pub const rsa = struct {
|
||||
return res;
|
||||
}
|
||||
};
|
||||
|
||||
const builtin = @import("builtin");
|
||||
|
@ -318,8 +318,6 @@ const MapContext = struct {
|
||||
test "scan for OS-provided certificates" {
|
||||
if (builtin.os.tag == .wasi) return error.SkipZigTest;
|
||||
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var bundle: Bundle = .{};
|
||||
defer bundle.deinit(std.testing.allocator);
|
||||
|
||||
|
@ -17,7 +17,6 @@
|
||||
//! https://datatracker.ietf.org/doc/draft-irtf-cfrg-aegis-aead/
|
||||
|
||||
const std = @import("std");
|
||||
const builtin = @import("builtin");
|
||||
const crypto = std.crypto;
|
||||
const mem = std.mem;
|
||||
const assert = std.debug.assert;
|
||||
@ -514,8 +513,6 @@ const htest = @import("test.zig");
|
||||
const testing = std.testing;
|
||||
|
||||
test "Aegis128L test vector 1" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const key: [Aegis128L.key_length]u8 = [_]u8{ 0x10, 0x01 } ++ [_]u8{0x00} ** 14;
|
||||
const nonce: [Aegis128L.nonce_length]u8 = [_]u8{ 0x10, 0x00, 0x02 } ++ [_]u8{0x00} ** 13;
|
||||
const ad = [8]u8{ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 };
|
||||
@ -539,8 +536,6 @@ test "Aegis128L test vector 1" {
|
||||
}
|
||||
|
||||
test "Aegis128L test vector 2" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const key: [Aegis128L.key_length]u8 = [_]u8{0x00} ** 16;
|
||||
const nonce: [Aegis128L.nonce_length]u8 = [_]u8{0x00} ** 16;
|
||||
const ad = [_]u8{};
|
||||
@ -558,8 +553,6 @@ test "Aegis128L test vector 2" {
|
||||
}
|
||||
|
||||
test "Aegis128L test vector 3" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const key: [Aegis128L.key_length]u8 = [_]u8{0x00} ** 16;
|
||||
const nonce: [Aegis128L.nonce_length]u8 = [_]u8{0x00} ** 16;
|
||||
const ad = [_]u8{};
|
||||
@ -576,8 +569,6 @@ test "Aegis128L test vector 3" {
|
||||
}
|
||||
|
||||
test "Aegis256 test vector 1" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const key: [Aegis256.key_length]u8 = [_]u8{ 0x10, 0x01 } ++ [_]u8{0x00} ** 30;
|
||||
const nonce: [Aegis256.nonce_length]u8 = [_]u8{ 0x10, 0x00, 0x02 } ++ [_]u8{0x00} ** 29;
|
||||
const ad = [8]u8{ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 };
|
||||
@ -601,8 +592,6 @@ test "Aegis256 test vector 1" {
|
||||
}
|
||||
|
||||
test "Aegis256 test vector 2" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const key: [Aegis256.key_length]u8 = [_]u8{0x00} ** 32;
|
||||
const nonce: [Aegis256.nonce_length]u8 = [_]u8{0x00} ** 32;
|
||||
const ad = [_]u8{};
|
||||
@ -620,8 +609,6 @@ test "Aegis256 test vector 2" {
|
||||
}
|
||||
|
||||
test "Aegis256 test vector 3" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const key: [Aegis256.key_length]u8 = [_]u8{0x00} ** 32;
|
||||
const nonce: [Aegis256.nonce_length]u8 = [_]u8{0x00} ** 32;
|
||||
const ad = [_]u8{};
|
||||
@ -638,8 +625,6 @@ test "Aegis256 test vector 3" {
|
||||
}
|
||||
|
||||
test "Aegis MAC" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const key = [_]u8{0x00} ** Aegis128LMac.key_length;
|
||||
var msg: [64]u8 = undefined;
|
||||
for (&msg, 0..) |*m, i| {
|
||||
|
@ -28,8 +28,6 @@ pub const Aes128 = impl.Aes128;
|
||||
pub const Aes256 = impl.Aes256;
|
||||
|
||||
test "ctr" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
// NIST SP 800-38A pp 55-58
|
||||
const ctr = @import("modes.zig").ctr;
|
||||
|
||||
@ -55,8 +53,6 @@ test "ctr" {
|
||||
}
|
||||
|
||||
test "encrypt" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
// Appendix B
|
||||
{
|
||||
const key = [_]u8{ 0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c };
|
||||
@ -86,8 +82,6 @@ test "encrypt" {
|
||||
}
|
||||
|
||||
test "decrypt" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
// Appendix B
|
||||
{
|
||||
const key = [_]u8{ 0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c };
|
||||
@ -117,8 +111,6 @@ test "decrypt" {
|
||||
}
|
||||
|
||||
test "expand 128-bit key" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const key = [_]u8{ 0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c };
|
||||
const exp_enc = [_]*const [32:0]u8{
|
||||
"2b7e151628aed2a6abf7158809cf4f3c", "a0fafe1788542cb123a339392a6c7605", "f2c295f27a96b9435935807a7359f67f", "3d80477d4716fe3e1e237e446d7a883b", "ef44a541a8525b7fb671253bdb0bad00", "d4d1c6f87c839d87caf2b8bc11f915bc", "6d88a37a110b3efddbf98641ca0093fd", "4e54f70e5f5fc9f384a64fb24ea6dc4f", "ead27321b58dbad2312bf5607f8d292f", "ac7766f319fadc2128d12941575c006e", "d014f9a8c9ee2589e13f0cc8b6630ca6",
|
||||
@ -141,8 +133,6 @@ test "expand 128-bit key" {
|
||||
}
|
||||
|
||||
test "expand 256-bit key" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const key = [_]u8{
|
||||
0x60, 0x3d, 0xeb, 0x10,
|
||||
0x15, 0xca, 0x71, 0xbe,
|
||||
|
@ -1,5 +1,4 @@
|
||||
const std = @import("std");
|
||||
const builtin = @import("builtin");
|
||||
const assert = std.debug.assert;
|
||||
const crypto = std.crypto;
|
||||
const debug = std.debug;
|
||||
@ -113,8 +112,6 @@ const htest = @import("test.zig");
|
||||
const testing = std.testing;
|
||||
|
||||
test "Aes256Gcm - Empty message and no associated data" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const key: [Aes256Gcm.key_length]u8 = [_]u8{0x69} ** Aes256Gcm.key_length;
|
||||
const nonce: [Aes256Gcm.nonce_length]u8 = [_]u8{0x42} ** Aes256Gcm.nonce_length;
|
||||
const ad = "";
|
||||
@ -127,8 +124,6 @@ test "Aes256Gcm - Empty message and no associated data" {
|
||||
}
|
||||
|
||||
test "Aes256Gcm - Associated data only" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const key: [Aes256Gcm.key_length]u8 = [_]u8{0x69} ** Aes256Gcm.key_length;
|
||||
const nonce: [Aes256Gcm.nonce_length]u8 = [_]u8{0x42} ** Aes256Gcm.nonce_length;
|
||||
const m = "";
|
||||
@ -141,8 +136,6 @@ test "Aes256Gcm - Associated data only" {
|
||||
}
|
||||
|
||||
test "Aes256Gcm - Message only" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const key: [Aes256Gcm.key_length]u8 = [_]u8{0x69} ** Aes256Gcm.key_length;
|
||||
const nonce: [Aes256Gcm.nonce_length]u8 = [_]u8{0x42} ** Aes256Gcm.nonce_length;
|
||||
const m = "Test with message only";
|
||||
@ -160,8 +153,6 @@ test "Aes256Gcm - Message only" {
|
||||
}
|
||||
|
||||
test "Aes256Gcm - Message and associated data" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const key: [Aes256Gcm.key_length]u8 = [_]u8{0x69} ** Aes256Gcm.key_length;
|
||||
const nonce: [Aes256Gcm.nonce_length]u8 = [_]u8{0x42} ** Aes256Gcm.nonce_length;
|
||||
const m = "Test with message";
|
||||
|
@ -261,10 +261,7 @@ inline fn xorWith(x: *Block, y: Block) void {
|
||||
const hexToBytes = std.fmt.hexToBytes;
|
||||
|
||||
test "AesOcb test vector 1" {
|
||||
switch (builtin.zig_backend) {
|
||||
.stage2_c, .stage2_x86_64 => return error.SkipZigTest,
|
||||
else => {},
|
||||
}
|
||||
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
|
||||
|
||||
var k: [Aes128Ocb.key_length]u8 = undefined;
|
||||
var nonce: [Aes128Ocb.nonce_length]u8 = undefined;
|
||||
@ -283,10 +280,7 @@ test "AesOcb test vector 1" {
|
||||
}
|
||||
|
||||
test "AesOcb test vector 2" {
|
||||
switch (builtin.zig_backend) {
|
||||
.stage2_c, .stage2_x86_64 => return error.SkipZigTest,
|
||||
else => {},
|
||||
}
|
||||
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
|
||||
|
||||
var k: [Aes128Ocb.key_length]u8 = undefined;
|
||||
var nonce: [Aes128Ocb.nonce_length]u8 = undefined;
|
||||
@ -307,10 +301,7 @@ test "AesOcb test vector 2" {
|
||||
}
|
||||
|
||||
test "AesOcb test vector 3" {
|
||||
switch (builtin.zig_backend) {
|
||||
.stage2_c, .stage2_x86_64 => return error.SkipZigTest,
|
||||
else => {},
|
||||
}
|
||||
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
|
||||
|
||||
var k: [Aes128Ocb.key_length]u8 = undefined;
|
||||
var nonce: [Aes128Ocb.nonce_length]u8 = undefined;
|
||||
@ -334,10 +325,7 @@ test "AesOcb test vector 3" {
|
||||
}
|
||||
|
||||
test "AesOcb test vector 4" {
|
||||
switch (builtin.zig_backend) {
|
||||
.stage2_c, .stage2_x86_64 => return error.SkipZigTest,
|
||||
else => {},
|
||||
}
|
||||
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
|
||||
|
||||
var k: [Aes128Ocb.key_length]u8 = undefined;
|
||||
var nonce: [Aes128Ocb.nonce_length]u8 = undefined;
|
||||
|
@ -622,8 +622,6 @@ pub fn strVerify(
|
||||
}
|
||||
|
||||
test "argon2d" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const password = [_]u8{0x01} ** 32;
|
||||
const salt = [_]u8{0x02} ** 16;
|
||||
const secret = [_]u8{0x03} ** 8;
|
||||
@ -649,8 +647,6 @@ test "argon2d" {
|
||||
}
|
||||
|
||||
test "argon2i" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const password = [_]u8{0x01} ** 32;
|
||||
const salt = [_]u8{0x02} ** 16;
|
||||
const secret = [_]u8{0x03} ** 8;
|
||||
@ -676,8 +672,6 @@ test "argon2i" {
|
||||
}
|
||||
|
||||
test "argon2id" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const password = [_]u8{0x01} ** 32;
|
||||
const salt = [_]u8{0x02} ** 16;
|
||||
const secret = [_]u8{0x03} ** 8;
|
||||
@ -703,8 +697,6 @@ test "argon2id" {
|
||||
}
|
||||
|
||||
test "kdf" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const password = "password";
|
||||
const salt = "somesalt";
|
||||
|
||||
@ -904,8 +896,6 @@ test "kdf" {
|
||||
}
|
||||
|
||||
test "phc format hasher" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const allocator = std.testing.allocator;
|
||||
const password = "testpass";
|
||||
|
||||
@ -921,8 +911,6 @@ test "phc format hasher" {
|
||||
}
|
||||
|
||||
test "password hash and password verify" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const allocator = std.testing.allocator;
|
||||
const password = "testpass";
|
||||
|
||||
@ -936,8 +924,6 @@ test "password hash and password verify" {
|
||||
}
|
||||
|
||||
test "kdf derived key length" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const allocator = std.testing.allocator;
|
||||
|
||||
const password = "testpass";
|
||||
|
@ -1,5 +1,4 @@
|
||||
const std = @import("std");
|
||||
const builtin = @import("builtin");
|
||||
const base64 = std.base64;
|
||||
const crypto = std.crypto;
|
||||
const debug = std.debug;
|
||||
@ -754,8 +753,6 @@ pub fn strVerify(
|
||||
}
|
||||
|
||||
test "bcrypt codec" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var salt: [salt_length]u8 = undefined;
|
||||
crypto.random.bytes(&salt);
|
||||
var salt_str: [salt_str_length]u8 = undefined;
|
||||
@ -766,8 +763,6 @@ test "bcrypt codec" {
|
||||
}
|
||||
|
||||
test "bcrypt crypt format" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var hash_options = HashOptions{
|
||||
.params = .{ .rounds_log = 5 },
|
||||
.encoding = .crypt,
|
||||
@ -808,8 +803,6 @@ test "bcrypt crypt format" {
|
||||
}
|
||||
|
||||
test "bcrypt phc format" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var hash_options = HashOptions{
|
||||
.params = .{ .rounds_log = 5 },
|
||||
.encoding = .phc,
|
||||
|
@ -200,7 +200,7 @@ const CompressGeneric = struct {
|
||||
}
|
||||
};
|
||||
|
||||
const compress = if (builtin.cpu.arch == .x86_64 and builtin.zig_backend != .stage2_x86_64)
|
||||
const compress = if (builtin.cpu.arch == .x86_64)
|
||||
CompressVectorized.compress
|
||||
else
|
||||
CompressGeneric.compress;
|
||||
@ -682,8 +682,6 @@ fn testBlake3(hasher: *Blake3, input_len: usize, expected_hex: [262]u8) !void {
|
||||
}
|
||||
|
||||
test "BLAKE3 reference test cases" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var hash_state = Blake3.init(.{});
|
||||
const hash = &hash_state;
|
||||
var keyed_hash_state = Blake3.init(.{ .key = reference_test.key.* });
|
||||
|
@ -499,8 +499,6 @@ fn ChaChaNonVecImpl(comptime rounds_nb: usize) type {
|
||||
fn ChaChaImpl(comptime rounds_nb: usize) type {
|
||||
switch (builtin.cpu.arch) {
|
||||
.x86_64 => {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return ChaChaNonVecImpl(rounds_nb);
|
||||
|
||||
const has_avx2 = std.Target.x86.featureSetHas(builtin.cpu.features, .avx2);
|
||||
const has_avx512f = std.Target.x86.featureSetHas(builtin.cpu.features, .avx512f);
|
||||
if (has_avx512f) return ChaChaVecImpl(rounds_nb, 4);
|
||||
@ -759,8 +757,6 @@ fn XChaChaPoly1305(comptime rounds_nb: usize) type {
|
||||
}
|
||||
|
||||
test "chacha20 AEAD API" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
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";
|
||||
@ -782,8 +778,6 @@ test "chacha20 AEAD API" {
|
||||
|
||||
// https://tools.ietf.org/html/rfc7539#section-2.4.2
|
||||
test "crypto.chacha20 test vector sunscreen" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const expected_result = [_]u8{
|
||||
0x6e, 0x2e, 0x35, 0x9a, 0x25, 0x68, 0xf9, 0x80,
|
||||
0x41, 0xba, 0x07, 0x28, 0xdd, 0x0d, 0x69, 0x81,
|
||||
@ -825,8 +819,6 @@ test "crypto.chacha20 test vector sunscreen" {
|
||||
|
||||
// https://tools.ietf.org/html/draft-agl-tls-chacha20poly1305-04#section-7
|
||||
test "crypto.chacha20 test vector 1" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const expected_result = [_]u8{
|
||||
0x76, 0xb8, 0xe0, 0xad, 0xa0, 0xf1, 0x3d, 0x90,
|
||||
0x40, 0x5d, 0x6a, 0xe5, 0x53, 0x86, 0xbd, 0x28,
|
||||
@ -861,8 +853,6 @@ test "crypto.chacha20 test vector 1" {
|
||||
}
|
||||
|
||||
test "crypto.chacha20 test vector 2" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const expected_result = [_]u8{
|
||||
0x45, 0x40, 0xf0, 0x5a, 0x9f, 0x1f, 0xb2, 0x96,
|
||||
0xd7, 0x73, 0x6e, 0x7b, 0x20, 0x8e, 0x3c, 0x96,
|
||||
@ -897,8 +887,6 @@ test "crypto.chacha20 test vector 2" {
|
||||
}
|
||||
|
||||
test "crypto.chacha20 test vector 3" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const expected_result = [_]u8{
|
||||
0xde, 0x9c, 0xba, 0x7b, 0xf3, 0xd6, 0x9e, 0xf5,
|
||||
0xe7, 0x86, 0xdc, 0x63, 0x97, 0x3f, 0x65, 0x3a,
|
||||
@ -933,8 +921,6 @@ test "crypto.chacha20 test vector 3" {
|
||||
}
|
||||
|
||||
test "crypto.chacha20 test vector 4" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const expected_result = [_]u8{
|
||||
0xef, 0x3f, 0xdf, 0xd6, 0xc6, 0x15, 0x78, 0xfb,
|
||||
0xf5, 0xcf, 0x35, 0xbd, 0x3d, 0xd3, 0x3b, 0x80,
|
||||
@ -969,8 +955,6 @@ test "crypto.chacha20 test vector 4" {
|
||||
}
|
||||
|
||||
test "crypto.chacha20 test vector 5" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const expected_result = [_]u8{
|
||||
0xf7, 0x98, 0xa1, 0x89, 0xf1, 0x95, 0xe6, 0x69,
|
||||
0x82, 0x10, 0x5f, 0xfb, 0x64, 0x0b, 0xb7, 0x75,
|
||||
@ -1043,8 +1027,6 @@ test "crypto.chacha20 test vector 5" {
|
||||
}
|
||||
|
||||
test "seal" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
{
|
||||
const m = "";
|
||||
const ad = "";
|
||||
@ -1095,8 +1077,6 @@ test "seal" {
|
||||
}
|
||||
|
||||
test "open" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
{
|
||||
const c = [_]u8{ 0xa0, 0x78, 0x4d, 0x7a, 0x47, 0x16, 0xf3, 0xfe, 0xb4, 0xf6, 0x4e, 0x7f, 0x4b, 0x39, 0xbf, 0x4 };
|
||||
const ad = "";
|
||||
@ -1161,8 +1141,6 @@ test "open" {
|
||||
}
|
||||
|
||||
test "crypto.xchacha20" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
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.";
|
||||
|
@ -1,5 +1,4 @@
|
||||
const std = @import("std");
|
||||
const builtin = @import("builtin");
|
||||
const crypto = std.crypto;
|
||||
const mem = std.mem;
|
||||
|
||||
@ -94,8 +93,6 @@ pub fn Cmac(comptime BlockCipher: type) type {
|
||||
const testing = std.testing;
|
||||
|
||||
test "CmacAes128 - Example 1: len = 0" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const key = [_]u8{
|
||||
0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c,
|
||||
};
|
||||
@ -109,8 +106,6 @@ test "CmacAes128 - Example 1: len = 0" {
|
||||
}
|
||||
|
||||
test "CmacAes128 - Example 2: len = 16" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const key = [_]u8{
|
||||
0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c,
|
||||
};
|
||||
@ -126,8 +121,6 @@ test "CmacAes128 - Example 2: len = 16" {
|
||||
}
|
||||
|
||||
test "CmacAes128 - Example 3: len = 40" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const key = [_]u8{
|
||||
0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c,
|
||||
};
|
||||
@ -145,8 +138,6 @@ test "CmacAes128 - Example 3: len = 40" {
|
||||
}
|
||||
|
||||
test "CmacAes128 - Example 4: len = 64" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const key = [_]u8{
|
||||
0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c,
|
||||
};
|
||||
|
@ -372,10 +372,7 @@ pub fn Ecdsa(comptime Curve: type, comptime Hash: type) type {
|
||||
}
|
||||
|
||||
test "ECDSA - Basic operations over EcdsaP384Sha384" {
|
||||
switch (builtin.zig_backend) {
|
||||
.stage2_c, .stage2_x86_64 => return error.SkipZigTest,
|
||||
else => {},
|
||||
}
|
||||
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
|
||||
|
||||
const Scheme = EcdsaP384Sha384;
|
||||
const kp = try Scheme.KeyPair.create(null);
|
||||
@ -391,10 +388,7 @@ test "ECDSA - Basic operations over EcdsaP384Sha384" {
|
||||
}
|
||||
|
||||
test "ECDSA - Basic operations over Secp256k1" {
|
||||
switch (builtin.zig_backend) {
|
||||
.stage2_c, .stage2_x86_64 => return error.SkipZigTest,
|
||||
else => {},
|
||||
}
|
||||
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
|
||||
|
||||
const Scheme = EcdsaSecp256k1Sha256oSha256;
|
||||
const kp = try Scheme.KeyPair.create(null);
|
||||
@ -410,10 +404,7 @@ test "ECDSA - Basic operations over Secp256k1" {
|
||||
}
|
||||
|
||||
test "ECDSA - Basic operations over EcdsaP384Sha256" {
|
||||
switch (builtin.zig_backend) {
|
||||
.stage2_c, .stage2_x86_64 => return error.SkipZigTest,
|
||||
else => {},
|
||||
}
|
||||
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
|
||||
|
||||
const Scheme = Ecdsa(crypto.ecc.P384, crypto.hash.sha2.Sha256);
|
||||
const kp = try Scheme.KeyPair.create(null);
|
||||
@ -429,10 +420,7 @@ test "ECDSA - Basic operations over EcdsaP384Sha256" {
|
||||
}
|
||||
|
||||
test "ECDSA - Verifying a existing signature with EcdsaP384Sha256" {
|
||||
switch (builtin.zig_backend) {
|
||||
.stage2_c, .stage2_x86_64 => return error.SkipZigTest,
|
||||
else => {},
|
||||
}
|
||||
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
|
||||
|
||||
const Scheme = Ecdsa(crypto.ecc.P384, crypto.hash.sha2.Sha256);
|
||||
// zig fmt: off
|
||||
@ -476,10 +464,7 @@ const TestVector = struct {
|
||||
};
|
||||
|
||||
test "ECDSA - Test vectors from Project Wycheproof" {
|
||||
switch (builtin.zig_backend) {
|
||||
.stage2_c, .stage2_x86_64 => return error.SkipZigTest,
|
||||
else => {},
|
||||
}
|
||||
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
|
||||
|
||||
const vectors = [_]TestVector{
|
||||
.{ .key = "042927b10512bae3eddcfe467828128bad2903269919f7086069c8c4df6c732838c7787964eaac00e5921fb1498a60f4606766b3d9685001558d1a974e7341513e", .msg = "313233343030", .sig = "304402202ba3a8be6b94d5ec80a6d9d1190a436effe50d85a1eee859b8cc6af9bd5c2e1802204cd60b855d442f5b3c7b11eb6c4e0ae7525fe710fab9aa7c77a67f79e6fadd76", .result = .valid },
|
||||
@ -893,10 +878,7 @@ fn tvTry(vector: TestVector) !void {
|
||||
}
|
||||
|
||||
test "ECDSA - Sec1 encoding/decoding" {
|
||||
switch (builtin.zig_backend) {
|
||||
.stage2_c, .stage2_x86_64 => return error.SkipZigTest,
|
||||
else => {},
|
||||
}
|
||||
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
|
||||
|
||||
const Scheme = EcdsaP384Sha384;
|
||||
const kp = try Scheme.KeyPair.create(null);
|
||||
|
@ -912,10 +912,7 @@ const ct_unprotected = struct {
|
||||
};
|
||||
|
||||
test {
|
||||
switch (@import("builtin").zig_backend) {
|
||||
.stage2_c, .stage2_x86_64 => return error.SkipZigTest,
|
||||
else => {},
|
||||
}
|
||||
if (@import("builtin").zig_backend == .stage2_c) return error.SkipZigTest;
|
||||
|
||||
const M = Modulus(256);
|
||||
const m = try M.fromPrimitive(u256, 3429938563481314093726330772853735541133072814650493833233);
|
||||
|
@ -422,8 +422,6 @@ fn Hash(comptime endian: std.builtin.Endian, comptime shift_key: bool) type {
|
||||
const htest = @import("test.zig");
|
||||
|
||||
test "ghash" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const key = [_]u8{0x42} ** 16;
|
||||
const m = [_]u8{0x69} ** 256;
|
||||
|
||||
@ -441,8 +439,6 @@ test "ghash" {
|
||||
}
|
||||
|
||||
test "ghash2" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var key: [16]u8 = undefined;
|
||||
var i: usize = 0;
|
||||
while (i < key.len) : (i += 1) {
|
||||
@ -476,8 +472,6 @@ test "ghash2" {
|
||||
}
|
||||
|
||||
test "polyval" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const key = [_]u8{0x42} ** 16;
|
||||
const m = [_]u8{0x69} ** 256;
|
||||
|
||||
|
@ -65,8 +65,6 @@ pub const Sha384oSha384 = Composition(sha2.Sha384, sha2.Sha384);
|
||||
pub const Sha512oSha512 = Composition(sha2.Sha512, sha2.Sha512);
|
||||
|
||||
test "Hash composition" {
|
||||
if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const Sha256 = sha2.Sha256;
|
||||
const msg = "test";
|
||||
|
||||
|
@ -72,8 +72,6 @@ pub fn Hkdf(comptime Hmac: type) type {
|
||||
const htest = @import("test.zig");
|
||||
|
||||
test "Hkdf" {
|
||||
if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const ikm = [_]u8{0x0b} ** 22;
|
||||
const salt = [_]u8{ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c };
|
||||
const context = [_]u8{ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9 };
|
||||
|
@ -553,8 +553,6 @@ const inv_ntt_reductions = [_]i16{
|
||||
};
|
||||
|
||||
test "invNTTReductions bounds" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
// Checks whether the reductions proposed by invNTTReductions
|
||||
// don't overflow during invNTT().
|
||||
var xs = [_]i32{1} ** 256; // start at |x| ≤ q
|
||||
@ -658,8 +656,6 @@ fn montReduce(x: i32) i16 {
|
||||
}
|
||||
|
||||
test "Test montReduce" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var rnd = RndGen.init(0);
|
||||
for (0..1000) |_| {
|
||||
const bound = comptime @as(i32, Q) * (1 << 15);
|
||||
@ -678,8 +674,6 @@ fn feToMont(x: i16) i16 {
|
||||
}
|
||||
|
||||
test "Test feToMont" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var x: i32 = -(1 << 15);
|
||||
while (x < 1 << 15) : (x += 1) {
|
||||
const y = feToMont(@as(i16, @intCast(x)));
|
||||
@ -713,8 +707,6 @@ fn feBarrettReduce(x: i16) i16 {
|
||||
}
|
||||
|
||||
test "Test Barrett reduction" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var x: i32 = -(1 << 15);
|
||||
while (x < 1 << 15) : (x += 1) {
|
||||
var y1 = feBarrettReduce(@as(i16, @intCast(x)));
|
||||
@ -735,8 +727,6 @@ fn csubq(x: i16) i16 {
|
||||
}
|
||||
|
||||
test "Test csubq" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var x: i32 = -29439;
|
||||
while (x < 1 << 15) : (x += 1) {
|
||||
const y1 = csubq(@as(i16, @intCast(x)));
|
||||
@ -1476,8 +1466,6 @@ fn cmov(comptime len: usize, dst: *[len]u8, src: [len]u8, b: u1) void {
|
||||
}
|
||||
|
||||
test "MulHat" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var rnd = RndGen.init(0);
|
||||
|
||||
for (0..100) |_| {
|
||||
@ -1509,8 +1497,6 @@ test "MulHat" {
|
||||
}
|
||||
|
||||
test "NTT" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var rnd = RndGen.init(0);
|
||||
|
||||
for (0..1000) |_| {
|
||||
@ -1534,8 +1520,6 @@ test "NTT" {
|
||||
}
|
||||
|
||||
test "Compression" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var rnd = RndGen.init(0);
|
||||
inline for (.{ 1, 4, 5, 10, 11 }) |d| {
|
||||
for (0..1000) |_| {
|
||||
@ -1548,8 +1532,6 @@ test "Compression" {
|
||||
}
|
||||
|
||||
test "noise" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var seed: [32]u8 = undefined;
|
||||
for (&seed, 0..) |*s, i| {
|
||||
s.* = @as(u8, @intCast(i));
|
||||
@ -1596,8 +1578,6 @@ test "noise" {
|
||||
}
|
||||
|
||||
test "uniform sampling" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var seed: [32]u8 = undefined;
|
||||
for (&seed, 0..) |*s, i| {
|
||||
s.* = @as(u8, @intCast(i));
|
||||
@ -1631,8 +1611,6 @@ test "uniform sampling" {
|
||||
}
|
||||
|
||||
test "Polynomial packing" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var rnd = RndGen.init(0);
|
||||
|
||||
for (0..1000) |_| {
|
||||
@ -1642,8 +1620,6 @@ test "Polynomial packing" {
|
||||
}
|
||||
|
||||
test "Test inner PKE" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var seed: [32]u8 = undefined;
|
||||
var pt: [32]u8 = undefined;
|
||||
for (&seed, &pt, 0..) |*s, *p, i| {
|
||||
@ -1665,8 +1641,6 @@ test "Test inner PKE" {
|
||||
}
|
||||
|
||||
test "Test happy flow" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var seed: [64]u8 = undefined;
|
||||
for (&seed, 0..) |*s, i| {
|
||||
s.* = @as(u8, @intCast(i));
|
||||
@ -1693,8 +1667,6 @@ test "Test happy flow" {
|
||||
const sha2 = crypto.hash.sha2;
|
||||
|
||||
test "NIST KAT test" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
inline for (.{
|
||||
.{ Kyber512, "e9c2bd37133fcb40772f81559f14b1f58dccd1c816701be9ba6214d43baf4547" },
|
||||
.{ Kyber1024, "89248f2f33f7f4f7051729111f3049c409a933ec904aedadf035f30fa5646cd5" },
|
||||
|
@ -1,5 +1,4 @@
|
||||
const std = @import("std");
|
||||
const builtin = @import("builtin");
|
||||
const mem = std.mem;
|
||||
const maxInt = std.math.maxInt;
|
||||
const OutputTooLongError = std.crypto.errors.OutputTooLongError;
|
||||
@ -152,8 +151,6 @@ const HmacSha1 = std.crypto.auth.hmac.HmacSha1;
|
||||
// RFC 6070 PBKDF2 HMAC-SHA1 Test Vectors
|
||||
|
||||
test "RFC 6070 one iteration" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const p = "password";
|
||||
const s = "salt";
|
||||
const c = 1;
|
||||
@ -169,8 +166,6 @@ test "RFC 6070 one iteration" {
|
||||
}
|
||||
|
||||
test "RFC 6070 two iterations" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const p = "password";
|
||||
const s = "salt";
|
||||
const c = 2;
|
||||
@ -186,8 +181,6 @@ test "RFC 6070 two iterations" {
|
||||
}
|
||||
|
||||
test "RFC 6070 4096 iterations" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const p = "password";
|
||||
const s = "salt";
|
||||
const c = 4096;
|
||||
@ -203,8 +196,6 @@ test "RFC 6070 4096 iterations" {
|
||||
}
|
||||
|
||||
test "RFC 6070 16,777,216 iterations" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
// These iteration tests are slow so we always skip them. Results have been verified.
|
||||
if (true) {
|
||||
return error.SkipZigTest;
|
||||
@ -225,8 +216,6 @@ test "RFC 6070 16,777,216 iterations" {
|
||||
}
|
||||
|
||||
test "RFC 6070 multi-block salt and password" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const p = "passwordPASSWORDpassword";
|
||||
const s = "saltSALTsaltSALTsaltSALTsaltSALTsalt";
|
||||
const c = 4096;
|
||||
@ -242,8 +231,6 @@ test "RFC 6070 multi-block salt and password" {
|
||||
}
|
||||
|
||||
test "RFC 6070 embedded NUL" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const p = "pass\x00word";
|
||||
const s = "sa\x00lt";
|
||||
const c = 4096;
|
||||
@ -259,8 +246,6 @@ test "RFC 6070 embedded NUL" {
|
||||
}
|
||||
|
||||
test "Very large dk_len" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
// This test allocates 8GB of memory and is expected to take several hours to run.
|
||||
if (true) {
|
||||
return error.SkipZigTest;
|
||||
|
@ -478,7 +478,5 @@ pub const AffineCoordinates = struct {
|
||||
};
|
||||
|
||||
test {
|
||||
if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
_ = @import("tests/p256.zig");
|
||||
}
|
||||
|
@ -478,10 +478,7 @@ pub const AffineCoordinates = struct {
|
||||
};
|
||||
|
||||
test {
|
||||
switch (@import("builtin").zig_backend) {
|
||||
.stage2_c, .stage2_x86_64 => return error.SkipZigTest,
|
||||
else => {},
|
||||
}
|
||||
if (@import("builtin").zig_backend == .stage2_c) return error.SkipZigTest;
|
||||
|
||||
_ = @import("tests/p384.zig");
|
||||
}
|
||||
|
@ -556,10 +556,7 @@ pub const AffineCoordinates = struct {
|
||||
};
|
||||
|
||||
test {
|
||||
switch (@import("builtin").zig_backend) {
|
||||
.stage2_c, .stage2_x86_64 => return error.SkipZigTest,
|
||||
else => {},
|
||||
}
|
||||
if (@import("builtin").zig_backend == .stage2_c) return error.SkipZigTest;
|
||||
|
||||
_ = @import("tests/secp256k1.zig");
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
// https://github.com/P-H-C/phc-string-format
|
||||
|
||||
const std = @import("std");
|
||||
const builtin = @import("builtin");
|
||||
const fmt = std.fmt;
|
||||
const io = std.io;
|
||||
const mem = std.mem;
|
||||
@ -264,8 +263,6 @@ fn kvSplit(str: []const u8) !struct { key: []const u8, value: []const u8 } {
|
||||
}
|
||||
|
||||
test "phc format - encoding/decoding" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const Input = struct {
|
||||
str: []const u8,
|
||||
HashResult: type,
|
||||
@ -351,24 +348,18 @@ test "phc format - encoding/decoding" {
|
||||
}
|
||||
|
||||
test "phc format - empty input string" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const s = "";
|
||||
const v = deserialize(struct { alg_id: []const u8 }, s);
|
||||
try std.testing.expectError(Error.InvalidEncoding, v);
|
||||
}
|
||||
|
||||
test "phc format - hash without salt" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const s = "$scrypt";
|
||||
const v = deserialize(struct { alg_id: []const u8, hash: BinValue(16) }, s);
|
||||
try std.testing.expectError(Error.InvalidEncoding, v);
|
||||
}
|
||||
|
||||
test "phc format - calcSize" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const s = "$scrypt$v=1$ln=15,r=8,p=1$c2FsdHNhbHQ$dGVzdHBhc3M";
|
||||
const v = try deserialize(struct {
|
||||
alg_id: []const u8,
|
||||
|
@ -196,8 +196,6 @@ pub const Poly1305 = struct {
|
||||
};
|
||||
|
||||
test "poly1305 rfc7439 vector1" {
|
||||
if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
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";
|
||||
|
@ -555,8 +555,6 @@ pub const SealedBox = struct {
|
||||
const htest = @import("test.zig");
|
||||
|
||||
test "(x)salsa20" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const key = [_]u8{0x69} ** 32;
|
||||
const nonce = [_]u8{0x42} ** 8;
|
||||
const msg = [_]u8{0} ** 20;
|
||||
@ -571,8 +569,6 @@ test "(x)salsa20" {
|
||||
}
|
||||
|
||||
test "xsalsa20poly1305" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var msg: [100]u8 = undefined;
|
||||
var msg2: [msg.len]u8 = undefined;
|
||||
var c: [msg.len]u8 = undefined;
|
||||
@ -588,8 +584,6 @@ test "xsalsa20poly1305" {
|
||||
}
|
||||
|
||||
test "xsalsa20poly1305 secretbox" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var msg: [100]u8 = undefined;
|
||||
var msg2: [msg.len]u8 = undefined;
|
||||
var key: [XSalsa20Poly1305.key_length]u8 = undefined;
|
||||
@ -604,8 +598,6 @@ test "xsalsa20poly1305 secretbox" {
|
||||
}
|
||||
|
||||
test "xsalsa20poly1305 box" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var msg: [100]u8 = undefined;
|
||||
var msg2: [msg.len]u8 = undefined;
|
||||
var nonce: [Box.nonce_length]u8 = undefined;
|
||||
@ -620,8 +612,6 @@ test "xsalsa20poly1305 box" {
|
||||
}
|
||||
|
||||
test "xsalsa20poly1305 sealedbox" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var msg: [100]u8 = undefined;
|
||||
var msg2: [msg.len]u8 = undefined;
|
||||
var boxed: [msg.len + SealedBox.seal_length]u8 = undefined;
|
||||
@ -633,8 +623,6 @@ test "xsalsa20poly1305 sealedbox" {
|
||||
}
|
||||
|
||||
test "secretbox twoblocks" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const key = [_]u8{ 0xc9, 0xc9, 0x4d, 0xcf, 0x68, 0xbe, 0x00, 0xe4, 0x7f, 0xe6, 0x13, 0x26, 0xfc, 0xc4, 0x2f, 0xd0, 0xdb, 0x93, 0x91, 0x1c, 0x09, 0x94, 0x89, 0xe1, 0x1b, 0x88, 0x63, 0x18, 0x86, 0x64, 0x8b, 0x7b };
|
||||
const nonce = [_]u8{ 0xa4, 0x33, 0xe9, 0x0a, 0x07, 0x68, 0x6e, 0x9a, 0x2b, 0x6d, 0xd4, 0x59, 0x04, 0x72, 0x3e, 0xd3, 0x8a, 0x67, 0x55, 0xc7, 0x9e, 0x3e, 0x77, 0xdc };
|
||||
const msg = [_]u8{'a'} ** 97;
|
||||
|
@ -3,7 +3,6 @@
|
||||
// https://github.com/Tarsnap/scrypt
|
||||
|
||||
const std = @import("std");
|
||||
const builtin = @import("builtin");
|
||||
const crypto = std.crypto;
|
||||
const fmt = std.fmt;
|
||||
const io = std.io;
|
||||
@ -684,8 +683,6 @@ test "unix-scrypt" {
|
||||
}
|
||||
|
||||
test "crypt format" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const str = "$7$C6..../....SodiumChloride$kBGj9fHznVYFQMEn/qDCfrDevf9YDtcDdKvEqHJLV8D";
|
||||
const params = try crypt_format.deserialize(crypt_format.HashResult(32), str);
|
||||
var buf: [str.len]u8 = undefined;
|
||||
@ -694,8 +691,6 @@ test "crypt format" {
|
||||
}
|
||||
|
||||
test "kdf fast" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const TestVector = struct {
|
||||
password: []const u8,
|
||||
salt: []const u8,
|
||||
|
@ -238,7 +238,7 @@ fn Sha2x32(comptime params: Sha2Params32) type {
|
||||
return;
|
||||
},
|
||||
// C backend doesn't currently support passing vectors to inline asm.
|
||||
.x86_64 => if (builtin.zig_backend != .stage2_c and builtin.zig_backend != .stage2_x86_64 and comptime std.Target.x86.featureSetHasAll(builtin.cpu.features, .{ .sha, .avx2 })) {
|
||||
.x86_64 => if (builtin.zig_backend != .stage2_c and comptime std.Target.x86.featureSetHasAll(builtin.cpu.features, .{ .sha, .avx2 })) {
|
||||
var x: v4u32 = [_]u32{ d.s[5], d.s[4], d.s[1], d.s[0] };
|
||||
var y: v4u32 = [_]u32{ d.s[7], d.s[6], d.s[3], d.s[2] };
|
||||
const s_v = @as(*[16]v4u32, @ptrCast(&s));
|
||||
@ -406,16 +406,12 @@ fn Sha2x32(comptime params: Sha2Params32) type {
|
||||
}
|
||||
|
||||
test "sha224 single" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try htest.assertEqualHash(Sha224, "d14a028c2a3a2bc9476102bb288234c415a2b01f828ea62ac5b3e42f", "");
|
||||
try htest.assertEqualHash(Sha224, "23097d223405d8228642a477bda255b32aadbce4bda0b3f7e36c9da7", "abc");
|
||||
try htest.assertEqualHash(Sha224, "c97ca9a559850ce97a04a96def6d99a9e0e0e2ab14e6b8df265fc0b3", "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu");
|
||||
}
|
||||
|
||||
test "sha224 streaming" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var h = Sha224.init(.{});
|
||||
var out: [28]u8 = undefined;
|
||||
|
||||
@ -436,16 +432,12 @@ test "sha224 streaming" {
|
||||
}
|
||||
|
||||
test "sha256 single" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try htest.assertEqualHash(Sha256, "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "");
|
||||
try htest.assertEqualHash(Sha256, "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad", "abc");
|
||||
try htest.assertEqualHash(Sha256, "cf5b16a778af8380036ce59e7b0492370b249b11e8f07a51afac45037afee9d1", "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu");
|
||||
}
|
||||
|
||||
test "sha256 streaming" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var h = Sha256.init(.{});
|
||||
var out: [32]u8 = undefined;
|
||||
|
||||
@ -466,8 +458,6 @@ test "sha256 streaming" {
|
||||
}
|
||||
|
||||
test "sha256 aligned final" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var block = [_]u8{0} ** Sha256.block_length;
|
||||
var out: [Sha256.digest_length]u8 = undefined;
|
||||
|
||||
|
@ -149,8 +149,6 @@ test "crypto.utils.timingSafeEql" {
|
||||
}
|
||||
|
||||
test "crypto.utils.timingSafeEql (vectors)" {
|
||||
if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var a: [100]u8 = undefined;
|
||||
var b: [100]u8 = undefined;
|
||||
random.bytes(a[0..]);
|
||||
|
@ -2513,8 +2513,6 @@ pub fn dumpStackPointerAddr(prefix: []const u8) void {
|
||||
}
|
||||
|
||||
test "manage resources correctly" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
if (builtin.os.tag == .wasi) return error.SkipZigTest;
|
||||
|
||||
if (builtin.os.tag == .windows) {
|
||||
|
@ -1054,8 +1054,6 @@ fn isOpcodeRegisterLocation(opcode: u8) bool {
|
||||
|
||||
const testing = std.testing;
|
||||
test "DWARF expressions" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const allocator = std.testing.allocator;
|
||||
|
||||
const options = ExpressionOptions{};
|
||||
|
@ -505,8 +505,6 @@ test "LinearFifo(u8, .Dynamic)" {
|
||||
}
|
||||
|
||||
test "LinearFifo" {
|
||||
if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
inline for ([_]type{ u1, u8, u16, u64 }) |T| {
|
||||
inline for ([_]LinearFifoBufferType{ LinearFifoBufferType{ .Static = 32 }, .Slice, .Dynamic }) |bt| {
|
||||
const FifoType = LinearFifo(T, bt);
|
||||
|
@ -2129,8 +2129,6 @@ test "int.small" {
|
||||
}
|
||||
|
||||
test "int.specifier" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
{
|
||||
const value: u8 = 'a';
|
||||
try expectFmt("u8: a\n", "u8: {c}\n", .{value});
|
||||
@ -2181,8 +2179,6 @@ test "int.padded" {
|
||||
}
|
||||
|
||||
test "buffer" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
{
|
||||
var buf1: [32]u8 = undefined;
|
||||
var fbs = std.io.fixedBufferStream(&buf1);
|
||||
@ -2379,8 +2375,6 @@ test "float.scientific" {
|
||||
}
|
||||
|
||||
test "float.scientific.precision" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try expectFmt("f64: 1.40971e-42", "f64: {e:.5}", .{@as(f64, 1.409706e-42)});
|
||||
try expectFmt("f64: 1.00000e-09", "f64: {e:.5}", .{@as(f64, @as(f32, @bitCast(@as(u32, 814313563))))});
|
||||
try expectFmt("f64: 7.81250e-03", "f64: {e:.5}", .{@as(f64, @as(f32, @bitCast(@as(u32, 1006632960))))});
|
||||
@ -2441,8 +2435,6 @@ test "float.hexadecimal" {
|
||||
}
|
||||
|
||||
test "float.hexadecimal.precision" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try expectFmt("f16: 0x1.5p-2", "f16: {x:.1}", .{@as(f16, 1.0 / 3.0)});
|
||||
try expectFmt("f32: 0x1.555p-2", "f32: {x:.3}", .{@as(f32, 1.0 / 3.0)});
|
||||
try expectFmt("f64: 0x1.55555p-2", "f64: {x:.5}", .{@as(f64, 1.0 / 3.0)});
|
||||
@ -2457,8 +2449,6 @@ test "float.hexadecimal.precision" {
|
||||
}
|
||||
|
||||
test "float.decimal" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try expectFmt("f64: 152314000000000000000000000000", "f64: {d}", .{@as(f64, 1.52314e+29)});
|
||||
try expectFmt("f32: 0", "f32: {d}", .{@as(f32, 0.0)});
|
||||
try expectFmt("f32: 0", "f32: {d:.0}", .{@as(f32, 0.0)});
|
||||
@ -2482,8 +2472,6 @@ test "float.decimal" {
|
||||
}
|
||||
|
||||
test "float.libc.sanity" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try expectFmt("f64: 0.00001", "f64: {d:.5}", .{@as(f64, @as(f32, @bitCast(@as(u32, 916964781))))});
|
||||
try expectFmt("f64: 0.00001", "f64: {d:.5}", .{@as(f64, @as(f32, @bitCast(@as(u32, 925353389))))});
|
||||
try expectFmt("f64: 0.10000", "f64: {d:.5}", .{@as(f64, @as(f32, @bitCast(@as(u32, 1036831278))))});
|
||||
@ -2503,8 +2491,6 @@ test "float.libc.sanity" {
|
||||
}
|
||||
|
||||
test "custom" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const Vec2 = struct {
|
||||
const SelfType = @This();
|
||||
x: f32,
|
||||
@ -2683,8 +2669,6 @@ test "formatFloatValue with comptime_float" {
|
||||
}
|
||||
|
||||
test "formatType max_depth" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const Vec2 = struct {
|
||||
const SelfType = @This();
|
||||
x: f32,
|
||||
@ -2751,8 +2735,6 @@ test "formatType max_depth" {
|
||||
}
|
||||
|
||||
test "positional" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try expectFmt("2 1 0", "{2} {1} {0}", .{ @as(usize, 0), @as(usize, 1), @as(usize, 2) });
|
||||
try expectFmt("2 1 0", "{2} {1} {}", .{ @as(usize, 0), @as(usize, 1), @as(usize, 2) });
|
||||
try expectFmt("0 0", "{0} {0}", .{@as(usize, 0)});
|
||||
@ -2761,20 +2743,14 @@ test "positional" {
|
||||
}
|
||||
|
||||
test "positional with specifier" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try expectFmt("10.0", "{0d:.1}", .{@as(f64, 9.999)});
|
||||
}
|
||||
|
||||
test "positional/alignment/width/precision" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try expectFmt("10.0", "{0d: >3.1}", .{@as(f64, 9.999)});
|
||||
}
|
||||
|
||||
test "vector" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
if (builtin.target.cpu.arch == .riscv64) {
|
||||
// https://github.com/ziglang/zig/issues/4486
|
||||
return error.SkipZigTest;
|
||||
|
@ -1,8 +1,8 @@
|
||||
pub const parseFloat = @import("parse_float/parse_float.zig").parseFloat;
|
||||
pub const ParseFloatError = @import("parse_float/parse_float.zig").ParseFloatError;
|
||||
|
||||
const std = @import("std");
|
||||
const builtin = @import("builtin");
|
||||
const std = @import("std");
|
||||
const math = std.math;
|
||||
const testing = std.testing;
|
||||
const expect = testing.expect;
|
||||
@ -14,8 +14,6 @@ const epsilon = 1e-7;
|
||||
// See https://github.com/tiehuis/parse-number-fxx-test-data for a wider-selection of test-data.
|
||||
|
||||
test "fmt.parseFloat" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
inline for ([_]type{ f16, f32, f64, f128 }) |T| {
|
||||
try testing.expectError(error.InvalidCharacter, parseFloat(T, ""));
|
||||
try testing.expectError(error.InvalidCharacter, parseFloat(T, " 1"));
|
||||
@ -72,8 +70,6 @@ test "fmt.parseFloat" {
|
||||
}
|
||||
|
||||
test "fmt.parseFloat nan and inf" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
inline for ([_]type{ f16, f32, f64, f128 }) |T| {
|
||||
const Z = std.meta.Int(.unsigned, @typeInfo(T).Float.bits);
|
||||
|
||||
@ -84,22 +80,16 @@ test "fmt.parseFloat nan and inf" {
|
||||
}
|
||||
|
||||
test "fmt.parseFloat #11169" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try expectEqual(try parseFloat(f128, "9007199254740993.0"), 9007199254740993.0);
|
||||
}
|
||||
|
||||
test "fmt.parseFloat hex.special" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
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" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
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"));
|
||||
@ -108,8 +98,6 @@ test "fmt.parseFloat hex.zero" {
|
||||
}
|
||||
|
||||
test "fmt.parseFloat hex.f16" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
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);
|
||||
@ -126,8 +114,6 @@ test "fmt.parseFloat hex.f16" {
|
||||
}
|
||||
|
||||
test "fmt.parseFloat hex.f32" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
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);
|
||||
@ -162,8 +148,6 @@ test "fmt.parseFloat hex.f64" {
|
||||
try testing.expectEqual(try parseFloat(f64, "-0x1p-1074"), -math.floatTrueMin(f64));
|
||||
}
|
||||
test "fmt.parseFloat hex.f128" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
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);
|
||||
|
@ -3244,15 +3244,13 @@ fn copy_file(fd_in: os.fd_t, fd_out: os.fd_t, maybe_size: ?u64) CopyFileRawError
|
||||
}
|
||||
|
||||
test {
|
||||
if (builtin.zig_backend != .stage2_x86_64) {
|
||||
if (builtin.os.tag != .wasi) {
|
||||
_ = &makeDirAbsolute;
|
||||
_ = &makeDirAbsoluteZ;
|
||||
_ = ©FileAbsolute;
|
||||
_ = &updateFileAbsolute;
|
||||
}
|
||||
_ = &Dir.copyFile;
|
||||
if (builtin.os.tag != .wasi) {
|
||||
_ = &makeDirAbsolute;
|
||||
_ = &makeDirAbsoluteZ;
|
||||
_ = ©FileAbsolute;
|
||||
_ = &updateFileAbsolute;
|
||||
}
|
||||
_ = &Dir.copyFile;
|
||||
_ = @import("fs/test.zig");
|
||||
_ = @import("fs/path.zig");
|
||||
_ = @import("fs/file.zig");
|
||||
|
@ -124,8 +124,6 @@ fn testWithAllSupportedPathTypes(test_func: anytype) !void {
|
||||
}
|
||||
|
||||
test "Dir.readLink" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try testWithAllSupportedPathTypes(struct {
|
||||
fn impl(ctx: *TestContext) !void {
|
||||
// Create some targets
|
||||
@ -163,8 +161,6 @@ fn testReadLink(dir: Dir, target_path: []const u8, symlink_path: []const u8) !vo
|
||||
}
|
||||
|
||||
test "relative symlink to parent directory" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var tmp = tmpDir(.{});
|
||||
defer tmp.cleanup();
|
||||
|
||||
@ -182,8 +178,6 @@ test "relative symlink to parent directory" {
|
||||
}
|
||||
|
||||
test "openDir" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try testWithAllSupportedPathTypes(struct {
|
||||
fn impl(ctx: *TestContext) !void {
|
||||
const allocator = ctx.arena.allocator();
|
||||
@ -202,8 +196,6 @@ test "openDir" {
|
||||
test "accessAbsolute" {
|
||||
if (builtin.os.tag == .wasi) return error.SkipZigTest;
|
||||
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var tmp = tmpDir(.{});
|
||||
defer tmp.cleanup();
|
||||
|
||||
@ -222,8 +214,6 @@ test "accessAbsolute" {
|
||||
test "openDirAbsolute" {
|
||||
if (builtin.os.tag == .wasi) return error.SkipZigTest;
|
||||
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var tmp = tmpDir(.{});
|
||||
defer tmp.cleanup();
|
||||
|
||||
@ -262,8 +252,6 @@ test "openDir non-cwd parent .." {
|
||||
else => {},
|
||||
}
|
||||
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var tmp = tmpDir(.{});
|
||||
defer tmp.cleanup();
|
||||
|
||||
@ -285,8 +273,6 @@ test "openDir non-cwd parent .." {
|
||||
test "readLinkAbsolute" {
|
||||
if (builtin.os.tag == .wasi) return error.SkipZigTest;
|
||||
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var tmp = tmpDir(.{});
|
||||
defer tmp.cleanup();
|
||||
|
||||
@ -337,8 +323,6 @@ fn testReadLinkAbsolute(target_path: []const u8, symlink_path: []const u8) !void
|
||||
}
|
||||
|
||||
test "Dir.Iterator" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var tmp_dir = tmpIterableDir(.{});
|
||||
defer tmp_dir.cleanup();
|
||||
|
||||
@ -369,8 +353,6 @@ test "Dir.Iterator" {
|
||||
}
|
||||
|
||||
test "Dir.Iterator many entries" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var tmp_dir = tmpIterableDir(.{});
|
||||
defer tmp_dir.cleanup();
|
||||
|
||||
@ -406,8 +388,6 @@ test "Dir.Iterator many entries" {
|
||||
}
|
||||
|
||||
test "Dir.Iterator twice" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var tmp_dir = tmpIterableDir(.{});
|
||||
defer tmp_dir.cleanup();
|
||||
|
||||
@ -441,8 +421,6 @@ test "Dir.Iterator twice" {
|
||||
}
|
||||
|
||||
test "Dir.Iterator reset" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var tmp_dir = tmpIterableDir(.{});
|
||||
defer tmp_dir.cleanup();
|
||||
|
||||
@ -479,8 +457,6 @@ test "Dir.Iterator reset" {
|
||||
}
|
||||
|
||||
test "Dir.Iterator but dir is deleted during iteration" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var tmp = std.testing.tmpDir(.{});
|
||||
defer tmp.cleanup();
|
||||
|
||||
@ -523,8 +499,6 @@ fn contains(entries: *const std.ArrayList(IterableDir.Entry), el: IterableDir.En
|
||||
test "Dir.realpath smoke test" {
|
||||
if (!comptime std.os.isGetFdPathSupportedOnTarget(builtin.os)) return error.SkipZigTest;
|
||||
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try testWithAllSupportedPathTypes(struct {
|
||||
fn impl(ctx: *TestContext) !void {
|
||||
const allocator = ctx.arena.allocator();
|
||||
@ -575,8 +549,6 @@ test "Dir.realpath smoke test" {
|
||||
}
|
||||
|
||||
test "readAllAlloc" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var tmp_dir = tmpDir(.{});
|
||||
defer tmp_dir.cleanup();
|
||||
|
||||
@ -613,8 +585,6 @@ test "Dir.statFile" {
|
||||
// TODO: Re-enable once https://github.com/ziglang/zig/issues/17034 is solved
|
||||
if (builtin.os.tag == .linux and builtin.link_libc and builtin.abi == .gnu) return error.SkipZigTest;
|
||||
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try testWithAllSupportedPathTypes(struct {
|
||||
fn impl(ctx: *TestContext) !void {
|
||||
const test_file_name = try ctx.transformPath("test_file");
|
||||
@ -630,8 +600,6 @@ test "Dir.statFile" {
|
||||
}
|
||||
|
||||
test "directory operations on files" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try testWithAllSupportedPathTypes(struct {
|
||||
fn impl(ctx: *TestContext) !void {
|
||||
const test_file_name = try ctx.transformPath("test_file");
|
||||
@ -661,8 +629,6 @@ test "file operations on directories" {
|
||||
// TODO: fix this test on FreeBSD. https://github.com/ziglang/zig/issues/1759
|
||||
if (builtin.os.tag == .freebsd) return error.SkipZigTest;
|
||||
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try testWithAllSupportedPathTypes(struct {
|
||||
fn impl(ctx: *TestContext) !void {
|
||||
const test_dir_name = try ctx.transformPath("test_dir");
|
||||
@ -710,8 +676,6 @@ test "makeOpenPath parent dirs do not exist" {
|
||||
}
|
||||
|
||||
test "deleteDir" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try testWithAllSupportedPathTypes(struct {
|
||||
fn impl(ctx: *TestContext) !void {
|
||||
const test_dir_path = try ctx.transformPath("test_dir");
|
||||
@ -733,8 +697,6 @@ test "deleteDir" {
|
||||
}
|
||||
|
||||
test "Dir.rename files" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try testWithAllSupportedPathTypes(struct {
|
||||
fn impl(ctx: *TestContext) !void {
|
||||
// Rename on Windows can hit intermittent AccessDenied errors
|
||||
@ -777,8 +739,6 @@ test "Dir.rename files" {
|
||||
}
|
||||
|
||||
test "Dir.rename directories" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try testWithAllSupportedPathTypes(struct {
|
||||
fn impl(ctx: *TestContext) !void {
|
||||
// Rename on Windows can hit intermittent AccessDenied errors
|
||||
@ -820,8 +780,6 @@ test "Dir.rename directory onto empty dir" {
|
||||
// TODO: Fix on Windows, see https://github.com/ziglang/zig/issues/6364
|
||||
if (builtin.os.tag == .windows) return error.SkipZigTest;
|
||||
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try testWithAllSupportedPathTypes(struct {
|
||||
fn impl(ctx: *TestContext) !void {
|
||||
const test_dir_path = try ctx.transformPath("test_dir");
|
||||
@ -843,8 +801,6 @@ test "Dir.rename directory onto non-empty dir" {
|
||||
// TODO: Fix on Windows, see https://github.com/ziglang/zig/issues/6364
|
||||
if (builtin.os.tag == .windows) return error.SkipZigTest;
|
||||
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try testWithAllSupportedPathTypes(struct {
|
||||
fn impl(ctx: *TestContext) !void {
|
||||
const test_dir_path = try ctx.transformPath("test_dir");
|
||||
@ -871,8 +827,6 @@ test "Dir.rename file <-> dir" {
|
||||
// TODO: Fix on Windows, see https://github.com/ziglang/zig/issues/6364
|
||||
if (builtin.os.tag == .windows) return error.SkipZigTest;
|
||||
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try testWithAllSupportedPathTypes(struct {
|
||||
fn impl(ctx: *TestContext) !void {
|
||||
const test_file_path = try ctx.transformPath("test_file");
|
||||
@ -888,8 +842,6 @@ test "Dir.rename file <-> dir" {
|
||||
}
|
||||
|
||||
test "rename" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var tmp_dir1 = tmpDir(.{});
|
||||
defer tmp_dir1.cleanup();
|
||||
|
||||
@ -912,8 +864,6 @@ test "rename" {
|
||||
test "renameAbsolute" {
|
||||
if (builtin.os.tag == .wasi) return error.SkipZigTest;
|
||||
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var tmp_dir = tmpDir(.{});
|
||||
defer tmp_dir.cleanup();
|
||||
|
||||
@ -972,8 +922,6 @@ test "openSelfExe" {
|
||||
}
|
||||
|
||||
test "makePath, put some files in it, deleteTree" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try testWithAllSupportedPathTypes(struct {
|
||||
fn impl(ctx: *TestContext) !void {
|
||||
const allocator = ctx.arena.allocator();
|
||||
@ -990,8 +938,6 @@ test "makePath, put some files in it, deleteTree" {
|
||||
}
|
||||
|
||||
test "makePath, put some files in it, deleteTreeMinStackSize" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try testWithAllSupportedPathTypes(struct {
|
||||
fn impl(ctx: *TestContext) !void {
|
||||
const allocator = ctx.arena.allocator();
|
||||
@ -1010,8 +956,6 @@ test "makePath, put some files in it, deleteTreeMinStackSize" {
|
||||
test "makePath in a directory that no longer exists" {
|
||||
if (builtin.os.tag == .windows) return error.SkipZigTest; // Windows returns FileBusy if attempting to remove an open dir
|
||||
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var tmp = tmpDir(.{});
|
||||
defer tmp.cleanup();
|
||||
try tmp.parent_dir.deleteTree(&tmp.sub_path);
|
||||
@ -1043,8 +987,6 @@ fn testFilenameLimits(iterable_dir: IterableDir, maxed_filename: []const u8) !vo
|
||||
}
|
||||
|
||||
test "max file name component lengths" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var tmp = tmpIterableDir(.{});
|
||||
defer tmp.cleanup();
|
||||
|
||||
@ -1066,8 +1008,6 @@ test "max file name component lengths" {
|
||||
}
|
||||
|
||||
test "writev, readv" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var tmp = tmpDir(.{});
|
||||
defer tmp.cleanup();
|
||||
|
||||
@ -1110,8 +1050,6 @@ test "writev, readv" {
|
||||
}
|
||||
|
||||
test "pwritev, preadv" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var tmp = tmpDir(.{});
|
||||
defer tmp.cleanup();
|
||||
|
||||
@ -1153,8 +1091,6 @@ test "pwritev, preadv" {
|
||||
}
|
||||
|
||||
test "access file" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try testWithAllSupportedPathTypes(struct {
|
||||
fn impl(ctx: *TestContext) !void {
|
||||
const dir_path = try ctx.transformPath("os_test_tmp");
|
||||
@ -1171,8 +1107,6 @@ test "access file" {
|
||||
}
|
||||
|
||||
test "sendfile" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var tmp = tmpDir(.{});
|
||||
defer tmp.cleanup();
|
||||
|
||||
@ -1238,8 +1172,6 @@ test "sendfile" {
|
||||
}
|
||||
|
||||
test "copyRangeAll" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var tmp = tmpDir(.{});
|
||||
defer tmp.cleanup();
|
||||
|
||||
@ -1266,8 +1198,6 @@ test "copyRangeAll" {
|
||||
}
|
||||
|
||||
test "copyFile" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try testWithAllSupportedPathTypes(struct {
|
||||
fn impl(ctx: *TestContext) !void {
|
||||
const data = "u6wj+JmdF3qHsFPE BUlH2g4gJCmEz0PP";
|
||||
@ -1298,8 +1228,6 @@ fn expectFileContents(dir: Dir, file_path: []const u8, data: []const u8) !void {
|
||||
}
|
||||
|
||||
test "AtomicFile" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try testWithAllSupportedPathTypes(struct {
|
||||
fn impl(ctx: *TestContext) !void {
|
||||
const allocator = ctx.arena.allocator();
|
||||
@ -1326,8 +1254,6 @@ test "AtomicFile" {
|
||||
test "open file with exclusive nonblocking lock twice" {
|
||||
if (builtin.os.tag == .wasi) return error.SkipZigTest;
|
||||
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try testWithAllSupportedPathTypes(struct {
|
||||
fn impl(ctx: *TestContext) !void {
|
||||
const filename = try ctx.transformPath("file_nonblocking_lock_test.txt");
|
||||
@ -1344,8 +1270,6 @@ test "open file with exclusive nonblocking lock twice" {
|
||||
test "open file with shared and exclusive nonblocking lock" {
|
||||
if (builtin.os.tag == .wasi) return error.SkipZigTest;
|
||||
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try testWithAllSupportedPathTypes(struct {
|
||||
fn impl(ctx: *TestContext) !void {
|
||||
const filename = try ctx.transformPath("file_nonblocking_lock_test.txt");
|
||||
@ -1362,8 +1286,6 @@ test "open file with shared and exclusive nonblocking lock" {
|
||||
test "open file with exclusive and shared nonblocking lock" {
|
||||
if (builtin.os.tag == .wasi) return error.SkipZigTest;
|
||||
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try testWithAllSupportedPathTypes(struct {
|
||||
fn impl(ctx: *TestContext) !void {
|
||||
const filename = try ctx.transformPath("file_nonblocking_lock_test.txt");
|
||||
@ -1378,8 +1300,6 @@ test "open file with exclusive and shared nonblocking lock" {
|
||||
}
|
||||
|
||||
test "open file with exclusive lock twice, make sure second lock waits" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
if (builtin.single_threaded) return error.SkipZigTest;
|
||||
|
||||
if (std.io.is_async) {
|
||||
@ -1430,8 +1350,6 @@ test "open file with exclusive lock twice, make sure second lock waits" {
|
||||
test "open file with exclusive nonblocking lock twice (absolute paths)" {
|
||||
if (builtin.os.tag == .wasi) return error.SkipZigTest;
|
||||
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var random_bytes: [12]u8 = undefined;
|
||||
std.crypto.random.bytes(&random_bytes);
|
||||
|
||||
@ -1466,8 +1384,6 @@ test "open file with exclusive nonblocking lock twice (absolute paths)" {
|
||||
test "walker" {
|
||||
if (builtin.os.tag == .wasi and builtin.link_libc) return error.SkipZigTest;
|
||||
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var tmp = tmpIterableDir(.{});
|
||||
defer tmp.cleanup();
|
||||
|
||||
@ -1521,8 +1437,6 @@ test "walker" {
|
||||
test "walker without fully iterating" {
|
||||
if (builtin.os.tag == .wasi and builtin.link_libc) return error.SkipZigTest;
|
||||
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var tmp = tmpIterableDir(.{});
|
||||
defer tmp.cleanup();
|
||||
|
||||
@ -1546,8 +1460,6 @@ test "walker without fully iterating" {
|
||||
test ". and .. in fs.Dir functions" {
|
||||
if (builtin.os.tag == .wasi and builtin.link_libc) return error.SkipZigTest;
|
||||
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
if (builtin.os.tag == .windows and builtin.cpu.arch == .aarch64) {
|
||||
// https://github.com/ziglang/zig/issues/17134
|
||||
return error.SkipZigTest;
|
||||
@ -1588,8 +1500,6 @@ test ". and .. in fs.Dir functions" {
|
||||
test ". and .. in absolute functions" {
|
||||
if (builtin.os.tag == .wasi) return error.SkipZigTest;
|
||||
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var tmp = tmpDir(.{});
|
||||
defer tmp.cleanup();
|
||||
|
||||
@ -1635,8 +1545,6 @@ test "chmod" {
|
||||
if (builtin.os.tag == .windows or builtin.os.tag == .wasi)
|
||||
return error.SkipZigTest;
|
||||
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var tmp = tmpDir(.{});
|
||||
defer tmp.cleanup();
|
||||
|
||||
@ -1659,8 +1567,6 @@ test "chown" {
|
||||
if (builtin.os.tag == .windows or builtin.os.tag == .wasi)
|
||||
return error.SkipZigTest;
|
||||
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var tmp = tmpDir(.{});
|
||||
defer tmp.cleanup();
|
||||
|
||||
@ -1676,8 +1582,6 @@ test "chown" {
|
||||
}
|
||||
|
||||
test "File.Metadata" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var tmp = tmpDir(.{});
|
||||
defer tmp.cleanup();
|
||||
|
||||
@ -1696,8 +1600,6 @@ test "File.Permissions" {
|
||||
if (builtin.os.tag == .wasi)
|
||||
return error.SkipZigTest;
|
||||
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var tmp = tmpDir(.{});
|
||||
defer tmp.cleanup();
|
||||
|
||||
@ -1724,8 +1626,6 @@ test "File.PermissionsUnix" {
|
||||
if (builtin.os.tag == .windows or builtin.os.tag == .wasi)
|
||||
return error.SkipZigTest;
|
||||
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var tmp = tmpDir(.{});
|
||||
defer tmp.cleanup();
|
||||
|
||||
@ -1761,8 +1661,6 @@ test "delete a read-only file on windows" {
|
||||
if (builtin.os.tag != .windows)
|
||||
return error.SkipZigTest;
|
||||
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var tmp = testing.tmpDir(.{});
|
||||
defer tmp.cleanup();
|
||||
|
||||
@ -1793,8 +1691,6 @@ test "delete a read-only file on windows" {
|
||||
test "delete a setAsCwd directory on Windows" {
|
||||
if (builtin.os.tag != .windows) return error.SkipZigTest;
|
||||
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var tmp = tmpDir(.{});
|
||||
// Set tmp dir as current working directory.
|
||||
try tmp.dir.setAsCwd();
|
||||
|
@ -1,6 +1,5 @@
|
||||
const std = @import("std");
|
||||
const assert = std.debug.assert;
|
||||
const builtin = @import("builtin");
|
||||
const mem = std.mem;
|
||||
const meta = std.meta;
|
||||
|
||||
@ -253,8 +252,6 @@ test "typeContainsSlice" {
|
||||
}
|
||||
|
||||
test "hash pointer" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const array = [_]u32{ 123, 123, 123 };
|
||||
const a = &array[0];
|
||||
const b = &array[1];
|
||||
@ -275,8 +272,6 @@ test "hash pointer" {
|
||||
}
|
||||
|
||||
test "hash slice shallow" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
// Allocate one array dynamically so that we're assured it is not merged
|
||||
// with the other by the optimization passes.
|
||||
const array1 = try std.testing.allocator.create([6]u32);
|
||||
@ -295,8 +290,6 @@ test "hash slice shallow" {
|
||||
}
|
||||
|
||||
test "hash slice deep" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
// Allocate one array dynamically so that we're assured it is not merged
|
||||
// with the other by the optimization passes.
|
||||
const array1 = try std.testing.allocator.create([6]u32);
|
||||
@ -313,8 +306,6 @@ test "hash slice deep" {
|
||||
}
|
||||
|
||||
test "hash struct deep" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const Foo = struct {
|
||||
a: u32,
|
||||
b: u16,
|
||||
@ -354,8 +345,6 @@ test "hash struct deep" {
|
||||
}
|
||||
|
||||
test "testHash optional" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const a: ?u32 = 123;
|
||||
const b: ?u32 = null;
|
||||
try testing.expectEqual(testHash(a), testHash(@as(u32, 123)));
|
||||
@ -364,8 +353,6 @@ test "testHash optional" {
|
||||
}
|
||||
|
||||
test "testHash array" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const a = [_]u32{ 1, 2, 3 };
|
||||
const h = testHash(a);
|
||||
var hasher = Wyhash.init(0);
|
||||
@ -382,8 +369,6 @@ test "testHash multi-dimensional array" {
|
||||
}
|
||||
|
||||
test "testHash struct" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const Foo = struct {
|
||||
a: u32 = 1,
|
||||
b: u32 = 2,
|
||||
@ -399,8 +384,6 @@ test "testHash struct" {
|
||||
}
|
||||
|
||||
test "testHash union" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const Foo = union(enum) {
|
||||
A: u32,
|
||||
B: bool,
|
||||
@ -425,8 +408,6 @@ test "testHash union" {
|
||||
}
|
||||
|
||||
test "testHash vector" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const a: @Vector(4, u32) = [_]u32{ 1, 2, 3, 4 };
|
||||
const b: @Vector(4, u32) = [_]u32{ 1, 2, 3, 5 };
|
||||
try testing.expect(testHash(a) == testHash(a));
|
||||
@ -439,8 +420,6 @@ test "testHash vector" {
|
||||
}
|
||||
|
||||
test "testHash error union" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const Errors = error{Test};
|
||||
const Foo = struct {
|
||||
a: u32 = 1,
|
||||
|
@ -242,8 +242,6 @@ test "smhasher" {
|
||||
}
|
||||
|
||||
test "iterative api" {
|
||||
if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const Test = struct {
|
||||
fn do() !void {
|
||||
try verify.iterativeApi(Wyhash);
|
||||
|
@ -803,8 +803,6 @@ fn testExpect(comptime H: type, seed: anytype, input: []const u8, expected: u64)
|
||||
}
|
||||
|
||||
test "xxhash3" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const H = XxHash3;
|
||||
// Non-Seeded Tests
|
||||
try testExpect(H, 0, "", 0x2d06800538d394c2);
|
||||
@ -836,8 +834,6 @@ test "xxhash3" {
|
||||
}
|
||||
|
||||
test "xxhash3 smhasher" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const Test = struct {
|
||||
fn do() !void {
|
||||
try expectEqual(verify.smhasher(XxHash3.hash), 0x9a636405);
|
||||
@ -849,8 +845,6 @@ test "xxhash3 smhasher" {
|
||||
}
|
||||
|
||||
test "xxhash3 iterative api" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const Test = struct {
|
||||
fn do() !void {
|
||||
try verify.iterativeApi(XxHash3);
|
||||
@ -862,8 +856,6 @@ test "xxhash3 iterative api" {
|
||||
}
|
||||
|
||||
test "xxhash64" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const H = XxHash64;
|
||||
try testExpect(H, 0, "", 0xef46db3751d8e999);
|
||||
try testExpect(H, 0, "a", 0xd24ec4f1a98c6e5b);
|
||||
@ -875,8 +867,6 @@ test "xxhash64" {
|
||||
}
|
||||
|
||||
test "xxhash64 smhasher" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const Test = struct {
|
||||
fn do() !void {
|
||||
try expectEqual(verify.smhasher(XxHash64.hash), 0x024B7CF4);
|
||||
@ -888,8 +878,6 @@ test "xxhash64 smhasher" {
|
||||
}
|
||||
|
||||
test "xxhash64 iterative api" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const Test = struct {
|
||||
fn do() !void {
|
||||
try verify.iterativeApi(XxHash64);
|
||||
@ -901,8 +889,6 @@ test "xxhash64 iterative api" {
|
||||
}
|
||||
|
||||
test "xxhash32" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const H = XxHash32;
|
||||
|
||||
try testExpect(H, 0, "", 0x02cc5d05);
|
||||
@ -915,8 +901,6 @@ test "xxhash32" {
|
||||
}
|
||||
|
||||
test "xxhash32 smhasher" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const Test = struct {
|
||||
fn do() !void {
|
||||
try expectEqual(verify.smhasher(XxHash32.hash), 0xBA88B743);
|
||||
@ -928,8 +912,6 @@ test "xxhash32 smhasher" {
|
||||
}
|
||||
|
||||
test "xxhash32 iterative api" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const Test = struct {
|
||||
fn do() !void {
|
||||
try verify.iterativeApi(XxHash32);
|
||||
|
@ -1873,8 +1873,6 @@ test "std.hash_map multiple removes on same metadata" {
|
||||
}
|
||||
|
||||
test "std.hash_map put and remove loop in random order" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var map = AutoHashMap(u32, u32).init(std.testing.allocator);
|
||||
defer map.deinit();
|
||||
|
||||
|
@ -1042,8 +1042,6 @@ const TraceKind = enum {
|
||||
const test_config = Config{};
|
||||
|
||||
test "small allocations - free in same order" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var gpa = GeneralPurposeAllocator(test_config){};
|
||||
defer std.testing.expect(gpa.deinit() == .ok) catch @panic("leak");
|
||||
const allocator = gpa.allocator();
|
||||
@ -1063,8 +1061,6 @@ test "small allocations - free in same order" {
|
||||
}
|
||||
|
||||
test "small allocations - free in reverse order" {
|
||||
if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var gpa = GeneralPurposeAllocator(test_config){};
|
||||
defer std.testing.expect(gpa.deinit() == .ok) catch @panic("leak");
|
||||
const allocator = gpa.allocator();
|
||||
|
@ -1,7 +1,6 @@
|
||||
//! Connecting and opening requests are threadsafe. Individual requests are not.
|
||||
|
||||
const std = @import("../std.zig");
|
||||
const builtin = @import("builtin");
|
||||
const testing = std.testing;
|
||||
const http = std.http;
|
||||
const mem = std.mem;
|
||||
@ -428,8 +427,6 @@ pub const Response = struct {
|
||||
}
|
||||
|
||||
test parseInt3 {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const expectEqual = testing.expectEqual;
|
||||
try expectEqual(@as(u10, 0), parseInt3("000".*));
|
||||
try expectEqual(@as(u10, 418), parseInt3("418".*));
|
||||
@ -588,7 +585,7 @@ pub const Request = struct {
|
||||
|
||||
if (!req.headers.contains("user-agent")) {
|
||||
try w.writeAll("User-Agent: zig/");
|
||||
try w.writeAll(builtin.zig_version_string);
|
||||
try w.writeAll(@import("builtin").zig_version_string);
|
||||
try w.writeAll(" (std.http)\r\n");
|
||||
}
|
||||
|
||||
@ -1252,6 +1249,7 @@ pub fn fetch(client: *Client, allocator: Allocator, options: FetchOptions) !Fetc
|
||||
}
|
||||
|
||||
test {
|
||||
const builtin = @import("builtin");
|
||||
const native_endian = comptime builtin.cpu.arch.endian();
|
||||
if (builtin.zig_backend == .stage2_llvm and native_endian == .Big) {
|
||||
// https://github.com/ziglang/zig/issues/13782
|
||||
@ -1260,7 +1258,5 @@ test {
|
||||
|
||||
if (builtin.os.tag == .wasi) return error.SkipZigTest;
|
||||
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
std.testing.refAllDecls(@This());
|
||||
}
|
||||
|
@ -725,8 +725,6 @@ test "HTTP server handles a chunked transfer coding request" {
|
||||
return error.SkipZigTest;
|
||||
}
|
||||
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const native_endian = comptime builtin.cpu.arch.endian();
|
||||
if (builtin.zig_backend == .stage2_llvm and native_endian == .Big) {
|
||||
// https://github.com/ziglang/zig/issues/13782
|
||||
|
@ -164,8 +164,6 @@ pub fn bitReader(
|
||||
}
|
||||
|
||||
test "api coverage" {
|
||||
if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const mem_be = [_]u8{ 0b11001101, 0b00001011 };
|
||||
const mem_le = [_]u8{ 0b00011101, 0b10010101 };
|
||||
|
||||
|
@ -36,7 +36,6 @@ pub fn multiWriter(streams: anytype) MultiWriter(@TypeOf(streams)) {
|
||||
const testing = std.testing;
|
||||
|
||||
test "MultiWriter" {
|
||||
if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
var tmp = testing.tmpDir(.{});
|
||||
defer tmp.cleanup();
|
||||
var f = try tmp.dir.createFile("t.txt", .{});
|
||||
|
@ -15,8 +15,6 @@ const native_endian = builtin.target.cpu.arch.endian();
|
||||
const tmpDir = std.testing.tmpDir;
|
||||
|
||||
test "write a file, read it, then delete it" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var tmp = tmpDir(.{});
|
||||
defer tmp.cleanup();
|
||||
|
||||
@ -63,8 +61,6 @@ test "write a file, read it, then delete it" {
|
||||
}
|
||||
|
||||
test "BitStreams with File Stream" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var tmp = tmpDir(.{});
|
||||
defer tmp.cleanup();
|
||||
|
||||
@ -110,8 +106,6 @@ test "BitStreams with File Stream" {
|
||||
}
|
||||
|
||||
test "File seek ops" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var tmp = tmpDir(.{});
|
||||
defer tmp.cleanup();
|
||||
|
||||
@ -139,8 +133,6 @@ test "File seek ops" {
|
||||
}
|
||||
|
||||
test "setEndPos" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var tmp = tmpDir(.{});
|
||||
defer tmp.cleanup();
|
||||
|
||||
@ -167,8 +159,6 @@ test "setEndPos" {
|
||||
}
|
||||
|
||||
test "updateTimes" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var tmp = tmpDir(.{});
|
||||
defer tmp.cleanup();
|
||||
|
||||
|
@ -9,7 +9,6 @@
|
||||
//! The low-level `writeStream` emits syntax-conformant JSON tokens to a `std.io.Writer`.
|
||||
//! The high-level `stringify` serializes a Zig or `Value` type into JSON.
|
||||
|
||||
const builtin = @import("builtin");
|
||||
const testing = @import("std").testing;
|
||||
const ArrayList = @import("std").ArrayList;
|
||||
|
||||
@ -24,8 +23,6 @@ test Scanner {
|
||||
}
|
||||
|
||||
test parseFromSlice {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var parsed_str = try parseFromSlice([]const u8, testing.allocator, "\"a\\u0020b\"", .{});
|
||||
defer parsed_str.deinit();
|
||||
try testing.expectEqualSlices(u8, "a b", parsed_str.value);
|
||||
@ -38,16 +35,12 @@ test parseFromSlice {
|
||||
}
|
||||
|
||||
test Value {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var parsed = try parseFromSlice(Value, testing.allocator, "{\"anything\": \"goes\"}", .{});
|
||||
defer parsed.deinit();
|
||||
try testing.expectEqualSlices(u8, "goes", parsed.value.object.get("anything").?.string);
|
||||
}
|
||||
|
||||
test writeStream {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var out = ArrayList(u8).init(testing.allocator);
|
||||
defer out.deinit();
|
||||
var write_stream = writeStream(out.writer(), .{ .whitespace = .indent_2 });
|
||||
@ -65,8 +58,6 @@ test writeStream {
|
||||
}
|
||||
|
||||
test stringify {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var out = ArrayList(u8).init(testing.allocator);
|
||||
defer out.deinit();
|
||||
|
||||
|
@ -104,8 +104,6 @@ test "i_string_utf16LE_no_BOM.json" {
|
||||
try any("[\x00\"\x00\xe9\x00\"\x00]\x00");
|
||||
}
|
||||
test "i_structure_500_nested_arrays.json" {
|
||||
if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try any("[" ** 500 ++ "]" ** 500);
|
||||
}
|
||||
test "i_structure_UTF-8_BOM_empty_object.json" {
|
||||
@ -361,21 +359,15 @@ test "n_object_bracket_key.json" {
|
||||
try err("{[: \"x\"}\n");
|
||||
}
|
||||
test "n_object_comma_instead_of_colon.json" {
|
||||
if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try err("{\"x\", null}");
|
||||
}
|
||||
test "n_object_double_colon.json" {
|
||||
if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try err("{\"x\"::\"b\"}");
|
||||
}
|
||||
test "n_object_emoji.json" {
|
||||
try err("{\xf0\x9f\x87\xa8\xf0\x9f\x87\xad}");
|
||||
}
|
||||
test "n_object_garbage_at_end.json" {
|
||||
if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try err("{\"a\":\"a\" 123}");
|
||||
}
|
||||
test "n_object_key_with_single_quotes.json" {
|
||||
@ -385,26 +377,18 @@ test "n_object_lone_continuation_byte_in_key_and_trailing_comma.json" {
|
||||
try err("{\"\xb9\":\"0\",}");
|
||||
}
|
||||
test "n_object_missing_colon.json" {
|
||||
if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try err("{\"a\" b}");
|
||||
}
|
||||
test "n_object_missing_key.json" {
|
||||
try err("{:\"b\"}");
|
||||
}
|
||||
test "n_object_missing_semicolon.json" {
|
||||
if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try err("{\"a\" \"b\"}");
|
||||
}
|
||||
test "n_object_missing_value.json" {
|
||||
if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try err("{\"a\":");
|
||||
}
|
||||
test "n_object_no-colon.json" {
|
||||
if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try err("{\"a\"");
|
||||
}
|
||||
test "n_object_non_string_key.json" {
|
||||
@ -417,59 +401,39 @@ test "n_object_repeated_null_null.json" {
|
||||
try err("{null:null,null:null}");
|
||||
}
|
||||
test "n_object_several_trailing_commas.json" {
|
||||
if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try err("{\"id\":0,,,,,}");
|
||||
}
|
||||
test "n_object_single_quote.json" {
|
||||
try err("{'a':0}");
|
||||
}
|
||||
test "n_object_trailing_comma.json" {
|
||||
if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try err("{\"id\":0,}");
|
||||
}
|
||||
test "n_object_trailing_comment.json" {
|
||||
if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try err("{\"a\":\"b\"}/**/");
|
||||
}
|
||||
test "n_object_trailing_comment_open.json" {
|
||||
if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try err("{\"a\":\"b\"}/**//");
|
||||
}
|
||||
test "n_object_trailing_comment_slash_open.json" {
|
||||
if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try err("{\"a\":\"b\"}//");
|
||||
}
|
||||
test "n_object_trailing_comment_slash_open_incomplete.json" {
|
||||
if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try err("{\"a\":\"b\"}/");
|
||||
}
|
||||
test "n_object_two_commas_in_a_row.json" {
|
||||
if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try err("{\"a\":\"b\",,\"c\":\"d\"}");
|
||||
}
|
||||
test "n_object_unquoted_key.json" {
|
||||
try err("{a: \"b\"}");
|
||||
}
|
||||
test "n_object_unterminated-value.json" {
|
||||
if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try err("{\"a\":\"a");
|
||||
}
|
||||
test "n_object_with_single_string.json" {
|
||||
if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try err("{ \"foo\" : \"bar\", \"a\" }");
|
||||
}
|
||||
test "n_object_with_trailing_garbage.json" {
|
||||
if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try err("{\"a\":\"b\"}#");
|
||||
}
|
||||
test "n_single_space.json" {
|
||||
@ -596,8 +560,6 @@ test "n_structure_close_unopened_array.json" {
|
||||
try err("1]");
|
||||
}
|
||||
test "n_structure_comma_instead_of_closing_brace.json" {
|
||||
if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try err("{\"x\": true,");
|
||||
}
|
||||
test "n_structure_double_array.json" {
|
||||
@ -628,18 +590,12 @@ test "n_structure_object_followed_by_closing_object.json" {
|
||||
try err("{}}");
|
||||
}
|
||||
test "n_structure_object_unclosed_no_value.json" {
|
||||
if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try err("{\"\":");
|
||||
}
|
||||
test "n_structure_object_with_comment.json" {
|
||||
if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try err("{\"a\":/*comment*/\"b\"}");
|
||||
}
|
||||
test "n_structure_object_with_trailing_garbage.json" {
|
||||
if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try err("{\"a\": true} \"x\"");
|
||||
}
|
||||
test "n_structure_open_array_apostrophe.json" {
|
||||
@ -649,8 +605,6 @@ test "n_structure_open_array_comma.json" {
|
||||
try err("[,");
|
||||
}
|
||||
test "n_structure_open_array_object.json" {
|
||||
if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try err("[{\"\":" ** 50000 ++ "\n");
|
||||
}
|
||||
test "n_structure_open_array_open_object.json" {
|
||||
@ -690,8 +644,6 @@ test "n_structure_single_star.json" {
|
||||
try err("*");
|
||||
}
|
||||
test "n_structure_trailing_#.json" {
|
||||
if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try err("{\"a\":\"b\"}#{}");
|
||||
}
|
||||
test "n_structure_uescaped_LF_before_string.json" {
|
||||
@ -710,8 +662,6 @@ test "n_structure_unclosed_array_unfinished_true.json" {
|
||||
try err("[ false, tru");
|
||||
}
|
||||
test "n_structure_unclosed_object.json" {
|
||||
if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try err("{\"asd\":\"asd\"");
|
||||
}
|
||||
test "n_structure_unicode-identifier.json" {
|
||||
@ -814,61 +764,39 @@ test "y_number_simple_real.json" {
|
||||
try ok("[123.456789]");
|
||||
}
|
||||
test "y_object.json" {
|
||||
if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try ok("{\"asd\":\"sdf\", \"dfg\":\"fgh\"}");
|
||||
}
|
||||
test "y_object_basic.json" {
|
||||
if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try ok("{\"asd\":\"sdf\"}");
|
||||
}
|
||||
test "y_object_duplicated_key.json" {
|
||||
if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try ok("{\"a\":\"b\",\"a\":\"c\"}");
|
||||
}
|
||||
test "y_object_duplicated_key_and_value.json" {
|
||||
if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try ok("{\"a\":\"b\",\"a\":\"b\"}");
|
||||
}
|
||||
test "y_object_empty.json" {
|
||||
try ok("{}");
|
||||
}
|
||||
test "y_object_empty_key.json" {
|
||||
if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try ok("{\"\":0}");
|
||||
}
|
||||
test "y_object_escaped_null_in_key.json" {
|
||||
if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try ok("{\"foo\\u0000bar\": 42}");
|
||||
}
|
||||
test "y_object_extreme_numbers.json" {
|
||||
if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try ok("{ \"min\": -1.0e+28, \"max\": 1.0e+28 }");
|
||||
}
|
||||
test "y_object_long_strings.json" {
|
||||
if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try ok("{\"x\":[{\"id\": \"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\"}], \"id\": \"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\"}");
|
||||
}
|
||||
test "y_object_simple.json" {
|
||||
if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try ok("{\"a\":[]}");
|
||||
}
|
||||
test "y_object_string_unicode.json" {
|
||||
if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try ok("{\"title\":\"\\u041f\\u043e\\u043b\\u0442\\u043e\\u0440\\u0430 \\u0417\\u0435\\u043c\\u043b\\u0435\\u043a\\u043e\\u043f\\u0430\" }");
|
||||
}
|
||||
test "y_object_with_newlines.json" {
|
||||
if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try ok("{\n\"a\": \"b\"\n}");
|
||||
}
|
||||
test "y_string_1_2_3_bytes_UTF-8_sequences.json" {
|
||||
|
@ -1,5 +1,4 @@
|
||||
const std = @import("std");
|
||||
const builtin = @import("builtin");
|
||||
const mem = std.mem;
|
||||
const testing = std.testing;
|
||||
const ArenaAllocator = std.heap.ArenaAllocator;
|
||||
@ -19,8 +18,6 @@ const jsonReader = @import("scanner.zig").reader;
|
||||
const JsonReader = @import("scanner.zig").Reader;
|
||||
|
||||
test "json.parser.dynamic" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const s =
|
||||
\\{
|
||||
\\ "Image": {
|
||||
@ -75,8 +72,6 @@ test "json.parser.dynamic" {
|
||||
|
||||
const writeStream = @import("./stringify.zig").writeStream;
|
||||
test "write json then parse it" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var out_buffer: [1000]u8 = undefined;
|
||||
|
||||
var fixed_buffer_stream = std.io.fixedBufferStream(&out_buffer);
|
||||
@ -125,16 +120,12 @@ fn testParse(allocator: std.mem.Allocator, json_str: []const u8) !Value {
|
||||
}
|
||||
|
||||
test "parsing empty string gives appropriate error" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var arena_allocator = std.heap.ArenaAllocator.init(std.testing.allocator);
|
||||
defer arena_allocator.deinit();
|
||||
try testing.expectError(error.UnexpectedEndOfInput, testParse(arena_allocator.allocator(), ""));
|
||||
}
|
||||
|
||||
test "Value.array allocator should still be usable after parsing" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var parsed = try parseFromSlice(Value, std.testing.allocator, "[]", .{});
|
||||
defer parsed.deinit();
|
||||
|
||||
@ -147,8 +138,6 @@ test "Value.array allocator should still be usable after parsing" {
|
||||
}
|
||||
|
||||
test "integer after float has proper type" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var arena_allocator = std.heap.ArenaAllocator.init(std.testing.allocator);
|
||||
defer arena_allocator.deinit();
|
||||
const parsed = try testParse(arena_allocator.allocator(),
|
||||
@ -161,8 +150,6 @@ test "integer after float has proper type" {
|
||||
}
|
||||
|
||||
test "escaped characters" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var arena_allocator = std.heap.ArenaAllocator.init(std.testing.allocator);
|
||||
defer arena_allocator.deinit();
|
||||
const input =
|
||||
@ -195,8 +182,6 @@ test "escaped characters" {
|
||||
}
|
||||
|
||||
test "Value.jsonStringify" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var vals = [_]Value{
|
||||
.{ .integer = 1 },
|
||||
.{ .integer = 2 },
|
||||
@ -244,8 +229,6 @@ test "Value.jsonStringify" {
|
||||
}
|
||||
|
||||
test "parseFromValue(std.json.Value,...)" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const str =
|
||||
\\{
|
||||
\\ "int": 32,
|
||||
@ -263,8 +246,6 @@ test "parseFromValue(std.json.Value,...)" {
|
||||
}
|
||||
|
||||
test "polymorphic parsing" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
if (true) return error.SkipZigTest; // See https://github.com/ziglang/zig/issues/16108
|
||||
const doc =
|
||||
\\{ "type": "div",
|
||||
@ -310,8 +291,6 @@ test "polymorphic parsing" {
|
||||
}
|
||||
|
||||
test "long object value" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const value = "01234567890123456789";
|
||||
const doc = "{\"key\":\"" ++ value ++ "\"}";
|
||||
var fbs = std.io.fixedBufferStream(doc);
|
||||
@ -324,8 +303,6 @@ test "long object value" {
|
||||
}
|
||||
|
||||
test "ParseOptions.max_value_len" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var arena = ArenaAllocator.init(testing.allocator);
|
||||
defer arena.deinit();
|
||||
|
||||
@ -340,8 +317,6 @@ test "ParseOptions.max_value_len" {
|
||||
}
|
||||
|
||||
test "many object keys" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const doc =
|
||||
\\{
|
||||
\\ "k1": "v1",
|
||||
|
@ -1,5 +1,4 @@
|
||||
const std = @import("std");
|
||||
const builtin = @import("builtin");
|
||||
const testing = std.testing;
|
||||
|
||||
const ArrayHashMap = @import("hashmap.zig").ArrayHashMap;
|
||||
@ -19,8 +18,6 @@ const T = struct {
|
||||
};
|
||||
|
||||
test "parse json hashmap" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const doc =
|
||||
\\{
|
||||
\\ "abc": {"i": 0, "s": "d"},
|
||||
@ -36,8 +33,6 @@ test "parse json hashmap" {
|
||||
}
|
||||
|
||||
test "parse json hashmap while streaming" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const doc =
|
||||
\\{
|
||||
\\ "abc": {"i": 0, "s": "d"},
|
||||
@ -63,8 +58,6 @@ test "parse json hashmap while streaming" {
|
||||
}
|
||||
|
||||
test "parse json hashmap duplicate fields" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var arena = std.heap.ArenaAllocator.init(std.testing.allocator);
|
||||
defer arena.deinit();
|
||||
|
||||
@ -93,8 +86,6 @@ test "parse json hashmap duplicate fields" {
|
||||
}
|
||||
|
||||
test "stringify json hashmap" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var value = ArrayHashMap(T){};
|
||||
defer value.deinit(testing.allocator);
|
||||
{
|
||||
@ -132,8 +123,6 @@ test "stringify json hashmap" {
|
||||
}
|
||||
|
||||
test "stringify json hashmap whitespace" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var value = ArrayHashMap(T){};
|
||||
defer value.deinit(testing.allocator);
|
||||
try value.map.put(testing.allocator, "abc", .{ .i = 0, .s = "d" });
|
||||
@ -158,8 +147,6 @@ test "stringify json hashmap whitespace" {
|
||||
}
|
||||
|
||||
test "json parse from value hashmap" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const doc =
|
||||
\\{
|
||||
\\ "abc": {"i": 0, "s": "d"},
|
||||
|
@ -1,5 +1,4 @@
|
||||
const std = @import("std");
|
||||
const builtin = @import("builtin");
|
||||
const testing = std.testing;
|
||||
const ArenaAllocator = std.heap.ArenaAllocator;
|
||||
const Allocator = std.mem.Allocator;
|
||||
@ -372,8 +371,6 @@ test "test all types" {
|
||||
}
|
||||
|
||||
test "parse" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try testing.expectEqual(false, try parseFromSliceLeaky(bool, testing.allocator, "false", .{}));
|
||||
try testing.expectEqual(true, try parseFromSliceLeaky(bool, testing.allocator, "true", .{}));
|
||||
try testing.expectEqual(@as(u1, 1), try parseFromSliceLeaky(u1, testing.allocator, "1", .{}));
|
||||
@ -392,8 +389,6 @@ test "parse" {
|
||||
}
|
||||
|
||||
test "parse into enum" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const T = enum(u32) {
|
||||
Foo = 42,
|
||||
Bar,
|
||||
@ -407,8 +402,6 @@ test "parse into enum" {
|
||||
}
|
||||
|
||||
test "parse into that allocates a slice" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
{
|
||||
// string as string
|
||||
const parsed = try parseFromSlice([]u8, testing.allocator, "\"foo\"", .{});
|
||||
@ -429,16 +422,12 @@ test "parse into that allocates a slice" {
|
||||
}
|
||||
|
||||
test "parse into sentinel slice" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const parsed = try parseFromSlice([:0]const u8, testing.allocator, "\"\\n\"", .{});
|
||||
defer parsed.deinit();
|
||||
try testing.expect(std.mem.eql(u8, parsed.value, "\n"));
|
||||
}
|
||||
|
||||
test "parse into tagged union" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const T = union(enum) {
|
||||
nothing,
|
||||
int: i32,
|
||||
@ -454,8 +443,6 @@ test "parse into tagged union" {
|
||||
}
|
||||
|
||||
test "parse into tagged union errors" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const T = union(enum) {
|
||||
nothing,
|
||||
int: i32,
|
||||
@ -478,8 +465,6 @@ test "parse into tagged union errors" {
|
||||
}
|
||||
|
||||
test "parse into struct with no fields" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const T = struct {};
|
||||
const parsed = try parseFromSlice(T, testing.allocator, "{}", .{});
|
||||
defer parsed.deinit();
|
||||
@ -489,8 +474,6 @@ test "parse into struct with no fields" {
|
||||
const test_const_value: usize = 123;
|
||||
|
||||
test "parse into struct with default const pointer field" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const T = struct { a: *const usize = &test_const_value };
|
||||
const parsed = try parseFromSlice(T, testing.allocator, "{}", .{});
|
||||
defer parsed.deinit();
|
||||
@ -506,8 +489,6 @@ const test_default_str_slice: [2][]const u8 = [_][]const u8{
|
||||
};
|
||||
|
||||
test "freeing parsed structs with pointers to default values" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const T = struct {
|
||||
int: *const usize = &test_default_usize,
|
||||
int_ptr: *allowzero align(1) const usize = test_default_usize_ptr,
|
||||
@ -521,15 +502,11 @@ test "freeing parsed structs with pointers to default values" {
|
||||
}
|
||||
|
||||
test "parse into struct where destination and source lengths mismatch" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const T = struct { a: [2]u8 };
|
||||
try testing.expectError(error.LengthMismatch, parseFromSlice(T, testing.allocator, "{\"a\": \"bbb\"}", .{}));
|
||||
}
|
||||
|
||||
test "parse into struct with misc fields" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const T = struct {
|
||||
int: i64,
|
||||
float: f64,
|
||||
@ -605,8 +582,6 @@ test "parse into struct with misc fields" {
|
||||
}
|
||||
|
||||
test "parse into struct with strings and arrays with sentinels" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const T = struct {
|
||||
language: [:0]const u8,
|
||||
language_without_sentinel: []const u8,
|
||||
@ -635,8 +610,6 @@ test "parse into struct with strings and arrays with sentinels" {
|
||||
}
|
||||
|
||||
test "parse into struct with duplicate field" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const options_first = ParseOptions{ .duplicate_field_behavior = .use_first };
|
||||
const options_last = ParseOptions{ .duplicate_field_behavior = .use_last };
|
||||
|
||||
@ -656,8 +629,6 @@ test "parse into struct with duplicate field" {
|
||||
}
|
||||
|
||||
test "parse into struct ignoring unknown fields" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const T = struct {
|
||||
int: i64,
|
||||
language: []const u8,
|
||||
@ -696,8 +667,6 @@ test "parse into struct ignoring unknown fields" {
|
||||
}
|
||||
|
||||
test "parse into tuple" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const Union = union(enum) {
|
||||
char: u8,
|
||||
float: f64,
|
||||
@ -753,8 +722,6 @@ const ParseIntoRecursiveUnionDefinitionValue = union(enum) {
|
||||
};
|
||||
|
||||
test "parse into recursive union definition" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const T = struct {
|
||||
values: ParseIntoRecursiveUnionDefinitionValue,
|
||||
};
|
||||
@ -776,8 +743,6 @@ const ParseIntoDoubleRecursiveUnionValueSecond = union(enum) {
|
||||
};
|
||||
|
||||
test "parse into double recursive union definition" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const T = struct {
|
||||
values: ParseIntoDoubleRecursiveUnionValueFirst,
|
||||
};
|
||||
@ -789,8 +754,6 @@ test "parse into double recursive union definition" {
|
||||
}
|
||||
|
||||
test "parse exponential into int" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const T = struct { int: i64 };
|
||||
const r = try parseFromSliceLeaky(T, testing.allocator, "{ \"int\": 4.2e2 }", .{});
|
||||
try testing.expectEqual(@as(i64, 420), r.int);
|
||||
@ -799,8 +762,6 @@ test "parse exponential into int" {
|
||||
}
|
||||
|
||||
test "parseFromTokenSource" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
{
|
||||
var scanner = JsonScanner.initCompleteInput(testing.allocator, "123");
|
||||
defer scanner.deinit();
|
||||
@ -820,14 +781,10 @@ test "parseFromTokenSource" {
|
||||
}
|
||||
|
||||
test "max_value_len" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try testing.expectError(error.ValueTooLong, parseFromSlice([]u8, testing.allocator, "\"0123456789\"", .{ .max_value_len = 5 }));
|
||||
}
|
||||
|
||||
test "parse into vector" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const T = struct {
|
||||
vec_i32: @Vector(4, i32),
|
||||
vec_f32: @Vector(2, f32),
|
||||
@ -860,8 +817,6 @@ fn assertKey(
|
||||
}
|
||||
}
|
||||
test "json parse partial" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const Inner = struct {
|
||||
num: u32,
|
||||
yes: bool,
|
||||
@ -917,8 +872,6 @@ test "json parse partial" {
|
||||
}
|
||||
|
||||
test "json parse allocate when streaming" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const T = struct {
|
||||
not_const: []u8,
|
||||
is_const: []const u8,
|
||||
@ -949,8 +902,6 @@ test "json parse allocate when streaming" {
|
||||
}
|
||||
|
||||
test "parse at comptime" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const doc =
|
||||
\\{
|
||||
\\ "vals": {
|
||||
|
@ -1,5 +1,4 @@
|
||||
const std = @import("std");
|
||||
const builtin = @import("builtin");
|
||||
const mem = std.mem;
|
||||
const testing = std.testing;
|
||||
|
||||
@ -16,8 +15,6 @@ const writeStreamMaxDepth = @import("stringify.zig").writeStreamMaxDepth;
|
||||
const writeStreamArbitraryDepth = @import("stringify.zig").writeStreamArbitraryDepth;
|
||||
|
||||
test "json write stream" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var out_buf: [1024]u8 = undefined;
|
||||
var slice_stream = std.io.fixedBufferStream(&out_buf);
|
||||
const out = slice_stream.writer();
|
||||
@ -100,8 +97,6 @@ fn getJsonObject(allocator: std.mem.Allocator) !Value {
|
||||
}
|
||||
|
||||
test "stringify null optional fields" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const MyStruct = struct {
|
||||
optional: ?[]const u8 = null,
|
||||
required: []const u8 = "something",
|
||||
@ -123,8 +118,6 @@ test "stringify null optional fields" {
|
||||
}
|
||||
|
||||
test "stringify basic types" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try testStringify("false", false, .{});
|
||||
try testStringify("true", true, .{});
|
||||
try testStringify("null", @as(?u8, null), .{});
|
||||
@ -141,8 +134,6 @@ test "stringify basic types" {
|
||||
}
|
||||
|
||||
test "stringify string" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try testStringify("\"hello\"", "hello", .{});
|
||||
try testStringify("\"with\\nescapes\\r\"", "with\nescapes\r", .{});
|
||||
try testStringify("\"with\\nescapes\\r\"", "with\nescapes\r", .{ .escape_unicode = true });
|
||||
@ -167,16 +158,12 @@ test "stringify string" {
|
||||
}
|
||||
|
||||
test "stringify many-item sentinel-terminated string" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try testStringify("\"hello\"", @as([*:0]const u8, "hello"), .{});
|
||||
try testStringify("\"with\\nescapes\\r\"", @as([*:0]const u8, "with\nescapes\r"), .{ .escape_unicode = true });
|
||||
try testStringify("\"with unicode\\u0001\"", @as([*:0]const u8, "with unicode\u{1}"), .{ .escape_unicode = true });
|
||||
}
|
||||
|
||||
test "stringify enums" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const E = enum {
|
||||
foo,
|
||||
bar,
|
||||
@ -186,15 +173,11 @@ test "stringify enums" {
|
||||
}
|
||||
|
||||
test "stringify enum literals" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try testStringify("\"foo\"", .foo, .{});
|
||||
try testStringify("\"bar\"", .bar, .{});
|
||||
}
|
||||
|
||||
test "stringify tagged unions" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const T = union(enum) {
|
||||
nothing,
|
||||
foo: u32,
|
||||
@ -206,16 +189,12 @@ test "stringify tagged unions" {
|
||||
}
|
||||
|
||||
test "stringify struct" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try testStringify("{\"foo\":42}", struct {
|
||||
foo: u32,
|
||||
}{ .foo = 42 }, .{});
|
||||
}
|
||||
|
||||
test "emit_strings_as_arrays" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
// Should only affect string values, not object keys.
|
||||
try testStringify("{\"foo\":\"bar\"}", .{ .foo = "bar" }, .{});
|
||||
try testStringify("{\"foo\":[98,97,114]}", .{ .foo = "bar" }, .{ .emit_strings_as_arrays = true });
|
||||
@ -230,8 +209,6 @@ test "emit_strings_as_arrays" {
|
||||
}
|
||||
|
||||
test "stringify struct with indentation" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try testStringify(
|
||||
\\{
|
||||
\\ "foo": 42,
|
||||
@ -277,8 +254,6 @@ test "stringify struct with indentation" {
|
||||
}
|
||||
|
||||
test "stringify struct with void field" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try testStringify("{\"foo\":42}", struct {
|
||||
foo: u32,
|
||||
bar: void = {},
|
||||
@ -286,8 +261,6 @@ test "stringify struct with void field" {
|
||||
}
|
||||
|
||||
test "stringify array of structs" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const MyStruct = struct {
|
||||
foo: u32,
|
||||
};
|
||||
@ -299,8 +272,6 @@ test "stringify array of structs" {
|
||||
}
|
||||
|
||||
test "stringify struct with custom stringifier" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try testStringify("[\"something special\",42]", struct {
|
||||
foo: u32,
|
||||
const Self = @This();
|
||||
@ -315,16 +286,12 @@ test "stringify struct with custom stringifier" {
|
||||
}
|
||||
|
||||
test "stringify vector" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try testStringify("[1,1]", @as(@Vector(2, u32), @splat(1)), .{});
|
||||
try testStringify("\"AA\"", @as(@Vector(2, u8), @splat('A')), .{});
|
||||
try testStringify("[65,65]", @as(@Vector(2, u8), @splat('A')), .{ .emit_strings_as_arrays = true });
|
||||
}
|
||||
|
||||
test "stringify tuple" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try testStringify("[\"foo\",42]", std.meta.Tuple(&.{ []const u8, usize }){ "foo", 42 }, .{});
|
||||
}
|
||||
|
||||
@ -411,8 +378,6 @@ fn testStringifyArbitraryDepth(expected: []const u8, value: anytype, options: St
|
||||
}
|
||||
|
||||
test "stringify alloc" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const allocator = std.testing.allocator;
|
||||
const expected =
|
||||
\\{"foo":"bar","answer":42,"my_friend":"sammy"}
|
||||
@ -424,8 +389,6 @@ test "stringify alloc" {
|
||||
}
|
||||
|
||||
test "comptime stringify" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
comptime testStringifyMaxDepth("false", false, .{}, null) catch unreachable;
|
||||
comptime testStringifyMaxDepth("false", false, .{}, 0) catch unreachable;
|
||||
comptime testStringifyArbitraryDepth("false", false, .{}) catch unreachable;
|
||||
@ -446,8 +409,6 @@ test "comptime stringify" {
|
||||
}
|
||||
|
||||
test "print" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
var out_buf: [1024]u8 = undefined;
|
||||
var slice_stream = std.io.fixedBufferStream(&out_buf);
|
||||
const out = slice_stream.writer();
|
||||
@ -479,8 +440,6 @@ test "print" {
|
||||
}
|
||||
|
||||
test "nonportable numbers" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try testStringify("9999999999999999", 9999999999999999, .{});
|
||||
try testStringify("\"9999999999999999\"", 9999999999999999, .{ .emit_nonportable_numbers_as_strings = true });
|
||||
}
|
||||
|
@ -1,5 +1,4 @@
|
||||
const std = @import("std");
|
||||
const builtin = @import("builtin");
|
||||
const testing = std.testing;
|
||||
const parseFromSlice = @import("./static.zig").parseFromSlice;
|
||||
const validate = @import("./scanner.zig").validate;
|
||||
@ -35,15 +34,11 @@ fn testHighLevelDynamicParser(s: []const u8) !void {
|
||||
|
||||
// Additional tests not part of test JSONTestSuite.
|
||||
test "y_trailing_comma_after_empty" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try roundTrip(
|
||||
\\{"1":[],"2":{},"3":"4"}
|
||||
);
|
||||
}
|
||||
test "n_object_closed_missing_value" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
try err(
|
||||
\\{"a":}
|
||||
);
|
||||
|
@ -215,8 +215,6 @@ fn test_read_uleb128_seq(comptime T: type, comptime N: usize, encoded: []const u
|
||||
}
|
||||
|
||||
test "deserialize signed LEB128" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
// Truncated
|
||||
try testing.expectError(error.EndOfStream, test_read_stream_ileb128(i64, "\x80"));
|
||||
|
||||
@ -363,8 +361,6 @@ test "serialize unsigned LEB128" {
|
||||
}
|
||||
|
||||
test "serialize signed LEB128" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
// explicitly test i0 because starting `t` at 0
|
||||
// will break the while loop
|
||||
try test_write_leb128(@as(i0, 0));
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user