mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 06:13:07 +00:00
std.json: update tests to match new floating point formatting
This commit is contained in:
parent
04fd113e22
commit
b6695f0542
@ -213,7 +213,7 @@ test "Value.jsonStringify" {
|
||||
\\ true,
|
||||
\\ 42,
|
||||
\\ 43,
|
||||
\\ 4.2e+01,
|
||||
\\ 4.2e1,
|
||||
\\ "weeee",
|
||||
\\ [
|
||||
\\ 1,
|
||||
|
||||
@ -74,16 +74,16 @@ fn testBasicWriteStream(w: anytype, slice_stream: anytype) !void {
|
||||
\\{
|
||||
\\ "object": {
|
||||
\\ "one": 1,
|
||||
\\ "two": 2.0e+00
|
||||
\\ "two": 2e0
|
||||
\\ },
|
||||
\\ "string": "This is a string",
|
||||
\\ "array": [
|
||||
\\ "Another string",
|
||||
\\ 1,
|
||||
\\ 3.5e+00
|
||||
\\ 3.5e0
|
||||
\\ ],
|
||||
\\ "int": 10,
|
||||
\\ "float": 3.5e+00
|
||||
\\ "float": 3.5e0
|
||||
\\}
|
||||
;
|
||||
try std.testing.expectEqualStrings(expected, result);
|
||||
@ -123,12 +123,12 @@ test "stringify basic types" {
|
||||
try testStringify("null", @as(?u8, null), .{});
|
||||
try testStringify("null", @as(?*u32, null), .{});
|
||||
try testStringify("42", 42, .{});
|
||||
try testStringify("4.2e+01", 42.0, .{});
|
||||
try testStringify("4.2e1", 42.0, .{});
|
||||
try testStringify("42", @as(u8, 42), .{});
|
||||
try testStringify("42", @as(u128, 42), .{});
|
||||
try testStringify("9999999999999999", 9999999999999999, .{});
|
||||
try testStringify("4.2e+01", @as(f32, 42), .{});
|
||||
try testStringify("4.2e+01", @as(f64, 42), .{});
|
||||
try testStringify("4.2e1", @as(f32, 42), .{});
|
||||
try testStringify("4.2e1", @as(f64, 42), .{});
|
||||
try testStringify("\"ItBroke\"", @as(anyerror, error.ItBroke), .{});
|
||||
try testStringify("\"ItBroke\"", error.ItBroke, .{});
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user