authorgravatar for marc@tiehu.isMarc Tiehuis <marc@tiehu.is> 2024-03-09 17:03:05+13:00
committergravatar for marc@tiehu.isMarc Tiehuis <marc@tiehu.is> 2024-03-09 17:03:05+13:00
logb6695f0542fc23961da70ca789a5cb79a7ea29d4
tree94f3967375956cef361a9c683ad085df9d7fea3b
parent04fd113e226c82da9aa8e4ca7d63dd8ca1e453b2

std.json: update tests to match new floating point formatting


2 files changed, 7 insertions(+), 7 deletions(-)

lib/std/json/dynamic_test.zig+1-1
......@@ -213,7 +213,7 @@ test "Value.jsonStringify" {
213213 \\ true,
214214 \\ 42,
215215 \\ 43,
216 \\ 4.2e+01,
216 \\ 4.2e1,
217217 \\ "weeee",
218218 \\ [
219219 \\ 1,
lib/std/json/stringify_test.zig+6-6
......@@ -74,16 +74,16 @@ fn testBasicWriteStream(w: anytype, slice_stream: anytype) !void {
7474 \\{
7575 \\ "object": {
7676 \\ "one": 1,
77 \\ "two": 2.0e+00
77 \\ "two": 2e0
7878 \\ },
7979 \\ "string": "This is a string",
8080 \\ "array": [
8181 \\ "Another string",
8282 \\ 1,
83 \\ 3.5e+00
83 \\ 3.5e0
8484 \\ ],
8585 \\ "int": 10,
86 \\ "float": 3.5e+00
86 \\ "float": 3.5e0
8787 \\}
8888 ;
8989 try std.testing.expectEqualStrings(expected, result);
......@@ -123,12 +123,12 @@ test "stringify basic types" {
123123 try testStringify("null", @as(?u8, null), .{});
124124 try testStringify("null", @as(?*u32, null), .{});
125125 try testStringify("42", 42, .{});
126 try testStringify("4.2e+01", 42.0, .{});
126 try testStringify("4.2e1", 42.0, .{});
127127 try testStringify("42", @as(u8, 42), .{});
128128 try testStringify("42", @as(u128, 42), .{});
129129 try testStringify("9999999999999999", 9999999999999999, .{});
130 try testStringify("4.2e+01", @as(f32, 42), .{});
131 try testStringify("4.2e+01", @as(f64, 42), .{});
130 try testStringify("4.2e1", @as(f32, 42), .{});
131 try testStringify("4.2e1", @as(f64, 42), .{});
132132 try testStringify("\"ItBroke\"", @as(anyerror, error.ItBroke), .{});
133133 try testStringify("\"ItBroke\"", error.ItBroke, .{});
134134}