json: New function json_to_ds().
[openvswitch] / tests / json.at
index 3096b26439a3b7eaf948e6707f098fe0709db13c..2f3732c21f3bf02178c64d25db5dd3c693936e99 100644 (file)
@@ -60,8 +60,11 @@ JSON_CHECK_NEGATIVE([formfeed in quoted string],
 JSON_CHECK_NEGATIVE([bad escape in quoted string],
                     [[["\x12"]]],
                     [error: bad escape \x])
-JSON_CHECK_NEGATIVE([\u must be followed by 4 hex digits],
+JSON_CHECK_NEGATIVE([\u must be followed by 4 hex digits (1)],
                     [[["\u1x"]]],
+                    [error: quoted string ends within \u escape])
+JSON_CHECK_NEGATIVE([\u must be followed by 4 hex digits (2)],
+                    [[["\u1xyz"]]],
                     [error: malformed \u escape])
 JSON_CHECK_NEGATIVE([isolated leading surrogate not allowed],
                     [[["\ud834xxx"]]],
@@ -158,6 +161,14 @@ JSON_CHECK_POSITIVE(
   [scientific notation],
   [[[1e3, 1E3, 2.5E2, 1e+3, 125e-3, 3.125e-2, 3125e-05, 1.525878906e-5]]],
   [[[1000,1000,250,1000,0.125,0.03125,0.03125,1.525878906e-05]]])
+# It seems likely that the following test will fail on some system that
+# rounds slightly differently in arithmetic or in printf, but I'd like
+# to keep it this way until we run into such a system.
+JSON_CHECK_POSITIVE(
+  [+/- DBL_MAX],
+  [[[1.7976931348623157e+308, -1.7976931348623157e+308]]],
+  [[[1.79769313486232e+308,-1.79769313486232e+308]]])
+
 JSON_CHECK_POSITIVE(
   [negative reals], 
   [[[-0, -1.0, -2.0, -3.0, -3.5, -8.1250]]],