Merge branch 'develop' into feature/rfc7396
This commit is contained in:
		
						commit
						0e8f01a963
					
				
					 134 changed files with 20390 additions and 1770 deletions
				
			
		|  | @ -78,7 +78,7 @@ test-%: src/unit-%.o src/unit.o ../src/json.hpp thirdparty/catch/catch.hpp | |||
| 
 | ||||
| TEST_PATTERN ?= "*" | ||||
| TEST_PREFIX = "" | ||||
| check: $(TESTCASES) | ||||
| check: $(OBJECTS) $(TESTCASES) | ||||
| 	@cd .. ; for testcase in $(TESTCASES); do echo "Executing $$testcase..."; $(TEST_PREFIX)test/$$testcase $(TEST_PATTERN) || exit 1; done | ||||
| 
 | ||||
| 
 | ||||
|  |  | |||
							
								
								
									
										75
									
								
								test/data/json-patch-tests/README.md
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										75
									
								
								test/data/json-patch-tests/README.md
									
										
									
									
									
										Executable file
									
								
							|  | @ -0,0 +1,75 @@ | |||
| JSON Patch Tests | ||||
| ================ | ||||
| 
 | ||||
| These are test cases for implementations of [IETF JSON Patch (RFC6902)](http://tools.ietf.org/html/rfc6902). | ||||
| 
 | ||||
| Some implementations can be found at [jsonpatch.com](http://jsonpatch.com). | ||||
| 
 | ||||
| 
 | ||||
| Test Format | ||||
| ----------- | ||||
| 
 | ||||
| Each test file is a JSON document that contains an array of test records. A | ||||
| test record is an object with the following members: | ||||
| 
 | ||||
| - doc: The JSON document to test against | ||||
| - patch: The patch(es) to apply | ||||
| - expected: The expected resulting document, OR | ||||
| - error: A string describing an expected error | ||||
| - comment: A string describing the test | ||||
| - disabled: True if the test should be skipped | ||||
| 
 | ||||
| All fields except 'doc' and 'patch' are optional. Test records consisting only | ||||
| of a comment are also OK. | ||||
| 
 | ||||
| 
 | ||||
| Files | ||||
| ----- | ||||
| 
 | ||||
| - tests.json: the main test file | ||||
| - spec_tests.json: tests from the RFC6902 spec | ||||
| 
 | ||||
| 
 | ||||
| Writing Tests | ||||
| ------------- | ||||
| 
 | ||||
| All tests should have a descriptive comment.  Tests should be as | ||||
| simple as possible - just what's required to test a specific piece of | ||||
| behavior.  If you want to test interacting behaviors, create tests for | ||||
| each behavior as well as the interaction. | ||||
| 
 | ||||
| If an 'error' member is specified, the error text should describe the | ||||
| error the implementation should raise - *not* what's being tested. | ||||
| Implementation error strings will vary, but the suggested error should | ||||
| be easily matched to the implementation error string.  Try to avoid | ||||
| creating error tests that might pass because an incorrect error was | ||||
| reported. | ||||
| 
 | ||||
| Please feel free to contribute! | ||||
| 
 | ||||
| 
 | ||||
| Credits | ||||
| ------- | ||||
| 
 | ||||
| The seed test set was adapted from Byron Ruth's | ||||
| [jsonpatch-js](https://github.com/bruth/jsonpatch-js/blob/master/test.js) and | ||||
| extended by [Mike McCabe](https://github.com/mikemccabe). | ||||
| 
 | ||||
| 
 | ||||
| License | ||||
| ------- | ||||
| 
 | ||||
|    Copyright 2014 The Authors | ||||
| 
 | ||||
|    Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|    you may not use this file except in compliance with the License. | ||||
|    You may obtain a copy of the License at | ||||
| 
 | ||||
|        http://www.apache.org/licenses/LICENSE-2.0 | ||||
| 
 | ||||
|    Unless required by applicable law or agreed to in writing, software | ||||
|    distributed under the License is distributed on an "AS IS" BASIS, | ||||
|    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|    See the License for the specific language governing permissions and | ||||
|    limitations under the License. | ||||
| 
 | ||||
							
								
								
									
										233
									
								
								test/data/json-patch-tests/spec_tests.json
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										233
									
								
								test/data/json-patch-tests/spec_tests.json
									
										
									
									
									
										Executable file
									
								
							|  | @ -0,0 +1,233 @@ | |||
| [ | ||||
|   { | ||||
|     "comment": "4.1. add with missing object", | ||||
|     "doc": { "q": { "bar": 2 } }, | ||||
|     "patch": [ {"op": "add", "path": "/a/b", "value": 1} ], | ||||
|     "error": | ||||
|        "path /a does not exist -- missing objects are not created recursively" | ||||
|   }, | ||||
| 
 | ||||
|   { | ||||
|     "comment": "A.1.  Adding an Object Member", | ||||
|     "doc": { | ||||
|   "foo": "bar" | ||||
| }, | ||||
|     "patch": [ | ||||
|   { "op": "add", "path": "/baz", "value": "qux" } | ||||
| ], | ||||
|     "expected": { | ||||
|   "baz": "qux", | ||||
|   "foo": "bar" | ||||
| } | ||||
|   }, | ||||
| 
 | ||||
|   { | ||||
|     "comment": "A.2.  Adding an Array Element", | ||||
|     "doc": { | ||||
|   "foo": [ "bar", "baz" ] | ||||
| }, | ||||
|     "patch": [ | ||||
|   { "op": "add", "path": "/foo/1", "value": "qux" } | ||||
| ], | ||||
|     "expected": { | ||||
|   "foo": [ "bar", "qux", "baz" ] | ||||
| } | ||||
|   }, | ||||
| 
 | ||||
|   { | ||||
|     "comment": "A.3.  Removing an Object Member", | ||||
|     "doc": { | ||||
|   "baz": "qux", | ||||
|   "foo": "bar" | ||||
| }, | ||||
|     "patch": [ | ||||
|   { "op": "remove", "path": "/baz" } | ||||
| ], | ||||
|     "expected": { | ||||
|   "foo": "bar" | ||||
| } | ||||
|   }, | ||||
| 
 | ||||
|   { | ||||
|     "comment": "A.4.  Removing an Array Element", | ||||
|     "doc": { | ||||
|   "foo": [ "bar", "qux", "baz" ] | ||||
| }, | ||||
|     "patch": [ | ||||
|   { "op": "remove", "path": "/foo/1" } | ||||
| ], | ||||
|     "expected": { | ||||
|   "foo": [ "bar", "baz" ] | ||||
| } | ||||
|   }, | ||||
| 
 | ||||
|   { | ||||
|     "comment": "A.5.  Replacing a Value", | ||||
|     "doc": { | ||||
|   "baz": "qux", | ||||
|   "foo": "bar" | ||||
| }, | ||||
|     "patch": [ | ||||
|   { "op": "replace", "path": "/baz", "value": "boo" } | ||||
| ], | ||||
|     "expected": { | ||||
|   "baz": "boo", | ||||
|   "foo": "bar" | ||||
| } | ||||
|   }, | ||||
| 
 | ||||
|   { | ||||
|     "comment": "A.6.  Moving a Value", | ||||
|     "doc": { | ||||
|   "foo": { | ||||
|     "bar": "baz", | ||||
|     "waldo": "fred" | ||||
|   }, | ||||
|   "qux": { | ||||
|     "corge": "grault" | ||||
|   } | ||||
| }, | ||||
|     "patch": [ | ||||
|   { "op": "move", "from": "/foo/waldo", "path": "/qux/thud" } | ||||
| ], | ||||
|     "expected": { | ||||
|   "foo": { | ||||
|     "bar": "baz" | ||||
|   }, | ||||
|   "qux": { | ||||
|     "corge": "grault", | ||||
|     "thud": "fred" | ||||
|   } | ||||
| } | ||||
|   }, | ||||
| 
 | ||||
|   { | ||||
|     "comment": "A.7.  Moving an Array Element", | ||||
|     "doc": { | ||||
|   "foo": [ "all", "grass", "cows", "eat" ] | ||||
| }, | ||||
|     "patch": [ | ||||
|   { "op": "move", "from": "/foo/1", "path": "/foo/3" } | ||||
| ], | ||||
|     "expected": { | ||||
|   "foo": [ "all", "cows", "eat", "grass" ] | ||||
| } | ||||
| 
 | ||||
|   }, | ||||
| 
 | ||||
|   { | ||||
|     "comment": "A.8.  Testing a Value: Success", | ||||
|     "doc": { | ||||
|   "baz": "qux", | ||||
|   "foo": [ "a", 2, "c" ] | ||||
| }, | ||||
|     "patch": [ | ||||
|   { "op": "test", "path": "/baz", "value": "qux" }, | ||||
|   { "op": "test", "path": "/foo/1", "value": 2 } | ||||
| ], | ||||
|     "expected": { | ||||
|      "baz": "qux", | ||||
|      "foo": [ "a", 2, "c" ] | ||||
|     } | ||||
|   }, | ||||
| 
 | ||||
|   { | ||||
|     "comment": "A.9.  Testing a Value: Error", | ||||
|     "doc": { | ||||
|   "baz": "qux" | ||||
| }, | ||||
|     "patch": [ | ||||
|   { "op": "test", "path": "/baz", "value": "bar" } | ||||
| ], | ||||
|     "error": "string not equivalent" | ||||
|   }, | ||||
| 
 | ||||
|   { | ||||
|     "comment": "A.10.  Adding a nested Member Object", | ||||
|     "doc": { | ||||
|   "foo": "bar" | ||||
| }, | ||||
|     "patch": [ | ||||
|   { "op": "add", "path": "/child", "value": { "grandchild": { } } } | ||||
| ], | ||||
|     "expected": { | ||||
|   "foo": "bar", | ||||
|   "child": { | ||||
|     "grandchild": { | ||||
|     } | ||||
|   } | ||||
| } | ||||
|   }, | ||||
| 
 | ||||
|   { | ||||
|     "comment": "A.11.  Ignoring Unrecognized Elements", | ||||
|     "doc": { | ||||
|   "foo":"bar" | ||||
| }, | ||||
|     "patch": [ | ||||
|   { "op": "add", "path": "/baz", "value": "qux", "xyz": 123 } | ||||
| ], | ||||
|     "expected": { | ||||
|   "foo":"bar", | ||||
|   "baz":"qux" | ||||
| } | ||||
|   }, | ||||
| 
 | ||||
|  { | ||||
|     "comment": "A.12.  Adding to a Non-existent Target", | ||||
|     "doc": { | ||||
|   "foo": "bar" | ||||
| }, | ||||
|     "patch": [ | ||||
|   { "op": "add", "path": "/baz/bat", "value": "qux" } | ||||
| ], | ||||
|     "error": "add to a non-existent target" | ||||
|   }, | ||||
| 
 | ||||
|  { | ||||
|     "comment": "A.13 Invalid JSON Patch Document", | ||||
|     "doc": { | ||||
|      "foo": "bar" | ||||
|     }, | ||||
|     "patch": [ | ||||
|   { "op": "add", "path": "/baz", "value": "qux", "op": "remove" } | ||||
| ], | ||||
|     "error": "operation has two 'op' members", | ||||
|     "disabled": true | ||||
|   }, | ||||
| 
 | ||||
|   { | ||||
|     "comment": "A.14. ~ Escape Ordering", | ||||
|     "doc": { | ||||
|        "/": 9, | ||||
|        "~1": 10 | ||||
|     }, | ||||
|     "patch": [{"op": "test", "path": "/~01", "value": 10}], | ||||
|     "expected": { | ||||
|        "/": 9, | ||||
|        "~1": 10 | ||||
|     } | ||||
|   }, | ||||
| 
 | ||||
|   { | ||||
|     "comment": "A.15. Comparing Strings and Numbers", | ||||
|     "doc": { | ||||
|        "/": 9, | ||||
|        "~1": 10 | ||||
|     }, | ||||
|     "patch": [{"op": "test", "path": "/~01", "value": "10"}], | ||||
|     "error": "number is not equal to string" | ||||
|   }, | ||||
| 
 | ||||
|   { | ||||
|     "comment": "A.16. Adding an Array Value", | ||||
|     "doc": { | ||||
|        "foo": ["bar"] | ||||
|     }, | ||||
|     "patch": [{ "op": "add", "path": "/foo/-", "value": ["abc", "def"] }], | ||||
|     "expected": { | ||||
|       "foo": ["bar", ["abc", "def"]] | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
| ] | ||||
							
								
								
									
										434
									
								
								test/data/json-patch-tests/tests.json
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										434
									
								
								test/data/json-patch-tests/tests.json
									
										
									
									
									
										Executable file
									
								
							|  | @ -0,0 +1,434 @@ | |||
| [ | ||||
|     { "comment": "empty list, empty docs", | ||||
|       "doc": {}, | ||||
|       "patch": [], | ||||
|       "expected": {} }, | ||||
| 
 | ||||
|     { "comment": "empty patch list", | ||||
|       "doc": {"foo": 1}, | ||||
|       "patch": [], | ||||
|       "expected": {"foo": 1} }, | ||||
| 
 | ||||
|     { "comment": "rearrangements OK?", | ||||
|       "doc": {"foo": 1, "bar": 2}, | ||||
|       "patch": [], | ||||
|       "expected": {"bar":2, "foo": 1} }, | ||||
| 
 | ||||
|     { "comment": "rearrangements OK?  How about one level down ... array", | ||||
|       "doc": [{"foo": 1, "bar": 2}], | ||||
|       "patch": [], | ||||
|       "expected": [{"bar":2, "foo": 1}] }, | ||||
| 
 | ||||
|     { "comment": "rearrangements OK?  How about one level down...", | ||||
|       "doc": {"foo":{"foo": 1, "bar": 2}}, | ||||
|       "patch": [], | ||||
|       "expected": {"foo":{"bar":2, "foo": 1}} }, | ||||
| 
 | ||||
|     { "comment": "add replaces any existing field", | ||||
|       "doc": {"foo": null}, | ||||
|       "patch": [{"op": "add", "path": "/foo", "value":1}], | ||||
|       "expected": {"foo": 1} }, | ||||
| 
 | ||||
|     { "comment": "toplevel array", | ||||
|       "doc": [], | ||||
|       "patch": [{"op": "add", "path": "/0", "value": "foo"}], | ||||
|       "expected": ["foo"] }, | ||||
| 
 | ||||
|     { "comment": "toplevel array, no change", | ||||
|       "doc": ["foo"], | ||||
|       "patch": [], | ||||
|       "expected": ["foo"] }, | ||||
| 
 | ||||
|     { "comment": "toplevel object, numeric string", | ||||
|       "doc": {}, | ||||
|       "patch": [{"op": "add", "path": "/foo", "value": "1"}], | ||||
|       "expected": {"foo":"1"} }, | ||||
| 
 | ||||
|     { "comment": "toplevel object, integer", | ||||
|       "doc": {}, | ||||
|       "patch": [{"op": "add", "path": "/foo", "value": 1}], | ||||
|       "expected": {"foo":1} }, | ||||
| 
 | ||||
|     { "comment": "Toplevel scalar values OK?", | ||||
|       "doc": "foo", | ||||
|       "patch": [{"op": "replace", "path": "", "value": "bar"}], | ||||
|       "expected": "bar", | ||||
|       "disabled": true }, | ||||
| 
 | ||||
|     { "comment": "replace object document with array document?", | ||||
|       "doc": {}, | ||||
|       "patch": [{"op": "add", "path": "", "value": []}], | ||||
|       "expected": [] }, | ||||
| 
 | ||||
|     { "comment": "replace array document with object document?", | ||||
|       "doc": [], | ||||
|       "patch": [{"op": "add", "path": "", "value": {}}], | ||||
|       "expected": {} }, | ||||
| 
 | ||||
|     { "comment": "append to root array document?", | ||||
|       "doc": [], | ||||
|       "patch": [{"op": "add", "path": "/-", "value": "hi"}], | ||||
|       "expected": ["hi"] }, | ||||
| 
 | ||||
|     { "comment": "Add, / target", | ||||
|       "doc": {}, | ||||
|       "patch": [ {"op": "add", "path": "/", "value":1 } ], | ||||
|       "expected": {"":1} }, | ||||
| 
 | ||||
|     { "comment": "Add, /foo/ deep target (trailing slash)", | ||||
|       "doc": {"foo": {}}, | ||||
|       "patch": [ {"op": "add", "path": "/foo/", "value":1 } ], | ||||
|       "expected": {"foo":{"": 1}} }, | ||||
| 
 | ||||
|     { "comment": "Add composite value at top level", | ||||
|       "doc": {"foo": 1}, | ||||
|       "patch": [{"op": "add", "path": "/bar", "value": [1, 2]}], | ||||
|       "expected": {"foo": 1, "bar": [1, 2]} }, | ||||
| 
 | ||||
|     { "comment": "Add into composite value", | ||||
|       "doc": {"foo": 1, "baz": [{"qux": "hello"}]}, | ||||
|       "patch": [{"op": "add", "path": "/baz/0/foo", "value": "world"}], | ||||
|       "expected": {"foo": 1, "baz": [{"qux": "hello", "foo": "world"}]} }, | ||||
| 
 | ||||
|     { "doc": {"bar": [1, 2]}, | ||||
|       "patch": [{"op": "add", "path": "/bar/8", "value": "5"}], | ||||
|       "error": "Out of bounds (upper)" }, | ||||
| 
 | ||||
|     { "doc": {"bar": [1, 2]}, | ||||
|       "patch": [{"op": "add", "path": "/bar/-1", "value": "5"}], | ||||
|       "error": "Out of bounds (lower)" }, | ||||
| 
 | ||||
|     { "doc": {"foo": 1}, | ||||
|       "patch": [{"op": "add", "path": "/bar", "value": true}], | ||||
|       "expected": {"foo": 1, "bar": true} }, | ||||
| 
 | ||||
|     { "doc": {"foo": 1}, | ||||
|       "patch": [{"op": "add", "path": "/bar", "value": false}], | ||||
|       "expected": {"foo": 1, "bar": false} }, | ||||
| 
 | ||||
|     { "doc": {"foo": 1}, | ||||
|       "patch": [{"op": "add", "path": "/bar", "value": null}], | ||||
|       "expected": {"foo": 1, "bar": null} }, | ||||
| 
 | ||||
|     { "comment": "0 can be an array index or object element name", | ||||
|       "doc": {"foo": 1}, | ||||
|       "patch": [{"op": "add", "path": "/0", "value": "bar"}], | ||||
|       "expected": {"foo": 1, "0": "bar" } }, | ||||
| 
 | ||||
|     { "doc": ["foo"], | ||||
|       "patch": [{"op": "add", "path": "/1", "value": "bar"}], | ||||
|       "expected": ["foo", "bar"] }, | ||||
| 
 | ||||
|     { "doc": ["foo", "sil"], | ||||
|       "patch": [{"op": "add", "path": "/1", "value": "bar"}], | ||||
|       "expected": ["foo", "bar", "sil"] }, | ||||
| 
 | ||||
|     { "doc": ["foo", "sil"], | ||||
|       "patch": [{"op": "add", "path": "/0", "value": "bar"}], | ||||
|       "expected": ["bar", "foo", "sil"] }, | ||||
| 
 | ||||
|     { "comment": "push item to array via last index + 1", | ||||
|       "doc": ["foo", "sil"], | ||||
|       "patch": [{"op":"add", "path": "/2", "value": "bar"}], | ||||
|       "expected": ["foo", "sil", "bar"] }, | ||||
| 
 | ||||
|     { "comment": "add item to array at index > length should fail", | ||||
|       "doc": ["foo", "sil"], | ||||
|       "patch": [{"op":"add", "path": "/3", "value": "bar"}], | ||||
|       "error": "index is greater than number of items in array" }, | ||||
|        | ||||
|     { "comment": "test against implementation-specific numeric parsing", | ||||
|       "doc": {"1e0": "foo"}, | ||||
|       "patch": [{"op": "test", "path": "/1e0", "value": "foo"}], | ||||
|       "expected": {"1e0": "foo"} }, | ||||
| 
 | ||||
|     { "comment": "test with bad number should fail", | ||||
|       "doc": ["foo", "bar"], | ||||
|       "patch": [{"op": "test", "path": "/1e0", "value": "bar"}], | ||||
|       "error": "test op shouldn't get array element 1" }, | ||||
| 
 | ||||
|     { "doc": ["foo", "sil"], | ||||
|       "patch": [{"op": "add", "path": "/bar", "value": 42}], | ||||
|       "error": "Object operation on array target" }, | ||||
| 
 | ||||
|     { "doc": ["foo", "sil"], | ||||
|       "patch": [{"op": "add", "path": "/1", "value": ["bar", "baz"]}], | ||||
|       "expected": ["foo", ["bar", "baz"], "sil"], | ||||
|       "comment": "value in array add not flattened" }, | ||||
| 
 | ||||
|     { "doc": {"foo": 1, "bar": [1, 2, 3, 4]}, | ||||
|       "patch": [{"op": "remove", "path": "/bar"}], | ||||
|       "expected": {"foo": 1} }, | ||||
| 
 | ||||
|     { "doc": {"foo": 1, "baz": [{"qux": "hello"}]}, | ||||
|       "patch": [{"op": "remove", "path": "/baz/0/qux"}], | ||||
|       "expected": {"foo": 1, "baz": [{}]} }, | ||||
| 
 | ||||
|     { "doc": {"foo": 1, "baz": [{"qux": "hello"}]}, | ||||
|       "patch": [{"op": "replace", "path": "/foo", "value": [1, 2, 3, 4]}], | ||||
|       "expected": {"foo": [1, 2, 3, 4], "baz": [{"qux": "hello"}]} }, | ||||
| 
 | ||||
|     { "doc": {"foo": [1, 2, 3, 4], "baz": [{"qux": "hello"}]}, | ||||
|       "patch": [{"op": "replace", "path": "/baz/0/qux", "value": "world"}], | ||||
|       "expected": {"foo": [1, 2, 3, 4], "baz": [{"qux": "world"}]} }, | ||||
| 
 | ||||
|     { "doc": ["foo"], | ||||
|       "patch": [{"op": "replace", "path": "/0", "value": "bar"}], | ||||
|       "expected": ["bar"] }, | ||||
| 
 | ||||
|     { "doc": [""], | ||||
|       "patch": [{"op": "replace", "path": "/0", "value": 0}], | ||||
|       "expected": [0] }, | ||||
| 
 | ||||
|     { "doc": [""], | ||||
|       "patch": [{"op": "replace", "path": "/0", "value": true}], | ||||
|       "expected": [true] }, | ||||
| 
 | ||||
|     { "doc": [""], | ||||
|       "patch": [{"op": "replace", "path": "/0", "value": false}], | ||||
|       "expected": [false] }, | ||||
| 
 | ||||
|     { "doc": [""], | ||||
|       "patch": [{"op": "replace", "path": "/0", "value": null}], | ||||
|       "expected": [null] }, | ||||
| 
 | ||||
|     { "doc": ["foo", "sil"], | ||||
|       "patch": [{"op": "replace", "path": "/1", "value": ["bar", "baz"]}], | ||||
|       "expected": ["foo", ["bar", "baz"]], | ||||
|       "comment": "value in array replace not flattened" }, | ||||
| 
 | ||||
|     { "comment": "replace whole document", | ||||
|       "doc": {"foo": "bar"}, | ||||
|       "patch": [{"op": "replace", "path": "", "value": {"baz": "qux"}}], | ||||
|       "expected": {"baz": "qux"} }, | ||||
| 
 | ||||
|     { "comment": "test replace with missing parent key should fail", | ||||
|       "doc": {"bar": "baz"}, | ||||
|       "patch": [{"op": "replace", "path": "/foo/bar", "value": false}], | ||||
|       "error": "replace op should fail with missing parent key" }, | ||||
| 
 | ||||
|     { "comment": "spurious patch properties", | ||||
|       "doc": {"foo": 1}, | ||||
|       "patch": [{"op": "test", "path": "/foo", "value": 1, "spurious": 1}], | ||||
|       "expected": {"foo": 1} }, | ||||
| 
 | ||||
|     { "doc": {"foo": null}, | ||||
|       "patch": [{"op": "test", "path": "/foo", "value": null}], | ||||
|       "comment": "null value should be valid obj property" }, | ||||
| 
 | ||||
|     { "doc": {"foo": null}, | ||||
|       "patch": [{"op": "replace", "path": "/foo", "value": "truthy"}], | ||||
|       "expected": {"foo": "truthy"}, | ||||
|       "comment": "null value should be valid obj property to be replaced with something truthy" }, | ||||
| 
 | ||||
|     { "doc": {"foo": null}, | ||||
|       "patch": [{"op": "move", "from": "/foo", "path": "/bar"}], | ||||
|       "expected": {"bar": null}, | ||||
|       "comment": "null value should be valid obj property to be moved" }, | ||||
| 
 | ||||
|     { "doc": {"foo": null}, | ||||
|       "patch": [{"op": "copy", "from": "/foo", "path": "/bar"}], | ||||
|       "expected": {"foo": null, "bar": null}, | ||||
|       "comment": "null value should be valid obj property to be copied" }, | ||||
| 
 | ||||
|     { "doc": {"foo": null}, | ||||
|       "patch": [{"op": "remove", "path": "/foo"}], | ||||
|       "expected": {}, | ||||
|       "comment": "null value should be valid obj property to be removed" }, | ||||
| 
 | ||||
|     { "doc": {"foo": "bar"}, | ||||
|       "patch": [{"op": "replace", "path": "/foo", "value": null}], | ||||
|       "expected": {"foo": null}, | ||||
|       "comment": "null value should still be valid obj property replace other value" }, | ||||
| 
 | ||||
|     { "doc": {"foo": {"foo": 1, "bar": 2}}, | ||||
|       "patch": [{"op": "test", "path": "/foo", "value": {"bar": 2, "foo": 1}}], | ||||
|       "comment": "test should pass despite rearrangement" }, | ||||
| 
 | ||||
|     { "doc": {"foo": [{"foo": 1, "bar": 2}]}, | ||||
|       "patch": [{"op": "test", "path": "/foo", "value": [{"bar": 2, "foo": 1}]}], | ||||
|       "comment": "test should pass despite (nested) rearrangement" }, | ||||
| 
 | ||||
|     { "doc": {"foo": {"bar": [1, 2, 5, 4]}}, | ||||
|       "patch": [{"op": "test", "path": "/foo", "value": {"bar": [1, 2, 5, 4]}}], | ||||
|       "comment": "test should pass - no error" }, | ||||
| 
 | ||||
|     { "doc": {"foo": {"bar": [1, 2, 5, 4]}}, | ||||
|       "patch": [{"op": "test", "path": "/foo", "value": [1, 2]}], | ||||
|       "error": "test op should fail" }, | ||||
| 
 | ||||
|     { "comment": "Whole document", | ||||
|       "doc": { "foo": 1 }, | ||||
|       "patch": [{"op": "test", "path": "", "value": {"foo": 1}}], | ||||
|       "disabled": true }, | ||||
| 
 | ||||
|     { "comment": "Empty-string element", | ||||
|       "doc": { "": 1 }, | ||||
|       "patch": [{"op": "test", "path": "/", "value": 1}] }, | ||||
| 
 | ||||
|     { "doc": { | ||||
|             "foo": ["bar", "baz"], | ||||
|             "": 0, | ||||
|             "a/b": 1, | ||||
|             "c%d": 2, | ||||
|             "e^f": 3, | ||||
|             "g|h": 4, | ||||
|             "i\\j": 5, | ||||
|             "k\"l": 6, | ||||
|             " ": 7, | ||||
|             "m~n": 8 | ||||
|             }, | ||||
|       "patch": [{"op": "test", "path": "/foo", "value": ["bar", "baz"]}, | ||||
|                 {"op": "test", "path": "/foo/0", "value": "bar"}, | ||||
|                 {"op": "test", "path": "/", "value": 0}, | ||||
|                 {"op": "test", "path": "/a~1b", "value": 1}, | ||||
|                 {"op": "test", "path": "/c%d", "value": 2}, | ||||
|                 {"op": "test", "path": "/e^f", "value": 3}, | ||||
|                 {"op": "test", "path": "/g|h", "value": 4}, | ||||
|                 {"op": "test", "path":  "/i\\j", "value": 5}, | ||||
|                 {"op": "test", "path": "/k\"l", "value": 6}, | ||||
|                 {"op": "test", "path": "/ ", "value": 7}, | ||||
|                 {"op": "test", "path": "/m~0n", "value": 8}] }, | ||||
| 
 | ||||
|     { "comment": "Move to same location has no effect", | ||||
|       "doc": {"foo": 1}, | ||||
|       "patch": [{"op": "move", "from": "/foo", "path": "/foo"}], | ||||
|       "expected": {"foo": 1} }, | ||||
| 
 | ||||
|     { "doc": {"foo": 1, "baz": [{"qux": "hello"}]}, | ||||
|       "patch": [{"op": "move", "from": "/foo", "path": "/bar"}], | ||||
|       "expected": {"baz": [{"qux": "hello"}], "bar": 1} }, | ||||
| 
 | ||||
|     { "doc": {"baz": [{"qux": "hello"}], "bar": 1}, | ||||
|       "patch": [{"op": "move", "from": "/baz/0/qux", "path": "/baz/1"}], | ||||
|       "expected": {"baz": [{}, "hello"], "bar": 1} }, | ||||
| 
 | ||||
|     { "doc": {"baz": [{"qux": "hello"}], "bar": 1}, | ||||
|       "patch": [{"op": "copy", "from": "/baz/0", "path": "/boo"}], | ||||
|       "expected": {"baz":[{"qux":"hello"}],"bar":1,"boo":{"qux":"hello"}} }, | ||||
| 
 | ||||
|     { "comment": "replacing the root of the document is possible with add", | ||||
|       "doc": {"foo": "bar"}, | ||||
|       "patch": [{"op": "add", "path": "", "value": {"baz": "qux"}}], | ||||
|       "expected": {"baz":"qux"}}, | ||||
| 
 | ||||
|     { "comment": "Adding to \"/-\" adds to the end of the array", | ||||
|       "doc": [ 1, 2 ], | ||||
|       "patch": [ { "op": "add", "path": "/-", "value": { "foo": [ "bar", "baz" ] } } ], | ||||
|       "expected": [ 1, 2, { "foo": [ "bar", "baz" ] } ]}, | ||||
| 
 | ||||
|     { "comment": "Adding to \"/-\" adds to the end of the array, even n levels down", | ||||
|       "doc": [ 1, 2, [ 3, [ 4, 5 ] ] ], | ||||
|       "patch": [ { "op": "add", "path": "/2/1/-", "value": { "foo": [ "bar", "baz" ] } } ], | ||||
|       "expected": [ 1, 2, [ 3, [ 4, 5, { "foo": [ "bar", "baz" ] } ] ] ]}, | ||||
| 
 | ||||
|     { "comment": "test remove with bad number should fail", | ||||
|       "doc": {"foo": 1, "baz": [{"qux": "hello"}]}, | ||||
|       "patch": [{"op": "remove", "path": "/baz/1e0/qux"}], | ||||
|       "error": "remove op shouldn't remove from array with bad number" }, | ||||
| 
 | ||||
|     { "comment": "test remove on array", | ||||
|       "doc": [1, 2, 3, 4], | ||||
|       "patch": [{"op": "remove", "path": "/0"}], | ||||
|       "expected": [2, 3, 4] }, | ||||
| 
 | ||||
|     { "comment": "test repeated removes", | ||||
|       "doc": [1, 2, 3, 4], | ||||
|       "patch": [{ "op": "remove", "path": "/1" }, | ||||
|                 { "op": "remove", "path": "/2" }], | ||||
|       "expected": [1, 3] }, | ||||
| 
 | ||||
|     { "comment": "test remove with bad index should fail", | ||||
|       "doc": [1, 2, 3, 4], | ||||
|       "patch": [{"op": "remove", "path": "/1e0"}], | ||||
|       "error": "remove op shouldn't remove from array with bad number" }, | ||||
| 
 | ||||
|     { "comment": "test replace with bad number should fail", | ||||
|       "doc": [""], | ||||
|       "patch": [{"op": "replace", "path": "/1e0", "value": false}], | ||||
|       "error": "replace op shouldn't replace in array with bad number" }, | ||||
| 
 | ||||
|     { "comment": "test copy with bad number should fail", | ||||
|       "doc": {"baz": [1,2,3], "bar": 1}, | ||||
|       "patch": [{"op": "copy", "from": "/baz/1e0", "path": "/boo"}], | ||||
|       "error": "copy op shouldn't work with bad number" }, | ||||
| 
 | ||||
|     { "comment": "test move with bad number should fail", | ||||
|       "doc": {"foo": 1, "baz": [1,2,3,4]}, | ||||
|       "patch": [{"op": "move", "from": "/baz/1e0", "path": "/foo"}], | ||||
|       "error": "move op shouldn't work with bad number" }, | ||||
| 
 | ||||
|     { "comment": "test add with bad number should fail", | ||||
|       "doc": ["foo", "sil"], | ||||
|       "patch": [{"op": "add", "path": "/1e0", "value": "bar"}], | ||||
|       "error": "add op shouldn't add to array with bad number" }, | ||||
| 
 | ||||
|     { "comment": "missing 'value' parameter to add", | ||||
|       "doc": [ 1 ], | ||||
|       "patch": [ { "op": "add", "path": "/-" } ], | ||||
|       "error": "missing 'value' parameter" }, | ||||
| 
 | ||||
|     { "comment": "missing 'value' parameter to replace", | ||||
|       "doc": [ 1 ], | ||||
|       "patch": [ { "op": "replace", "path": "/0" } ], | ||||
|       "error": "missing 'value' parameter" }, | ||||
| 
 | ||||
|     { "comment": "missing 'value' parameter to test", | ||||
|       "doc": [ null ], | ||||
|       "patch": [ { "op": "test", "path": "/0" } ], | ||||
|       "error": "missing 'value' parameter" }, | ||||
| 
 | ||||
|     { "comment": "missing value parameter to test - where undef is falsy", | ||||
|       "doc": [ false ], | ||||
|       "patch": [ { "op": "test", "path": "/0" } ], | ||||
|       "error": "missing 'value' parameter" }, | ||||
| 
 | ||||
|     { "comment": "missing from parameter to copy", | ||||
|       "doc": [ 1 ], | ||||
|       "patch": [ { "op": "copy", "path": "/-" } ], | ||||
|       "error": "missing 'from' parameter" }, | ||||
| 
 | ||||
|     { "comment": "missing from parameter to move", | ||||
|       "doc": { "foo": 1 }, | ||||
|       "patch": [ { "op": "move", "path": "" } ], | ||||
|       "error": "missing 'from' parameter" }, | ||||
| 
 | ||||
|     { "comment": "duplicate ops", | ||||
|       "doc": { "foo": "bar" }, | ||||
|       "patch": [ { "op": "add", "path": "/baz", "value": "qux", | ||||
|                    "op": "move", "from":"/foo" } ], | ||||
|       "error": "patch has two 'op' members", | ||||
|       "disabled": true }, | ||||
| 
 | ||||
|     { "comment": "unrecognized op should fail", | ||||
|       "doc": {"foo": 1}, | ||||
|       "patch": [{"op": "spam", "path": "/foo", "value": 1}], | ||||
|       "error": "Unrecognized op 'spam'" }, | ||||
| 
 | ||||
|     { "comment": "test with bad array number that has leading zeros", | ||||
|       "doc": ["foo", "bar"], | ||||
|       "patch": [{"op": "test", "path": "/00", "value": "foo"}], | ||||
|       "error": "test op should reject the array value, it has leading zeros" }, | ||||
| 
 | ||||
|     { "comment": "test with bad array number that has leading zeros", | ||||
|       "doc": ["foo", "bar"], | ||||
|       "patch": [{"op": "test", "path": "/01", "value": "bar"}], | ||||
|       "error": "test op should reject the array value, it has leading zeros" }, | ||||
| 
 | ||||
|     { "comment": "Removing nonexistent field", | ||||
|       "doc": {"foo" : "bar"}, | ||||
|       "patch": [{"op": "remove", "path": "/baz"}], | ||||
|       "error": "removing a nonexistent field should fail" }, | ||||
| 
 | ||||
|     { "comment": "Removing nonexistent index", | ||||
|       "doc": ["foo", "bar"], | ||||
|       "patch": [{"op": "remove", "path": "/2"}], | ||||
|       "error": "removing a nonexistent index should fail" }, | ||||
| 
 | ||||
|     { "comment": "Patch with different capitalisation than doc", | ||||
|        "doc": {"foo":"bar"}, | ||||
|        "patch": [{"op": "add", "path": "/FOO", "value": "BAR"}], | ||||
|        "expected": {"foo": "bar", "FOO": "BAR"} | ||||
|     } | ||||
| 
 | ||||
| ] | ||||
							
								
								
									
										
											BIN
										
									
								
								test/data/markus_kuhn/UTF-8-test.txt
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								test/data/markus_kuhn/UTF-8-test.txt
									
										
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							|  | @ -1,7 +1,7 @@ | |||
| /*
 | ||||
|     __ _____ _____ _____ | ||||
|  __|  |   __|     |   | |  JSON for Modern C++ (fuzz test support) | ||||
| |  |  |__   |  |  | | | |  version 2.1.1 | ||||
| |  |  |__   |  |  | | | |  version 3.0.1 | ||||
| |_____|_____|_____|_|___|  https://github.com/nlohmann/json
 | ||||
| 
 | ||||
| This file implements a driver for American Fuzzy Lop (afl-fuzz). It relies on | ||||
|  |  | |||
|  | @ -1,7 +1,7 @@ | |||
| /*
 | ||||
|     __ _____ _____ _____ | ||||
|  __|  |   __|     |   | |  JSON for Modern C++ (fuzz test support) | ||||
| |  |  |__   |  |  | | | |  version 2.1.1 | ||||
| |  |  |__   |  |  | | | |  version 3.0.1 | ||||
| |_____|_____|_____|_|___|  https://github.com/nlohmann/json
 | ||||
| 
 | ||||
| This file implements a parser test suitable for fuzz testing. Given a byte | ||||
|  |  | |||
|  | @ -1,7 +1,7 @@ | |||
| /*
 | ||||
|     __ _____ _____ _____ | ||||
|  __|  |   __|     |   | |  JSON for Modern C++ (fuzz test support) | ||||
| |  |  |__   |  |  | | | |  version 2.1.1 | ||||
| |  |  |__   |  |  | | | |  version 3.0.1 | ||||
| |_____|_____|_____|_|___|  https://github.com/nlohmann/json
 | ||||
| 
 | ||||
| This file implements a parser test suitable for fuzz testing. Given a byte | ||||
|  |  | |||
|  | @ -1,7 +1,7 @@ | |||
| /*
 | ||||
|     __ _____ _____ _____ | ||||
|  __|  |   __|     |   | |  JSON for Modern C++ (fuzz test support) | ||||
| |  |  |__   |  |  | | | |  version 2.1.1 | ||||
| |  |  |__   |  |  | | | |  version 3.0.1 | ||||
| |_____|_____|_____|_|___|  https://github.com/nlohmann/json
 | ||||
| 
 | ||||
| This file implements a parser test suitable for fuzz testing. Given a byte | ||||
|  |  | |||
|  | @ -1,7 +1,7 @@ | |||
| /*
 | ||||
|     __ _____ _____ _____ | ||||
|  __|  |   __|     |   | |  JSON for Modern C++ (test suite) | ||||
| |  |  |__   |  |  | | | |  version 2.1.1 | ||||
| |  |  |__   |  |  | | | |  version 3.0.1 | ||||
| |_____|_____|_____|_|___|  https://github.com/nlohmann/json
 | ||||
| 
 | ||||
| Licensed under the MIT License <http://opensource.org/licenses/MIT>.
 | ||||
|  | @ -256,7 +256,6 @@ TEST_CASE("algorithms") | |||
| 
 | ||||
|     SECTION("set operations") | ||||
|     { | ||||
|         /*
 | ||||
|         SECTION("std::merge") | ||||
|         { | ||||
|             { | ||||
|  | @ -268,7 +267,6 @@ TEST_CASE("algorithms") | |||
|                 CHECK(j3 == json({1, 2, 2, 3, 4, 5, 6, 7, 8})); | ||||
|             } | ||||
|         } | ||||
|         */ | ||||
| 
 | ||||
|         SECTION("std::set_difference") | ||||
|         { | ||||
|  | @ -290,7 +288,6 @@ TEST_CASE("algorithms") | |||
|             CHECK(j3 == json({1, 2, 3, 5, 7})); | ||||
|         } | ||||
| 
 | ||||
|         /*
 | ||||
|         SECTION("std::set_union") | ||||
|         { | ||||
|             json j1 = {2, 4, 6, 8}; | ||||
|  | @ -310,7 +307,6 @@ TEST_CASE("algorithms") | |||
|             std::set_symmetric_difference(j1.begin(), j1.end(), j2.begin(), j2.end(), std::back_inserter(j3)); | ||||
|             CHECK(j3 == json({1, 3, 4, 5, 6, 7, 8})); | ||||
|         } | ||||
|         */ | ||||
|     } | ||||
| 
 | ||||
|     SECTION("heap operations") | ||||
|  |  | |||
|  | @ -1,7 +1,7 @@ | |||
| /*
 | ||||
|     __ _____ _____ _____ | ||||
|  __|  |   __|     |   | |  JSON for Modern C++ (test suite) | ||||
| |  |  |__   |  |  | | | |  version 2.1.1 | ||||
| |  |  |__   |  |  | | | |  version 3.0.1 | ||||
| |_____|_____|_____|_|___|  https://github.com/nlohmann/json
 | ||||
| 
 | ||||
| Licensed under the MIT License <http://opensource.org/licenses/MIT>.
 | ||||
|  |  | |||
|  | @ -1,7 +1,7 @@ | |||
| /*
 | ||||
|     __ _____ _____ _____ | ||||
|  __|  |   __|     |   | |  JSON for Modern C++ (test suite) | ||||
| |  |  |__   |  |  | | | |  version 2.1.1 | ||||
| |  |  |__   |  |  | | | |  version 3.0.1 | ||||
| |_____|_____|_____|_|___|  https://github.com/nlohmann/json
 | ||||
| 
 | ||||
| Licensed under the MIT License <http://opensource.org/licenses/MIT>.
 | ||||
|  |  | |||
|  | @ -1,7 +1,7 @@ | |||
| /*
 | ||||
|     __ _____ _____ _____ | ||||
|  __|  |   __|     |   | |  JSON for Modern C++ (test suite) | ||||
| |  |  |__   |  |  | | | |  version 2.1.1 | ||||
| |  |  |__   |  |  | | | |  version 3.0.1 | ||||
| |_____|_____|_____|_|___|  https://github.com/nlohmann/json
 | ||||
| 
 | ||||
| Licensed under the MIT License <http://opensource.org/licenses/MIT>.
 | ||||
|  |  | |||
|  | @ -1,7 +1,7 @@ | |||
| /*
 | ||||
|     __ _____ _____ _____ | ||||
|  __|  |   __|     |   | |  JSON for Modern C++ (test suite) | ||||
| |  |  |__   |  |  | | | |  version 2.1.1 | ||||
| |  |  |__   |  |  | | | |  version 3.0.1 | ||||
| |_____|_____|_____|_|___|  https://github.com/nlohmann/json
 | ||||
| 
 | ||||
| Licensed under the MIT License <http://opensource.org/licenses/MIT>.
 | ||||
|  |  | |||
|  | @ -1,7 +1,7 @@ | |||
| /*
 | ||||
|     __ _____ _____ _____ | ||||
|  __|  |   __|     |   | |  JSON for Modern C++ (test suite) | ||||
| |  |  |__   |  |  | | | |  version 2.1.1 | ||||
| |  |  |__   |  |  | | | |  version 3.0.1 | ||||
| |_____|_____|_____|_|___|  https://github.com/nlohmann/json
 | ||||
| 
 | ||||
| Licensed under the MIT License <http://opensource.org/licenses/MIT>.
 | ||||
|  |  | |||
|  | @ -1,7 +1,7 @@ | |||
| /*
 | ||||
|     __ _____ _____ _____ | ||||
|  __|  |   __|     |   | |  JSON for Modern C++ (test suite) | ||||
| |  |  |__   |  |  | | | |  version 2.1.1 | ||||
| |  |  |__   |  |  | | | |  version 3.0.1 | ||||
| |_____|_____|_____|_|___|  https://github.com/nlohmann/json
 | ||||
| 
 | ||||
| Licensed under the MIT License <http://opensource.org/licenses/MIT>.
 | ||||
|  |  | |||
|  | @ -1,7 +1,7 @@ | |||
| /*
 | ||||
|     __ _____ _____ _____ | ||||
|  __|  |   __|     |   | |  JSON for Modern C++ (test suite) | ||||
| |  |  |__   |  |  | | | |  version 2.1.1 | ||||
| |  |  |__   |  |  | | | |  version 3.0.1 | ||||
| |_____|_____|_____|_|___|  https://github.com/nlohmann/json
 | ||||
| 
 | ||||
| Licensed under the MIT License <http://opensource.org/licenses/MIT>.
 | ||||
|  |  | |||
|  | @ -1,7 +1,7 @@ | |||
| /*
 | ||||
|     __ _____ _____ _____ | ||||
|  __|  |   __|     |   | |  JSON for Modern C++ (test suite) | ||||
| |  |  |__   |  |  | | | |  version 2.1.1 | ||||
| |  |  |__   |  |  | | | |  version 3.0.1 | ||||
| |_____|_____|_____|_|___|  https://github.com/nlohmann/json
 | ||||
| 
 | ||||
| Licensed under the MIT License <http://opensource.org/licenses/MIT>.
 | ||||
|  |  | |||
|  | @ -1,7 +1,7 @@ | |||
| /*
 | ||||
|     __ _____ _____ _____ | ||||
|  __|  |   __|     |   | |  JSON for Modern C++ (test suite) | ||||
| |  |  |__   |  |  | | | |  version 2.1.1 | ||||
| |  |  |__   |  |  | | | |  version 3.0.1 | ||||
| |_____|_____|_____|_|___|  https://github.com/nlohmann/json
 | ||||
| 
 | ||||
| Licensed under the MIT License <http://opensource.org/licenses/MIT>.
 | ||||
|  |  | |||
|  | @ -1,7 +1,7 @@ | |||
| /*
 | ||||
|     __ _____ _____ _____ | ||||
|  __|  |   __|     |   | |  JSON for Modern C++ (test suite) | ||||
| |  |  |__   |  |  | | | |  version 2.1.1 | ||||
| |  |  |__   |  |  | | | |  version 3.0.1 | ||||
| |_____|_____|_____|_|___|  https://github.com/nlohmann/json
 | ||||
| 
 | ||||
| Licensed under the MIT License <http://opensource.org/licenses/MIT>.
 | ||||
|  |  | |||
|  | @ -1,7 +1,7 @@ | |||
| /*
 | ||||
|     __ _____ _____ _____ | ||||
|  __|  |   __|     |   | |  JSON for Modern C++ (test suite) | ||||
| |  |  |__   |  |  | | | |  version 2.1.1 | ||||
| |  |  |__   |  |  | | | |  version 3.0.1 | ||||
| |_____|_____|_____|_|___|  https://github.com/nlohmann/json
 | ||||
| 
 | ||||
| Licensed under the MIT License <http://opensource.org/licenses/MIT>.
 | ||||
|  |  | |||
|  | @ -1,7 +1,7 @@ | |||
| /*
 | ||||
|     __ _____ _____ _____ | ||||
|  __|  |   __|     |   | |  JSON for Modern C++ (test suite) | ||||
| |  |  |__   |  |  | | | |  version 2.1.1 | ||||
| |  |  |__   |  |  | | | |  version 3.0.1 | ||||
| |_____|_____|_____|_|___|  https://github.com/nlohmann/json
 | ||||
| 
 | ||||
| Licensed under the MIT License <http://opensource.org/licenses/MIT>.
 | ||||
|  |  | |||
|  | @ -1,7 +1,7 @@ | |||
| /*
 | ||||
|     __ _____ _____ _____ | ||||
|  __|  |   __|     |   | |  JSON for Modern C++ (test suite) | ||||
| |  |  |__   |  |  | | | |  version 2.1.1 | ||||
| |  |  |__   |  |  | | | |  version 3.0.1 | ||||
| |_____|_____|_____|_|___|  https://github.com/nlohmann/json
 | ||||
| 
 | ||||
| Licensed under the MIT License <http://opensource.org/licenses/MIT>.
 | ||||
|  | @ -939,40 +939,40 @@ TEST_CASE("value conversion") | |||
| 
 | ||||
|             SECTION("std::map") | ||||
|             { | ||||
|                 auto m1 = j1.get<std::map<std::string, int>>(); | ||||
|                 auto m2 = j2.get<std::map<std::string, unsigned int>>(); | ||||
|                 auto m3 = j3.get<std::map<std::string, double>>(); | ||||
|                 auto m4 = j4.get<std::map<std::string, bool>>(); | ||||
|                 //auto m5 = j5.get<std::map<std::string, std::string>>();
 | ||||
|                 j1.get<std::map<std::string, int>>(); | ||||
|                 j2.get<std::map<std::string, unsigned int>>(); | ||||
|                 j3.get<std::map<std::string, double>>(); | ||||
|                 j4.get<std::map<std::string, bool>>(); | ||||
|                 j5.get<std::map<std::string, std::string>>(); | ||||
|             } | ||||
| 
 | ||||
|             SECTION("std::unordered_map") | ||||
|             { | ||||
|                 auto m1 = j1.get<std::unordered_map<std::string, int>>(); | ||||
|                 auto m2 = j2.get<std::unordered_map<std::string, unsigned int>>(); | ||||
|                 auto m3 = j3.get<std::unordered_map<std::string, double>>(); | ||||
|                 auto m4 = j4.get<std::unordered_map<std::string, bool>>(); | ||||
|                 //auto m5 = j5.get<std::unordered_map<std::string, std::string>>();
 | ||||
|                 j1.get<std::unordered_map<std::string, int>>(); | ||||
|                 j2.get<std::unordered_map<std::string, unsigned int>>(); | ||||
|                 j3.get<std::unordered_map<std::string, double>>(); | ||||
|                 j4.get<std::unordered_map<std::string, bool>>(); | ||||
|                 j5.get<std::unordered_map<std::string, std::string>>(); | ||||
|                 //CHECK(m5["one"] == "eins");
 | ||||
|             } | ||||
| 
 | ||||
|             SECTION("std::multimap") | ||||
|             { | ||||
|                 auto m1 = j1.get<std::multimap<std::string, int>>(); | ||||
|                 auto m2 = j2.get<std::multimap<std::string, unsigned int>>(); | ||||
|                 auto m3 = j3.get<std::multimap<std::string, double>>(); | ||||
|                 auto m4 = j4.get<std::multimap<std::string, bool>>(); | ||||
|                 //auto m5 = j5.get<std::multimap<std::string, std::string>>();
 | ||||
|                 j1.get<std::multimap<std::string, int>>(); | ||||
|                 j2.get<std::multimap<std::string, unsigned int>>(); | ||||
|                 j3.get<std::multimap<std::string, double>>(); | ||||
|                 j4.get<std::multimap<std::string, bool>>(); | ||||
|                 j5.get<std::multimap<std::string, std::string>>(); | ||||
|                 //CHECK(m5["one"] == "eins");
 | ||||
|             } | ||||
| 
 | ||||
|             SECTION("std::unordered_multimap") | ||||
|             { | ||||
|                 auto m1 = j1.get<std::unordered_multimap<std::string, int>>(); | ||||
|                 auto m2 = j2.get<std::unordered_multimap<std::string, unsigned int>>(); | ||||
|                 auto m3 = j3.get<std::unordered_multimap<std::string, double>>(); | ||||
|                 auto m4 = j4.get<std::unordered_multimap<std::string, bool>>(); | ||||
|                 //auto m5 = j5.get<std::unordered_multimap<std::string, std::string>>();
 | ||||
|                 j1.get<std::unordered_multimap<std::string, int>>(); | ||||
|                 j2.get<std::unordered_multimap<std::string, unsigned int>>(); | ||||
|                 j3.get<std::unordered_multimap<std::string, double>>(); | ||||
|                 j4.get<std::unordered_multimap<std::string, bool>>(); | ||||
|                 j5.get<std::unordered_multimap<std::string, std::string>>(); | ||||
|                 //CHECK(m5["one"] == "eins");
 | ||||
|             } | ||||
| 
 | ||||
|  | @ -993,29 +993,29 @@ TEST_CASE("value conversion") | |||
| 
 | ||||
|             SECTION("std::list") | ||||
|             { | ||||
|                 auto m1 = j1.get<std::list<int>>(); | ||||
|                 auto m2 = j2.get<std::list<unsigned int>>(); | ||||
|                 auto m3 = j3.get<std::list<double>>(); | ||||
|                 auto m4 = j4.get<std::list<bool>>(); | ||||
|                 auto m5 = j5.get<std::list<std::string>>(); | ||||
|                 j1.get<std::list<int>>(); | ||||
|                 j2.get<std::list<unsigned int>>(); | ||||
|                 j3.get<std::list<double>>(); | ||||
|                 j4.get<std::list<bool>>(); | ||||
|                 j5.get<std::list<std::string>>(); | ||||
|             } | ||||
| 
 | ||||
|             SECTION("std::forward_list") | ||||
|             { | ||||
|                 auto m1 = j1.get<std::forward_list<int>>(); | ||||
|                 auto m2 = j2.get<std::forward_list<unsigned int>>(); | ||||
|                 auto m3 = j3.get<std::forward_list<double>>(); | ||||
|                 auto m4 = j4.get<std::forward_list<bool>>(); | ||||
|                 auto m5 = j5.get<std::forward_list<std::string>>(); | ||||
|                 j1.get<std::forward_list<int>>(); | ||||
|                 j2.get<std::forward_list<unsigned int>>(); | ||||
|                 j3.get<std::forward_list<double>>(); | ||||
|                 j4.get<std::forward_list<bool>>(); | ||||
|                 j5.get<std::forward_list<std::string>>(); | ||||
|             } | ||||
| 
 | ||||
|             SECTION("std::array") | ||||
|             { | ||||
|                 auto m1 = j1.get<std::array<int, 4>>(); | ||||
|                 auto m2 = j2.get<std::array<unsigned int, 3>>(); | ||||
|                 auto m3 = j3.get<std::array<double, 4>>(); | ||||
|                 auto m4 = j4.get<std::array<bool, 3>>(); | ||||
|                 auto m5 = j5.get<std::array<std::string, 3>>(); | ||||
|                 j1.get<std::array<int, 4>>(); | ||||
|                 j2.get<std::array<unsigned int, 3>>(); | ||||
|                 j3.get<std::array<double, 4>>(); | ||||
|                 j4.get<std::array<bool, 3>>(); | ||||
|                 j5.get<std::array<std::string, 3>>(); | ||||
| 
 | ||||
|                 SECTION("std::array is larger than JSON") | ||||
|                 { | ||||
|  | @ -1035,47 +1035,47 @@ TEST_CASE("value conversion") | |||
| 
 | ||||
|             SECTION("std::valarray") | ||||
|             { | ||||
|                 auto m1 = j1.get<std::valarray<int>>(); | ||||
|                 auto m2 = j2.get<std::valarray<unsigned int>>(); | ||||
|                 auto m3 = j3.get<std::valarray<double>>(); | ||||
|                 auto m4 = j4.get<std::valarray<bool>>(); | ||||
|                 auto m5 = j5.get<std::valarray<std::string>>(); | ||||
|                 j1.get<std::valarray<int>>(); | ||||
|                 j2.get<std::valarray<unsigned int>>(); | ||||
|                 j3.get<std::valarray<double>>(); | ||||
|                 j4.get<std::valarray<bool>>(); | ||||
|                 j5.get<std::valarray<std::string>>(); | ||||
|             } | ||||
| 
 | ||||
|             SECTION("std::vector") | ||||
|             { | ||||
|                 auto m1 = j1.get<std::vector<int>>(); | ||||
|                 auto m2 = j2.get<std::vector<unsigned int>>(); | ||||
|                 auto m3 = j3.get<std::vector<double>>(); | ||||
|                 auto m4 = j4.get<std::vector<bool>>(); | ||||
|                 auto m5 = j5.get<std::vector<std::string>>(); | ||||
|                 j1.get<std::vector<int>>(); | ||||
|                 j2.get<std::vector<unsigned int>>(); | ||||
|                 j3.get<std::vector<double>>(); | ||||
|                 j4.get<std::vector<bool>>(); | ||||
|                 j5.get<std::vector<std::string>>(); | ||||
|             } | ||||
| 
 | ||||
|             SECTION("std::deque") | ||||
|             { | ||||
|                 auto m1 = j1.get<std::deque<int>>(); | ||||
|                 auto m2 = j2.get<std::deque<unsigned int>>(); | ||||
|                 auto m3 = j2.get<std::deque<double>>(); | ||||
|                 auto m4 = j4.get<std::deque<bool>>(); | ||||
|                 auto m5 = j5.get<std::deque<std::string>>(); | ||||
|                 j1.get<std::deque<int>>(); | ||||
|                 j2.get<std::deque<unsigned int>>(); | ||||
|                 j2.get<std::deque<double>>(); | ||||
|                 j4.get<std::deque<bool>>(); | ||||
|                 j5.get<std::deque<std::string>>(); | ||||
|             } | ||||
| 
 | ||||
|             SECTION("std::set") | ||||
|             { | ||||
|                 auto m1 = j1.get<std::set<int>>(); | ||||
|                 auto m2 = j2.get<std::set<unsigned int>>(); | ||||
|                 auto m3 = j3.get<std::set<double>>(); | ||||
|                 auto m4 = j4.get<std::set<bool>>(); | ||||
|                 auto m5 = j5.get<std::set<std::string>>(); | ||||
|                 j1.get<std::set<int>>(); | ||||
|                 j2.get<std::set<unsigned int>>(); | ||||
|                 j3.get<std::set<double>>(); | ||||
|                 j4.get<std::set<bool>>(); | ||||
|                 j5.get<std::set<std::string>>(); | ||||
|             } | ||||
| 
 | ||||
|             SECTION("std::unordered_set") | ||||
|             { | ||||
|                 auto m1 = j1.get<std::unordered_set<int>>(); | ||||
|                 auto m2 = j2.get<std::unordered_set<unsigned int>>(); | ||||
|                 auto m3 = j3.get<std::unordered_set<double>>(); | ||||
|                 auto m4 = j4.get<std::unordered_set<bool>>(); | ||||
|                 auto m5 = j5.get<std::unordered_set<std::string>>(); | ||||
|                 j1.get<std::unordered_set<int>>(); | ||||
|                 j2.get<std::unordered_set<unsigned int>>(); | ||||
|                 j3.get<std::unordered_set<double>>(); | ||||
|                 j4.get<std::unordered_set<bool>>(); | ||||
|                 j5.get<std::unordered_set<std::string>>(); | ||||
|             } | ||||
| 
 | ||||
|             SECTION("exception in case of a non-object type") | ||||
|  |  | |||
|  | @ -1,7 +1,7 @@ | |||
| /*
 | ||||
|     __ _____ _____ _____ | ||||
|  __|  |   __|     |   | |  JSON for Modern C++ (test suite) | ||||
| |  |  |__   |  |  | | | |  version 2.1.1 | ||||
| |  |  |__   |  |  | | | |  version 3.0.1 | ||||
| |_____|_____|_____|_|___|  https://github.com/nlohmann/json
 | ||||
| 
 | ||||
| Licensed under the MIT License <http://opensource.org/licenses/MIT>.
 | ||||
|  |  | |||
|  | @ -1,7 +1,7 @@ | |||
| /*
 | ||||
|     __ _____ _____ _____ | ||||
|  __|  |   __|     |   | |  JSON for Modern C++ (test suite) | ||||
| |  |  |__   |  |  | | | |  version 2.1.1 | ||||
| |  |  |__   |  |  | | | |  version 3.0.1 | ||||
| |_____|_____|_____|_|___|  https://github.com/nlohmann/json
 | ||||
| 
 | ||||
| Licensed under the MIT License <http://opensource.org/licenses/MIT>.
 | ||||
|  |  | |||
|  | @ -1,7 +1,7 @@ | |||
| /*
 | ||||
|     __ _____ _____ _____ | ||||
|  __|  |   __|     |   | |  JSON for Modern C++ (test suite) | ||||
| |  |  |__   |  |  | | | |  version 2.1.1 | ||||
| |  |  |__   |  |  | | | |  version 3.0.1 | ||||
| |_____|_____|_____|_|___|  https://github.com/nlohmann/json
 | ||||
| 
 | ||||
| Licensed under the MIT License <http://opensource.org/licenses/MIT>.
 | ||||
|  |  | |||
|  | @ -1,7 +1,7 @@ | |||
| /*
 | ||||
|     __ _____ _____ _____ | ||||
|  __|  |   __|     |   | |  JSON for Modern C++ (test suite) | ||||
| |  |  |__   |  |  | | | |  version 2.1.1 | ||||
| |  |  |__   |  |  | | | |  version 3.0.1 | ||||
| |_____|_____|_____|_|___|  https://github.com/nlohmann/json
 | ||||
| 
 | ||||
| Licensed under the MIT License <http://opensource.org/licenses/MIT>.
 | ||||
|  |  | |||
|  | @ -1,7 +1,7 @@ | |||
| /*
 | ||||
|     __ _____ _____ _____ | ||||
|  __|  |   __|     |   | |  JSON for Modern C++ (test suite) | ||||
| |  |  |__   |  |  | | | |  version 2.1.1 | ||||
| |  |  |__   |  |  | | | |  version 3.0.1 | ||||
| |_____|_____|_____|_|___|  https://github.com/nlohmann/json
 | ||||
| 
 | ||||
| Licensed under the MIT License <http://opensource.org/licenses/MIT>.
 | ||||
|  | @ -727,3 +727,700 @@ TEST_CASE("iterator_wrapper") | |||
|         } | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| TEST_CASE("items()") | ||||
| { | ||||
|     SECTION("object") | ||||
|     { | ||||
|         SECTION("value") | ||||
|         { | ||||
|             json j = {{"A", 1}, {"B", 2}}; | ||||
|             int counter = 1; | ||||
| 
 | ||||
|             for (auto i : j.items()) | ||||
|             { | ||||
|                 switch (counter++) | ||||
|                 { | ||||
|                     case 1: | ||||
|                     { | ||||
|                         CHECK(i.key() == "A"); | ||||
|                         CHECK(i.value() == json(1)); | ||||
|                         break; | ||||
|                     } | ||||
| 
 | ||||
|                     case 2: | ||||
|                     { | ||||
|                         CHECK(i.key() == "B"); | ||||
|                         CHECK(i.value() == json(2)); | ||||
|                         break; | ||||
|                     } | ||||
| 
 | ||||
|                     default: | ||||
|                     { | ||||
|                         break; | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
| 
 | ||||
|             CHECK(counter == 3); | ||||
|         } | ||||
| 
 | ||||
|         SECTION("reference") | ||||
|         { | ||||
|             json j = {{"A", 1}, {"B", 2}}; | ||||
|             int counter = 1; | ||||
| 
 | ||||
|             for (auto& i : j.items()) | ||||
|             { | ||||
|                 switch (counter++) | ||||
|                 { | ||||
|                     case 1: | ||||
|                     { | ||||
|                         CHECK(i.key() == "A"); | ||||
|                         CHECK(i.value() == json(1)); | ||||
| 
 | ||||
|                         // change the value
 | ||||
|                         i.value() = json(11); | ||||
|                         CHECK(i.value() == json(11)); | ||||
|                         break; | ||||
|                     } | ||||
| 
 | ||||
|                     case 2: | ||||
|                     { | ||||
|                         CHECK(i.key() == "B"); | ||||
|                         CHECK(i.value() == json(2)); | ||||
| 
 | ||||
|                         // change the value
 | ||||
|                         i.value() = json(22); | ||||
|                         CHECK(i.value() == json(22)); | ||||
|                         break; | ||||
|                     } | ||||
| 
 | ||||
|                     default: | ||||
|                     { | ||||
|                         break; | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
| 
 | ||||
|             CHECK(counter == 3); | ||||
| 
 | ||||
|             // check if values where changed
 | ||||
|             CHECK(j == json({{"A", 11}, {"B", 22}})); | ||||
|         } | ||||
| 
 | ||||
|         SECTION("const value") | ||||
|         { | ||||
|             json j = {{"A", 1}, {"B", 2}}; | ||||
|             int counter = 1; | ||||
| 
 | ||||
|             for (const auto i : j.items()) | ||||
|             { | ||||
|                 switch (counter++) | ||||
|                 { | ||||
|                     case 1: | ||||
|                     { | ||||
|                         CHECK(i.key() == "A"); | ||||
|                         CHECK(i.value() == json(1)); | ||||
|                         break; | ||||
|                     } | ||||
| 
 | ||||
|                     case 2: | ||||
|                     { | ||||
|                         CHECK(i.key() == "B"); | ||||
|                         CHECK(i.value() == json(2)); | ||||
|                         break; | ||||
|                     } | ||||
| 
 | ||||
|                     default: | ||||
|                     { | ||||
|                         break; | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
| 
 | ||||
|             CHECK(counter == 3); | ||||
|         } | ||||
| 
 | ||||
|         SECTION("const reference") | ||||
|         { | ||||
|             json j = {{"A", 1}, {"B", 2}}; | ||||
|             int counter = 1; | ||||
| 
 | ||||
|             for (const auto& i : j.items()) | ||||
|             { | ||||
|                 switch (counter++) | ||||
|                 { | ||||
|                     case 1: | ||||
|                     { | ||||
|                         CHECK(i.key() == "A"); | ||||
|                         CHECK(i.value() == json(1)); | ||||
|                         break; | ||||
|                     } | ||||
| 
 | ||||
|                     case 2: | ||||
|                     { | ||||
|                         CHECK(i.key() == "B"); | ||||
|                         CHECK(i.value() == json(2)); | ||||
|                         break; | ||||
|                     } | ||||
| 
 | ||||
|                     default: | ||||
|                     { | ||||
|                         break; | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
| 
 | ||||
|             CHECK(counter == 3); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     SECTION("const object") | ||||
|     { | ||||
|         SECTION("value") | ||||
|         { | ||||
|             const json j = {{"A", 1}, {"B", 2}}; | ||||
|             int counter = 1; | ||||
| 
 | ||||
|             for (auto i : j.items()) | ||||
|             { | ||||
|                 switch (counter++) | ||||
|                 { | ||||
|                     case 1: | ||||
|                     { | ||||
|                         CHECK(i.key() == "A"); | ||||
|                         CHECK(i.value() == json(1)); | ||||
|                         break; | ||||
|                     } | ||||
| 
 | ||||
|                     case 2: | ||||
|                     { | ||||
|                         CHECK(i.key() == "B"); | ||||
|                         CHECK(i.value() == json(2)); | ||||
|                         break; | ||||
|                     } | ||||
| 
 | ||||
|                     default: | ||||
|                     { | ||||
|                         break; | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
| 
 | ||||
|             CHECK(counter == 3); | ||||
|         } | ||||
| 
 | ||||
|         SECTION("reference") | ||||
|         { | ||||
|             const json j = {{"A", 1}, {"B", 2}}; | ||||
|             int counter = 1; | ||||
| 
 | ||||
|             for (auto& i : j.items()) | ||||
|             { | ||||
|                 switch (counter++) | ||||
|                 { | ||||
|                     case 1: | ||||
|                     { | ||||
|                         CHECK(i.key() == "A"); | ||||
|                         CHECK(i.value() == json(1)); | ||||
|                         break; | ||||
|                     } | ||||
| 
 | ||||
|                     case 2: | ||||
|                     { | ||||
|                         CHECK(i.key() == "B"); | ||||
|                         CHECK(i.value() == json(2)); | ||||
|                         break; | ||||
|                     } | ||||
| 
 | ||||
|                     default: | ||||
|                     { | ||||
|                         break; | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
| 
 | ||||
|             CHECK(counter == 3); | ||||
|         } | ||||
| 
 | ||||
|         SECTION("const value") | ||||
|         { | ||||
|             const json j = {{"A", 1}, {"B", 2}}; | ||||
|             int counter = 1; | ||||
| 
 | ||||
|             for (const auto i : j.items()) | ||||
|             { | ||||
|                 switch (counter++) | ||||
|                 { | ||||
|                     case 1: | ||||
|                     { | ||||
|                         CHECK(i.key() == "A"); | ||||
|                         CHECK(i.value() == json(1)); | ||||
|                         break; | ||||
|                     } | ||||
| 
 | ||||
|                     case 2: | ||||
|                     { | ||||
|                         CHECK(i.key() == "B"); | ||||
|                         CHECK(i.value() == json(2)); | ||||
|                         break; | ||||
|                     } | ||||
| 
 | ||||
|                     default: | ||||
|                     { | ||||
|                         break; | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
| 
 | ||||
|             CHECK(counter == 3); | ||||
|         } | ||||
| 
 | ||||
|         SECTION("const reference") | ||||
|         { | ||||
|             const json j = {{"A", 1}, {"B", 2}}; | ||||
|             int counter = 1; | ||||
| 
 | ||||
|             for (const auto& i : j.items()) | ||||
|             { | ||||
|                 switch (counter++) | ||||
|                 { | ||||
|                     case 1: | ||||
|                     { | ||||
|                         CHECK(i.key() == "A"); | ||||
|                         CHECK(i.value() == json(1)); | ||||
|                         break; | ||||
|                     } | ||||
| 
 | ||||
|                     case 2: | ||||
|                     { | ||||
|                         CHECK(i.key() == "B"); | ||||
|                         CHECK(i.value() == json(2)); | ||||
|                         break; | ||||
|                     } | ||||
| 
 | ||||
|                     default: | ||||
|                     { | ||||
|                         break; | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
| 
 | ||||
|             CHECK(counter == 3); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     SECTION("array") | ||||
|     { | ||||
|         SECTION("value") | ||||
|         { | ||||
|             json j = {"A", "B"}; | ||||
|             int counter = 1; | ||||
| 
 | ||||
|             for (auto i : j.items()) | ||||
|             { | ||||
|                 switch (counter++) | ||||
|                 { | ||||
|                     case 1: | ||||
|                     { | ||||
|                         CHECK(i.key() == "0"); | ||||
|                         CHECK(i.value() == "A"); | ||||
|                         break; | ||||
|                     } | ||||
| 
 | ||||
|                     case 2: | ||||
|                     { | ||||
|                         CHECK(i.key() == "1"); | ||||
|                         CHECK(i.value() == "B"); | ||||
|                         break; | ||||
|                     } | ||||
| 
 | ||||
|                     default: | ||||
|                     { | ||||
|                         break; | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
| 
 | ||||
|             CHECK(counter == 3); | ||||
|         } | ||||
| 
 | ||||
|         SECTION("reference") | ||||
|         { | ||||
|             json j = {"A", "B"}; | ||||
|             int counter = 1; | ||||
| 
 | ||||
|             for (auto& i : j.items()) | ||||
|             { | ||||
|                 switch (counter++) | ||||
|                 { | ||||
|                     case 1: | ||||
|                     { | ||||
|                         CHECK(i.key() == "0"); | ||||
|                         CHECK(i.value() == "A"); | ||||
| 
 | ||||
|                         // change the value
 | ||||
|                         i.value() = "AA"; | ||||
|                         CHECK(i.value() == "AA"); | ||||
|                         break; | ||||
|                     } | ||||
| 
 | ||||
|                     case 2: | ||||
|                     { | ||||
|                         CHECK(i.key() == "1"); | ||||
|                         CHECK(i.value() == "B"); | ||||
| 
 | ||||
|                         // change the value
 | ||||
|                         i.value() = "BB"; | ||||
|                         CHECK(i.value() == "BB"); | ||||
|                         break; | ||||
|                     } | ||||
| 
 | ||||
|                     default: | ||||
|                     { | ||||
|                         break; | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
| 
 | ||||
|             CHECK(counter == 3); | ||||
| 
 | ||||
|             // check if values where changed
 | ||||
|             CHECK(j == json({"AA", "BB"})); | ||||
|         } | ||||
| 
 | ||||
|         SECTION("const value") | ||||
|         { | ||||
|             json j = {"A", "B"}; | ||||
|             int counter = 1; | ||||
| 
 | ||||
|             for (const auto i : j.items()) | ||||
|             { | ||||
|                 switch (counter++) | ||||
|                 { | ||||
|                     case 1: | ||||
|                     { | ||||
|                         CHECK(i.key() == "0"); | ||||
|                         CHECK(i.value() == "A"); | ||||
|                         break; | ||||
|                     } | ||||
| 
 | ||||
|                     case 2: | ||||
|                     { | ||||
|                         CHECK(i.key() == "1"); | ||||
|                         CHECK(i.value() == "B"); | ||||
|                         break; | ||||
|                     } | ||||
| 
 | ||||
|                     default: | ||||
|                     { | ||||
|                         break; | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
| 
 | ||||
|             CHECK(counter == 3); | ||||
|         } | ||||
| 
 | ||||
|         SECTION("const reference") | ||||
|         { | ||||
|             json j = {"A", "B"}; | ||||
|             int counter = 1; | ||||
| 
 | ||||
|             for (const auto& i : j.items()) | ||||
|             { | ||||
|                 switch (counter++) | ||||
|                 { | ||||
|                     case 1: | ||||
|                     { | ||||
|                         CHECK(i.key() == "0"); | ||||
|                         CHECK(i.value() == "A"); | ||||
|                         break; | ||||
|                     } | ||||
| 
 | ||||
|                     case 2: | ||||
|                     { | ||||
|                         CHECK(i.key() == "1"); | ||||
|                         CHECK(i.value() == "B"); | ||||
|                         break; | ||||
|                     } | ||||
| 
 | ||||
|                     default: | ||||
|                     { | ||||
|                         break; | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
| 
 | ||||
|             CHECK(counter == 3); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     SECTION("const array") | ||||
|     { | ||||
|         SECTION("value") | ||||
|         { | ||||
|             const json j = {"A", "B"}; | ||||
|             int counter = 1; | ||||
| 
 | ||||
|             for (auto i : j.items()) | ||||
|             { | ||||
|                 switch (counter++) | ||||
|                 { | ||||
|                     case 1: | ||||
|                     { | ||||
|                         CHECK(i.key() == "0"); | ||||
|                         CHECK(i.value() == "A"); | ||||
|                         break; | ||||
|                     } | ||||
| 
 | ||||
|                     case 2: | ||||
|                     { | ||||
|                         CHECK(i.key() == "1"); | ||||
|                         CHECK(i.value() == "B"); | ||||
|                         break; | ||||
|                     } | ||||
| 
 | ||||
|                     default: | ||||
|                     { | ||||
|                         break; | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
| 
 | ||||
|             CHECK(counter == 3); | ||||
|         } | ||||
| 
 | ||||
|         SECTION("reference") | ||||
|         { | ||||
|             const json j = {"A", "B"}; | ||||
|             int counter = 1; | ||||
| 
 | ||||
|             for (auto& i : j.items()) | ||||
|             { | ||||
|                 switch (counter++) | ||||
|                 { | ||||
|                     case 1: | ||||
|                     { | ||||
|                         CHECK(i.key() == "0"); | ||||
|                         CHECK(i.value() == "A"); | ||||
|                         break; | ||||
|                     } | ||||
| 
 | ||||
|                     case 2: | ||||
|                     { | ||||
|                         CHECK(i.key() == "1"); | ||||
|                         CHECK(i.value() == "B"); | ||||
|                         break; | ||||
|                     } | ||||
| 
 | ||||
|                     default: | ||||
|                     { | ||||
|                         break; | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
| 
 | ||||
|             CHECK(counter == 3); | ||||
|         } | ||||
| 
 | ||||
|         SECTION("const value") | ||||
|         { | ||||
|             const json j = {"A", "B"}; | ||||
|             int counter = 1; | ||||
| 
 | ||||
|             for (const auto i : j.items()) | ||||
|             { | ||||
|                 switch (counter++) | ||||
|                 { | ||||
|                     case 1: | ||||
|                     { | ||||
|                         CHECK(i.key() == "0"); | ||||
|                         CHECK(i.value() == "A"); | ||||
|                         break; | ||||
|                     } | ||||
| 
 | ||||
|                     case 2: | ||||
|                     { | ||||
|                         CHECK(i.key() == "1"); | ||||
|                         CHECK(i.value() == "B"); | ||||
|                         break; | ||||
|                     } | ||||
| 
 | ||||
|                     default: | ||||
|                     { | ||||
|                         break; | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
| 
 | ||||
|             CHECK(counter == 3); | ||||
|         } | ||||
| 
 | ||||
|         SECTION("const reference") | ||||
|         { | ||||
|             const json j = {"A", "B"}; | ||||
|             int counter = 1; | ||||
| 
 | ||||
|             for (const auto& i : j.items()) | ||||
|             { | ||||
|                 switch (counter++) | ||||
|                 { | ||||
|                     case 1: | ||||
|                     { | ||||
|                         CHECK(i.key() == "0"); | ||||
|                         CHECK(i.value() == "A"); | ||||
|                         break; | ||||
|                     } | ||||
| 
 | ||||
|                     case 2: | ||||
|                     { | ||||
|                         CHECK(i.key() == "1"); | ||||
|                         CHECK(i.value() == "B"); | ||||
|                         break; | ||||
|                     } | ||||
| 
 | ||||
|                     default: | ||||
|                     { | ||||
|                         break; | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
| 
 | ||||
|             CHECK(counter == 3); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     SECTION("primitive") | ||||
|     { | ||||
|         SECTION("value") | ||||
|         { | ||||
|             json j = 1; | ||||
|             int counter = 1; | ||||
| 
 | ||||
|             for (auto i : j.items()) | ||||
|             { | ||||
|                 ++counter; | ||||
|                 CHECK(i.key() == ""); | ||||
|                 CHECK(i.value() == json(1)); | ||||
|             } | ||||
| 
 | ||||
|             CHECK(counter == 2); | ||||
|         } | ||||
| 
 | ||||
|         SECTION("reference") | ||||
|         { | ||||
|             json j = 1; | ||||
|             int counter = 1; | ||||
| 
 | ||||
|             for (auto& i : j.items()) | ||||
|             { | ||||
|                 ++counter; | ||||
|                 CHECK(i.key() == ""); | ||||
|                 CHECK(i.value() == json(1)); | ||||
| 
 | ||||
|                 // change value
 | ||||
|                 i.value() = json(2); | ||||
|             } | ||||
| 
 | ||||
|             CHECK(counter == 2); | ||||
| 
 | ||||
|             // check if value has changed
 | ||||
|             CHECK(j == json(2)); | ||||
|         } | ||||
| 
 | ||||
|         SECTION("const value") | ||||
|         { | ||||
|             json j = 1; | ||||
|             int counter = 1; | ||||
| 
 | ||||
|             for (const auto i : j.items()) | ||||
|             { | ||||
|                 ++counter; | ||||
|                 CHECK(i.key() == ""); | ||||
|                 CHECK(i.value() == json(1)); | ||||
|             } | ||||
| 
 | ||||
|             CHECK(counter == 2); | ||||
|         } | ||||
| 
 | ||||
|         SECTION("const reference") | ||||
|         { | ||||
|             json j = 1; | ||||
|             int counter = 1; | ||||
| 
 | ||||
|             for (const auto& i : j.items()) | ||||
|             { | ||||
|                 ++counter; | ||||
|                 CHECK(i.key() == ""); | ||||
|                 CHECK(i.value() == json(1)); | ||||
|             } | ||||
| 
 | ||||
|             CHECK(counter == 2); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     SECTION("const primitive") | ||||
|     { | ||||
|         SECTION("value") | ||||
|         { | ||||
|             const json j = 1; | ||||
|             int counter = 1; | ||||
| 
 | ||||
|             for (auto i : j.items()) | ||||
|             { | ||||
|                 ++counter; | ||||
|                 CHECK(i.key() == ""); | ||||
|                 CHECK(i.value() == json(1)); | ||||
|             } | ||||
| 
 | ||||
|             CHECK(counter == 2); | ||||
|         } | ||||
| 
 | ||||
|         SECTION("reference") | ||||
|         { | ||||
|             const json j = 1; | ||||
|             int counter = 1; | ||||
| 
 | ||||
|             for (auto& i : j.items()) | ||||
|             { | ||||
|                 ++counter; | ||||
|                 CHECK(i.key() == ""); | ||||
|                 CHECK(i.value() == json(1)); | ||||
|             } | ||||
| 
 | ||||
|             CHECK(counter == 2); | ||||
|         } | ||||
| 
 | ||||
|         SECTION("const value") | ||||
|         { | ||||
|             const json j = 1; | ||||
|             int counter = 1; | ||||
| 
 | ||||
|             for (const auto i : j.items()) | ||||
|             { | ||||
|                 ++counter; | ||||
|                 CHECK(i.key() == ""); | ||||
|                 CHECK(i.value() == json(1)); | ||||
|             } | ||||
| 
 | ||||
|             CHECK(counter == 2); | ||||
|         } | ||||
| 
 | ||||
|         SECTION("const reference") | ||||
|         { | ||||
|             const json j = 1; | ||||
|             int counter = 1; | ||||
| 
 | ||||
|             for (const auto& i : j.items()) | ||||
|             { | ||||
|                 ++counter; | ||||
|                 CHECK(i.key() == ""); | ||||
|                 CHECK(i.value() == json(1)); | ||||
|             } | ||||
| 
 | ||||
|             CHECK(counter == 2); | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  |  | |||
|  | @ -1,7 +1,7 @@ | |||
| /*
 | ||||
|     __ _____ _____ _____ | ||||
|  __|  |   __|     |   | |  JSON for Modern C++ (test suite) | ||||
| |  |  |__   |  |  | | | |  version 2.1.1 | ||||
| |  |  |__   |  |  | | | |  version 3.0.1 | ||||
| |_____|_____|_____|_|___|  https://github.com/nlohmann/json
 | ||||
| 
 | ||||
| Licensed under the MIT License <http://opensource.org/licenses/MIT>.
 | ||||
|  |  | |||
|  | @ -1,7 +1,7 @@ | |||
| /*
 | ||||
|     __ _____ _____ _____ | ||||
|  __|  |   __|     |   | |  JSON for Modern C++ (test suite) | ||||
| |  |  |__   |  |  | | | |  version 2.1.1 | ||||
| |  |  |__   |  |  | | | |  version 3.0.1 | ||||
| |_____|_____|_____|_|___|  https://github.com/nlohmann/json
 | ||||
| 
 | ||||
| Licensed under the MIT License <http://opensource.org/licenses/MIT>.
 | ||||
|  |  | |||
|  | @ -1,7 +1,7 @@ | |||
| /*
 | ||||
|     __ _____ _____ _____ | ||||
|  __|  |   __|     |   | |  JSON for Modern C++ (test suite) | ||||
| |  |  |__   |  |  | | | |  version 2.1.1 | ||||
| |  |  |__   |  |  | | | |  version 3.0.1 | ||||
| |_____|_____|_____|_|___|  https://github.com/nlohmann/json
 | ||||
| 
 | ||||
| Licensed under the MIT License <http://opensource.org/licenses/MIT>.
 | ||||
|  | @ -31,6 +31,8 @@ SOFTWARE. | |||
| #include "json.hpp" | ||||
| using nlohmann::json; | ||||
| 
 | ||||
| #include <fstream> | ||||
| 
 | ||||
| TEST_CASE("JSON patch") | ||||
| { | ||||
|     SECTION("examples from RFC 6902") | ||||
|  | @ -1250,4 +1252,42 @@ TEST_CASE("JSON patch") | |||
|                               R"( [{"op": "test", "path": "/foo", "value": "bar"}] )"_json)); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     SECTION("Tests from github.com/json-patch/json-patch-tests") | ||||
|     { | ||||
|         for (auto filename : | ||||
|                 {"test/data/json-patch-tests/spec_tests.json", | ||||
|                  "test/data/json-patch-tests/tests.json" | ||||
|                 }) | ||||
|         { | ||||
|             CAPTURE(filename); | ||||
|             std::ifstream f(filename); | ||||
|             json suite = json::parse(f); | ||||
| 
 | ||||
|             for (const auto& test : suite) | ||||
|             { | ||||
|                 CAPTURE(test.value("comment", "")) | ||||
| 
 | ||||
|                 // skip tests marked as disabled
 | ||||
|                 if (test.value("disabled", false)) | ||||
|                 { | ||||
|                     continue; | ||||
|                 } | ||||
| 
 | ||||
|                 const auto& doc = test["doc"]; | ||||
|                 const auto& patch = test["patch"]; | ||||
| 
 | ||||
|                 if (test.count("error") == 0) | ||||
|                 { | ||||
|                     // if an expected value is given, use it; use doc otherwise
 | ||||
|                     const auto& expected = test.value("expected", doc); | ||||
|                     CHECK(doc.patch(patch) == expected); | ||||
|                 } | ||||
|                 else | ||||
|                 { | ||||
|                     CHECK_THROWS(doc.patch(patch)); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  |  | |||
|  | @ -1,7 +1,7 @@ | |||
| /*
 | ||||
|     __ _____ _____ _____ | ||||
|  __|  |   __|     |   | |  JSON for Modern C++ (test suite) | ||||
| |  |  |__   |  |  | | | |  version 2.1.1 | ||||
| |  |  |__   |  |  | | | |  version 3.0.1 | ||||
| |_____|_____|_____|_|___|  https://github.com/nlohmann/json
 | ||||
| 
 | ||||
| Licensed under the MIT License <http://opensource.org/licenses/MIT>.
 | ||||
|  | @ -55,6 +55,15 @@ TEST_CASE("JSON pointers") | |||
|         CHECK_THROWS_AS(p.pop_back(), json::out_of_range&); | ||||
|         CHECK_THROWS_WITH(p.pop_back(), | ||||
|                           "[json.exception.out_of_range.405] JSON pointer has no parent"); | ||||
| 
 | ||||
|         SECTION("array index error") | ||||
|         { | ||||
|             json v = {1, 2, 3, 4}; | ||||
|             json::json_pointer ptr("/10e"); | ||||
|             CHECK_THROWS_AS(v[ptr], json::out_of_range); | ||||
|             CHECK_THROWS_WITH(v[ptr], | ||||
|                               "[json.exception.out_of_range.404] unresolved reference token '10e'"); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     SECTION("examples from RFC 6901") | ||||
|  |  | |||
|  | @ -1,7 +1,7 @@ | |||
| /*
 | ||||
|     __ _____ _____ _____ | ||||
|  __|  |   __|     |   | |  JSON for Modern C++ (test suite) | ||||
| |  |  |__   |  |  | | | |  version 2.1.1 | ||||
| |  |  |__   |  |  | | | |  version 3.0.1 | ||||
| |_____|_____|_____|_|___|  https://github.com/nlohmann/json
 | ||||
| 
 | ||||
| Licensed under the MIT License <http://opensource.org/licenses/MIT>.
 | ||||
|  | @ -42,9 +42,9 @@ TEST_CASE("version information") | |||
|         CHECK(j["url"] == "https://github.com/nlohmann/json"); | ||||
|         CHECK(j["version"] == json( | ||||
|         { | ||||
|             {"string", "2.1.1"}, | ||||
|             {"major", 2}, | ||||
|             {"minor", 1}, | ||||
|             {"string", "3.0.1"}, | ||||
|             {"major", 3}, | ||||
|             {"minor", 0}, | ||||
|             {"patch", 1} | ||||
|         })); | ||||
| 
 | ||||
|  |  | |||
|  | @ -1,7 +1,7 @@ | |||
| /*
 | ||||
|     __ _____ _____ _____ | ||||
|  __|  |   __|     |   | |  JSON for Modern C++ (test suite) | ||||
| |  |  |__   |  |  | | | |  version 2.1.1 | ||||
| |  |  |__   |  |  | | | |  version 3.0.1 | ||||
| |_____|_____|_____|_|___|  https://github.com/nlohmann/json
 | ||||
| 
 | ||||
| Licensed under the MIT License <http://opensource.org/licenses/MIT>.
 | ||||
|  |  | |||
|  | @ -1,7 +1,7 @@ | |||
| /*
 | ||||
|     __ _____ _____ _____ | ||||
|  __|  |   __|     |   | |  JSON for Modern C++ (test suite) | ||||
| |  |  |__   |  |  | | | |  version 2.1.1 | ||||
| |  |  |__   |  |  | | | |  version 3.0.1 | ||||
| |_____|_____|_____|_|___|  https://github.com/nlohmann/json
 | ||||
| 
 | ||||
| Licensed under the MIT License <http://opensource.org/licenses/MIT>.
 | ||||
|  |  | |||
|  | @ -1,7 +1,7 @@ | |||
| /*
 | ||||
|     __ _____ _____ _____ | ||||
|  __|  |   __|     |   | |  JSON for Modern C++ (test suite) | ||||
| |  |  |__   |  |  | | | |  version 2.1.1 | ||||
| |  |  |__   |  |  | | | |  version 3.0.1 | ||||
| |_____|_____|_____|_|___|  https://github.com/nlohmann/json
 | ||||
| 
 | ||||
| Licensed under the MIT License <http://opensource.org/licenses/MIT>.
 | ||||
|  |  | |||
|  | @ -1,7 +1,7 @@ | |||
| /*
 | ||||
|     __ _____ _____ _____ | ||||
|  __|  |   __|     |   | |  JSON for Modern C++ (test suite) | ||||
| |  |  |__   |  |  | | | |  version 2.1.1 | ||||
| |  |  |__   |  |  | | | |  version 3.0.1 | ||||
| |_____|_____|_____|_|___|  https://github.com/nlohmann/json
 | ||||
| 
 | ||||
| Licensed under the MIT License <http://opensource.org/licenses/MIT>.
 | ||||
|  |  | |||
|  | @ -1,7 +1,7 @@ | |||
| /*
 | ||||
|     __ _____ _____ _____ | ||||
|  __|  |   __|     |   | |  JSON for Modern C++ (test suite) | ||||
| |  |  |__   |  |  | | | |  version 2.1.1 | ||||
| |  |  |__   |  |  | | | |  version 3.0.1 | ||||
| |_____|_____|_____|_|___|  https://github.com/nlohmann/json
 | ||||
| 
 | ||||
| Licensed under the MIT License <http://opensource.org/licenses/MIT>.
 | ||||
|  |  | |||
|  | @ -1,7 +1,7 @@ | |||
| /*
 | ||||
|     __ _____ _____ _____ | ||||
|  __|  |   __|     |   | |  JSON for Modern C++ (test suite) | ||||
| |  |  |__   |  |  | | | |  version 2.1.1 | ||||
| |  |  |__   |  |  | | | |  version 3.0.1 | ||||
| |_____|_____|_____|_|___|  https://github.com/nlohmann/json
 | ||||
| 
 | ||||
| Licensed under the MIT License <http://opensource.org/licenses/MIT>.
 | ||||
|  |  | |||
|  | @ -1,7 +1,7 @@ | |||
| /*
 | ||||
|     __ _____ _____ _____ | ||||
|  __|  |   __|     |   | |  JSON for Modern C++ (test suite) | ||||
| |  |  |__   |  |  | | | |  version 2.1.1 | ||||
| |  |  |__   |  |  | | | |  version 3.0.1 | ||||
| |_____|_____|_____|_|___|  https://github.com/nlohmann/json
 | ||||
| 
 | ||||
| Licensed under the MIT License <http://opensource.org/licenses/MIT>.
 | ||||
|  | @ -1322,4 +1322,32 @@ TEST_CASE("regression tests") | |||
|         j = ar; | ||||
|         ar = j; | ||||
|     } | ||||
| 
 | ||||
|     SECTION("issue #894 - invalid RFC6902 copy operation succeeds") | ||||
|     { | ||||
|         auto model = R"({ | ||||
|             "one": { | ||||
|                 "two": { | ||||
|                     "three": "hello", | ||||
|                     "four": 42 | ||||
|                 } | ||||
|             } | ||||
|         })"_json; | ||||
| 
 | ||||
|         CHECK_THROWS_AS(model.patch(R"([{"op": "move", | ||||
|                          "from": "/one/two/three", | ||||
|                          "path": "/a/b/c"}])"_json), json::out_of_range); | ||||
|         CHECK_THROWS_WITH(model.patch(R"([{"op": "move", | ||||
|                          "from": "/one/two/three", | ||||
|                          "path": "/a/b/c"}])"_json), | ||||
|                           "[json.exception.out_of_range.403] key 'a' not found"); | ||||
| 
 | ||||
|         CHECK_THROWS_AS(model.patch(R"([{"op": "copy", | ||||
|                                  "from": "/one/two/three", | ||||
|                                  "path": "/a/b/c"}])"_json), json::out_of_range); | ||||
|         CHECK_THROWS_WITH(model.patch(R"([{"op": "copy", | ||||
|                                  "from": "/one/two/three", | ||||
|                                  "path": "/a/b/c"}])"_json), | ||||
|                           "[json.exception.out_of_range.403] key 'a' not found"); | ||||
|     } | ||||
| } | ||||
|  |  | |||
|  | @ -1,7 +1,7 @@ | |||
| /*
 | ||||
|     __ _____ _____ _____ | ||||
|  __|  |   __|     |   | |  JSON for Modern C++ (test suite) | ||||
| |  |  |__   |  |  | | | |  version 2.1.1 | ||||
| |  |  |__   |  |  | | | |  version 3.0.1 | ||||
| |_____|_____|_____|_|___|  https://github.com/nlohmann/json
 | ||||
| 
 | ||||
| Licensed under the MIT License <http://opensource.org/licenses/MIT>.
 | ||||
|  |  | |||
|  | @ -1,7 +1,7 @@ | |||
| /*
 | ||||
|     __ _____ _____ _____ | ||||
|  __|  |   __|     |   | |  JSON for Modern C++ (test suite) | ||||
| |  |  |__   |  |  | | | |  version 2.1.1 | ||||
| |  |  |__   |  |  | | | |  version 3.0.1 | ||||
| |_____|_____|_____|_|___|  https://github.com/nlohmann/json
 | ||||
| 
 | ||||
| Licensed under the MIT License <http://opensource.org/licenses/MIT>.
 | ||||
|  |  | |||
|  | @ -1,7 +1,7 @@ | |||
| /*
 | ||||
|     __ _____ _____ _____ | ||||
|  __|  |   __|     |   | |  JSON for Modern C++ (test suite) | ||||
| |  |  |__   |  |  | | | |  version 2.1.1 | ||||
| |  |  |__   |  |  | | | |  version 3.0.1 | ||||
| |_____|_____|_____|_|___|  https://github.com/nlohmann/json
 | ||||
| 
 | ||||
| Licensed under the MIT License <http://opensource.org/licenses/MIT>.
 | ||||
|  |  | |||
|  | @ -1,7 +1,7 @@ | |||
| /*
 | ||||
|     __ _____ _____ _____ | ||||
|  __|  |   __|     |   | |  JSON for Modern C++ (test suite) | ||||
| |  |  |__   |  |  | | | |  version 2.1.1 | ||||
| |  |  |__   |  |  | | | |  version 3.0.1 | ||||
| |_____|_____|_____|_|___|  https://github.com/nlohmann/json
 | ||||
| 
 | ||||
| Licensed under the MIT License <http://opensource.org/licenses/MIT>.
 | ||||
|  | @ -1076,3 +1076,395 @@ TEST_CASE("Unicode", "[hide]") | |||
|         CHECK_THROWS_AS(json::parse("\xef\xbb\xbb"), json::parse_error&); | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| void roundtrip(bool success_expected, const std::string& s); | ||||
| 
 | ||||
| void roundtrip(bool success_expected, const std::string& s) | ||||
| { | ||||
|     CAPTURE(s); | ||||
| 
 | ||||
|     // create JSON string value
 | ||||
|     json j = s; | ||||
|     // create JSON text
 | ||||
|     std::string ps = std::string("\"") + s + "\""; | ||||
| 
 | ||||
|     if (success_expected) | ||||
|     { | ||||
|         // serialization succeeds
 | ||||
|         CHECK_NOTHROW(j.dump()); | ||||
| 
 | ||||
|         // exclude parse test for U+0000
 | ||||
|         if (s[0] != '\0') | ||||
|         { | ||||
|             // parsing JSON text succeeds
 | ||||
|             CHECK_NOTHROW(json::parse(ps)); | ||||
|         } | ||||
| 
 | ||||
|         // roundtrip succeeds
 | ||||
|         CHECK_NOTHROW(json::parse(j.dump())); | ||||
| 
 | ||||
|         // after roundtrip, the same string is stored
 | ||||
|         json jr = json::parse(j.dump()); | ||||
|         CHECK(jr.get<std::string>() == s); | ||||
|     } | ||||
|     else | ||||
|     { | ||||
|         // serialization fails
 | ||||
|         CHECK_THROWS_AS(j.dump(), json::type_error&); | ||||
| 
 | ||||
|         // parsing JSON text fails
 | ||||
|         CHECK_THROWS_AS(json::parse(ps), json::parse_error&); | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| TEST_CASE("Markus Kuhn's UTF-8 decoder capability and stress test") | ||||
| { | ||||
|     // Markus Kuhn <http://www.cl.cam.ac.uk/~mgk25/> - 2015-08-28 - CC BY 4.0
 | ||||
|     // http://www.cl.cam.ac.uk/~mgk25/ucs/examples/UTF-8-test.txt
 | ||||
| 
 | ||||
|     SECTION("1  Some correct UTF-8 text") | ||||
|     { | ||||
|         roundtrip(true, "κόσμε"); | ||||
|     } | ||||
| 
 | ||||
|     SECTION("2  Boundary condition test cases") | ||||
|     { | ||||
|         SECTION("2.1  First possible sequence of a certain length") | ||||
|         { | ||||
|             // 2.1.1  1 byte  (U-00000000)
 | ||||
|             roundtrip(true, std::string("\0", 1)); | ||||
|             // 2.1.2  2 bytes (U-00000080)
 | ||||
|             roundtrip(true, "\xc2\x80"); | ||||
|             // 2.1.3  3 bytes (U-00000800)
 | ||||
|             roundtrip(true, "\xe0\xa0\x80"); | ||||
|             // 2.1.4  4 bytes (U-00010000)
 | ||||
|             roundtrip(true, "\xf0\x90\x80\x80"); | ||||
| 
 | ||||
|             // 2.1.5  5 bytes (U-00200000)
 | ||||
|             roundtrip(false, "\xF8\x88\x80\x80\x80"); | ||||
|             // 2.1.6  6 bytes (U-04000000)
 | ||||
|             roundtrip(false, "\xFC\x84\x80\x80\x80\x80"); | ||||
|         } | ||||
| 
 | ||||
|         SECTION("2.2  Last possible sequence of a certain length") | ||||
|         { | ||||
|             // 2.2.1  1 byte  (U-0000007F)
 | ||||
|             roundtrip(true, "\x7f"); | ||||
|             // 2.2.2  2 bytes (U-000007FF)
 | ||||
|             roundtrip(true, "\xdf\xbf"); | ||||
|             // 2.2.3  3 bytes (U-0000FFFF)
 | ||||
|             roundtrip(true, "\xef\xbf\xbf"); | ||||
| 
 | ||||
|             // 2.2.4  4 bytes (U-001FFFFF)
 | ||||
|             roundtrip(false, "\xF7\xBF\xBF\xBF"); | ||||
|             // 2.2.5  5 bytes (U-03FFFFFF)
 | ||||
|             roundtrip(false, "\xFB\xBF\xBF\xBF\xBF"); | ||||
|             // 2.2.6  6 bytes (U-7FFFFFFF)
 | ||||
|             roundtrip(false, "\xFD\xBF\xBF\xBF\xBF\xBF"); | ||||
|         } | ||||
| 
 | ||||
|         SECTION("2.3  Other boundary conditions") | ||||
|         { | ||||
|             // 2.3.1  U-0000D7FF = ed 9f bf
 | ||||
|             roundtrip(true, "\xed\x9f\xbf"); | ||||
|             // 2.3.2  U-0000E000 = ee 80 80
 | ||||
|             roundtrip(true, "\xee\x80\x80"); | ||||
|             // 2.3.3  U-0000FFFD = ef bf bd
 | ||||
|             roundtrip(true, "\xef\xbf\xbd"); | ||||
|             // 2.3.4  U-0010FFFF = f4 8f bf bf
 | ||||
|             roundtrip(true, "\xf4\x8f\xbf\xbf"); | ||||
| 
 | ||||
|             // 2.3.5  U-00110000 = f4 90 80 80
 | ||||
|             roundtrip(false, "\xf4\x90\x80\x80"); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     SECTION("3  Malformed sequences") | ||||
|     { | ||||
|         SECTION("3.1  Unexpected continuation bytes") | ||||
|         { | ||||
|             // Each unexpected continuation byte should be separately signalled as a
 | ||||
|             // malformed sequence of its own.
 | ||||
| 
 | ||||
|             // 3.1.1  First continuation byte 0x80
 | ||||
|             roundtrip(false, "\x80"); | ||||
|             // 3.1.2  Last  continuation byte 0xbf
 | ||||
|             roundtrip(false, "\xbf"); | ||||
| 
 | ||||
|             // 3.1.3  2 continuation bytes
 | ||||
|             roundtrip(false, "\x80\xbf"); | ||||
|             // 3.1.4  3 continuation bytes
 | ||||
|             roundtrip(false, "\x80\xbf\x80"); | ||||
|             // 3.1.5  4 continuation bytes
 | ||||
|             roundtrip(false, "\x80\xbf\x80\xbf"); | ||||
|             // 3.1.6  5 continuation bytes
 | ||||
|             roundtrip(false, "\x80\xbf\x80\xbf\x80"); | ||||
|             // 3.1.7  6 continuation bytes
 | ||||
|             roundtrip(false, "\x80\xbf\x80\xbf\x80\xbf"); | ||||
|             // 3.1.8  7 continuation bytes
 | ||||
|             roundtrip(false, "\x80\xbf\x80\xbf\x80\xbf\x80"); | ||||
| 
 | ||||
|             // 3.1.9  Sequence of all 64 possible continuation bytes (0x80-0xbf)
 | ||||
|             roundtrip(false, "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf"); | ||||
|         } | ||||
| 
 | ||||
|         SECTION("3.2  Lonely start characters") | ||||
|         { | ||||
|             // 3.2.1  All 32 first bytes of 2-byte sequences (0xc0-0xdf)
 | ||||
|             roundtrip(false, "\xc0 \xc1 \xc2 \xc3 \xc4 \xc5 \xc6 \xc7 \xc8 \xc9 \xca \xcb \xcc \xcd \xce \xcf \xd0 \xd1 \xd2 \xd3 \xd4 \xd5 \xd6 \xd7 \xd8 \xd9 \xda \xdb \xdc \xdd \xde \xdf"); | ||||
|             // 3.2.2  All 16 first bytes of 3-byte sequences (0xe0-0xef)
 | ||||
|             roundtrip(false, "\xe0 \xe1 \xe2 \xe3 \xe4 \xe5 \xe6 \xe7 \xe8 \xe9 \xea \xeb \xec \xed \xee \xef"); | ||||
|             // 3.2.3  All 8 first bytes of 4-byte sequences (0xf0-0xf7)
 | ||||
|             roundtrip(false, "\xf0 \xf1 \xf2 \xf3 \xf4 \xf5 \xf6 \xf7"); | ||||
|             // 3.2.4  All 4 first bytes of 5-byte sequences (0xf8-0xfb)
 | ||||
|             roundtrip(false, "\xf8 \xf9 \xfa \xfb"); | ||||
|             // 3.2.5  All 2 first bytes of 6-byte sequences (0xfc-0xfd)
 | ||||
|             roundtrip(false, "\xfc \xfd"); | ||||
|         } | ||||
| 
 | ||||
|         SECTION("3.3  Sequences with last continuation byte missing") | ||||
|         { | ||||
|             // All bytes of an incomplete sequence should be signalled as a single
 | ||||
|             // malformed sequence, i.e., you should see only a single replacement
 | ||||
|             // character in each of the next 10 tests. (Characters as in section 2)
 | ||||
| 
 | ||||
|             // 3.3.1  2-byte sequence with last byte missing (U+0000)
 | ||||
|             roundtrip(false, "\xc0"); | ||||
|             // 3.3.2  3-byte sequence with last byte missing (U+0000)
 | ||||
|             roundtrip(false, "\xe0\x80"); | ||||
|             // 3.3.3  4-byte sequence with last byte missing (U+0000)
 | ||||
|             roundtrip(false, "\xf0\x80\x80"); | ||||
|             // 3.3.4  5-byte sequence with last byte missing (U+0000)
 | ||||
|             roundtrip(false, "\xf8\x80\x80\x80"); | ||||
|             // 3.3.5  6-byte sequence with last byte missing (U+0000)
 | ||||
|             roundtrip(false, "\xfc\x80\x80\x80\x80"); | ||||
|             // 3.3.6  2-byte sequence with last byte missing (U-000007FF)
 | ||||
|             roundtrip(false, "\xdf"); | ||||
|             // 3.3.7  3-byte sequence with last byte missing (U-0000FFFF)
 | ||||
|             roundtrip(false, "\xef\xbf"); | ||||
|             // 3.3.8  4-byte sequence with last byte missing (U-001FFFFF)
 | ||||
|             roundtrip(false, "\xf7\xbf\xbf"); | ||||
|             // 3.3.9  5-byte sequence with last byte missing (U-03FFFFFF)
 | ||||
|             roundtrip(false, "\xfb\xbf\xbf\xbf"); | ||||
|             // 3.3.10 6-byte sequence with last byte missing (U-7FFFFFFF)
 | ||||
|             roundtrip(false, "\xfd\xbf\xbf\xbf\xbf"); | ||||
|         } | ||||
| 
 | ||||
|         SECTION("3.4  Concatenation of incomplete sequences") | ||||
|         { | ||||
|             // All the 10 sequences of 3.3 concatenated, you should see 10 malformed
 | ||||
|             // sequences being signalled:
 | ||||
|             roundtrip(false, "\xc0\xe0\x80\xf0\x80\x80\xf8\x80\x80\x80\xfc\x80\x80\x80\x80\xdf\xef\xbf\xf7\xbf\xbf\xfb\xbf\xbf\xbf\xfd\xbf\xbf\xbf\xbf"); | ||||
|         } | ||||
| 
 | ||||
|         SECTION("3.5  Impossible bytes") | ||||
|         { | ||||
|             // The following two bytes cannot appear in a correct UTF-8 string
 | ||||
| 
 | ||||
|             // 3.5.1  fe
 | ||||
|             roundtrip(false, "\xfe"); | ||||
|             // 3.5.2  ff
 | ||||
|             roundtrip(false, "\xff"); | ||||
|             // 3.5.3  fe fe ff ff
 | ||||
|             roundtrip(false, "\xfe\xfe\xff\xff"); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     SECTION("4  Overlong sequences") | ||||
|     { | ||||
|         // The following sequences are not malformed according to the letter of
 | ||||
|         // the Unicode 2.0 standard. However, they are longer then necessary and
 | ||||
|         // a correct UTF-8 encoder is not allowed to produce them. A "safe UTF-8
 | ||||
|         // decoder" should reject them just like malformed sequences for two
 | ||||
|         // reasons: (1) It helps to debug applications if overlong sequences are
 | ||||
|         // not treated as valid representations of characters, because this helps
 | ||||
|         // to spot problems more quickly. (2) Overlong sequences provide
 | ||||
|         // alternative representations of characters, that could maliciously be
 | ||||
|         // used to bypass filters that check only for ASCII characters. For
 | ||||
|         // instance, a 2-byte encoded line feed (LF) would not be caught by a
 | ||||
|         // line counter that counts only 0x0a bytes, but it would still be
 | ||||
|         // processed as a line feed by an unsafe UTF-8 decoder later in the
 | ||||
|         // pipeline. From a security point of view, ASCII compatibility of UTF-8
 | ||||
|         // sequences means also, that ASCII characters are *only* allowed to be
 | ||||
|         // represented by ASCII bytes in the range 0x00-0x7f. To ensure this
 | ||||
|         // aspect of ASCII compatibility, use only "safe UTF-8 decoders" that
 | ||||
|         // reject overlong UTF-8 sequences for which a shorter encoding exists.
 | ||||
| 
 | ||||
|         SECTION("4.1  Examples of an overlong ASCII character") | ||||
|         { | ||||
|             // With a safe UTF-8 decoder, all of the following five overlong
 | ||||
|             // representations of the ASCII character slash ("/") should be rejected
 | ||||
|             // like a malformed UTF-8 sequence, for instance by substituting it with
 | ||||
|             // a replacement character. If you see a slash below, you do not have a
 | ||||
|             // safe UTF-8 decoder!
 | ||||
| 
 | ||||
|             // 4.1.1 U+002F = c0 af
 | ||||
|             roundtrip(false, "\xc0\xaf"); | ||||
|             // 4.1.2 U+002F = e0 80 af
 | ||||
|             roundtrip(false, "\xe0\x80\xaf"); | ||||
|             // 4.1.3 U+002F = f0 80 80 af
 | ||||
|             roundtrip(false, "\xf0\x80\x80\xaf"); | ||||
|             // 4.1.4 U+002F = f8 80 80 80 af
 | ||||
|             roundtrip(false, "\xf8\x80\x80\x80\xaf"); | ||||
|             // 4.1.5 U+002F = fc 80 80 80 80 af
 | ||||
|             roundtrip(false, "\xfc\x80\x80\x80\x80\xaf"); | ||||
|         } | ||||
| 
 | ||||
|         SECTION("4.2  Maximum overlong sequences") | ||||
|         { | ||||
|             // Below you see the highest Unicode value that is still resulting in an
 | ||||
|             // overlong sequence if represented with the given number of bytes. This
 | ||||
|             // is a boundary test for safe UTF-8 decoders. All five characters should
 | ||||
|             // be rejected like malformed UTF-8 sequences.
 | ||||
| 
 | ||||
|             // 4.2.1  U-0000007F = c1 bf
 | ||||
|             roundtrip(false, "\xc1\xbf"); | ||||
|             // 4.2.2  U-000007FF = e0 9f bf
 | ||||
|             roundtrip(false, "\xe0\x9f\xbf"); | ||||
|             // 4.2.3  U-0000FFFF = f0 8f bf bf
 | ||||
|             roundtrip(false, "\xf0\x8f\xbf\xbf"); | ||||
|             // 4.2.4  U-001FFFFF = f8 87 bf bf bf
 | ||||
|             roundtrip(false, "\xf8\x87\xbf\xbf\xbf"); | ||||
|             // 4.2.5  U-03FFFFFF = fc 83 bf bf bf bf
 | ||||
|             roundtrip(false, "\xfc\x83\xbf\xbf\xbf\xbf"); | ||||
|         } | ||||
| 
 | ||||
|         SECTION("4.3  Overlong representation of the NUL character") | ||||
|         { | ||||
|             // The following five sequences should also be rejected like malformed
 | ||||
|             // UTF-8 sequences and should not be treated like the ASCII NUL
 | ||||
|             // character.
 | ||||
| 
 | ||||
|             // 4.3.1  U+0000 = c0 80
 | ||||
|             roundtrip(false, "\xc0\x80"); | ||||
|             // 4.3.2  U+0000 = e0 80 80
 | ||||
|             roundtrip(false, "\xe0\x80\x80"); | ||||
|             // 4.3.3  U+0000 = f0 80 80 80
 | ||||
|             roundtrip(false, "\xf0\x80\x80\x80"); | ||||
|             // 4.3.4  U+0000 = f8 80 80 80 80
 | ||||
|             roundtrip(false, "\xf8\x80\x80\x80\x80"); | ||||
|             // 4.3.5  U+0000 = fc 80 80 80 80 80
 | ||||
|             roundtrip(false, "\xfc\x80\x80\x80\x80\x80"); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     SECTION("5  Illegal code positions") | ||||
|     { | ||||
|         // The following UTF-8 sequences should be rejected like malformed
 | ||||
|         // sequences, because they never represent valid ISO 10646 characters and
 | ||||
|         // a UTF-8 decoder that accepts them might introduce security problems
 | ||||
|         // comparable to overlong UTF-8 sequences.
 | ||||
| 
 | ||||
|         SECTION("5.1 Single UTF-16 surrogates") | ||||
|         { | ||||
|             // 5.1.1  U+D800 = ed a0 80
 | ||||
|             roundtrip(false, "\xed\xa0\x80"); | ||||
|             // 5.1.2  U+DB7F = ed ad bf
 | ||||
|             roundtrip(false, "\xed\xad\xbf"); | ||||
|             // 5.1.3  U+DB80 = ed ae 80
 | ||||
|             roundtrip(false, "\xed\xae\x80"); | ||||
|             // 5.1.4  U+DBFF = ed af bf
 | ||||
|             roundtrip(false, "\xed\xaf\xbf"); | ||||
|             // 5.1.5  U+DC00 = ed b0 80
 | ||||
|             roundtrip(false, "\xed\xb0\x80"); | ||||
|             // 5.1.6  U+DF80 = ed be 80
 | ||||
|             roundtrip(false, "\xed\xbe\x80"); | ||||
|             // 5.1.7  U+DFFF = ed bf bf
 | ||||
|             roundtrip(false, "\xed\xbf\xbf"); | ||||
|         } | ||||
| 
 | ||||
|         SECTION("5.2 Paired UTF-16 surrogates") | ||||
|         { | ||||
|             // 5.2.1  U+D800 U+DC00 = ed a0 80 ed b0 80
 | ||||
|             roundtrip(false, "\xed\xa0\x80\xed\xb0\x80"); | ||||
|             // 5.2.2  U+D800 U+DFFF = ed a0 80 ed bf bf
 | ||||
|             roundtrip(false, "\xed\xa0\x80\xed\xbf\xbf"); | ||||
|             // 5.2.3  U+DB7F U+DC00 = ed ad bf ed b0 80
 | ||||
|             roundtrip(false, "\xed\xad\xbf\xed\xb0\x80"); | ||||
|             // 5.2.4  U+DB7F U+DFFF = ed ad bf ed bf bf
 | ||||
|             roundtrip(false, "\xed\xad\xbf\xed\xbf\xbf"); | ||||
|             // 5.2.5  U+DB80 U+DC00 = ed ae 80 ed b0 80
 | ||||
|             roundtrip(false, "\xed\xae\x80\xed\xb0\x80"); | ||||
|             // 5.2.6  U+DB80 U+DFFF = ed ae 80 ed bf bf
 | ||||
|             roundtrip(false, "\xed\xae\x80\xed\xbf\xbf"); | ||||
|             // 5.2.7  U+DBFF U+DC00 = ed af bf ed b0 80
 | ||||
|             roundtrip(false, "\xed\xaf\xbf\xed\xb0\x80"); | ||||
|             // 5.2.8  U+DBFF U+DFFF = ed af bf ed bf bf
 | ||||
|             roundtrip(false, "\xed\xaf\xbf\xed\xbf\xbf"); | ||||
|         } | ||||
| 
 | ||||
|         SECTION("5.3 Noncharacter code positions") | ||||
|         { | ||||
|             // The following "noncharacters" are "reserved for internal use" by
 | ||||
|             // applications, and according to older versions of the Unicode Standard
 | ||||
|             // "should never be interchanged". Unicode Corrigendum #9 dropped the
 | ||||
|             // latter restriction. Nevertheless, their presence in incoming UTF-8 data
 | ||||
|             // can remain a potential security risk, depending on what use is made of
 | ||||
|             // these codes subsequently. Examples of such internal use:
 | ||||
|             //
 | ||||
|             //  - Some file APIs with 16-bit characters may use the integer value -1
 | ||||
|             //    = U+FFFF to signal an end-of-file (EOF) or error condition.
 | ||||
|             //
 | ||||
|             //  - In some UTF-16 receivers, code point U+FFFE might trigger a
 | ||||
|             //    byte-swap operation (to convert between UTF-16LE and UTF-16BE).
 | ||||
|             //
 | ||||
|             // With such internal use of noncharacters, it may be desirable and safer
 | ||||
|             // to block those code points in UTF-8 decoders, as they should never
 | ||||
|             // occur legitimately in incoming UTF-8 data, and could trigger unsafe
 | ||||
|             // behaviour in subsequent processing.
 | ||||
| 
 | ||||
|             // Particularly problematic noncharacters in 16-bit applications:
 | ||||
| 
 | ||||
|             // 5.3.1  U+FFFE = ef bf be
 | ||||
|             roundtrip(true, "\xef\xbf\xbe"); | ||||
|             // 5.3.2  U+FFFF = ef bf bf
 | ||||
|             roundtrip(true, "\xef\xbf\xbf"); | ||||
| 
 | ||||
|             // 5.3.3  U+FDD0 .. U+FDEF
 | ||||
|             roundtrip(true, "\xEF\xB7\x90"); | ||||
|             roundtrip(true, "\xEF\xB7\x91"); | ||||
|             roundtrip(true, "\xEF\xB7\x92"); | ||||
|             roundtrip(true, "\xEF\xB7\x93"); | ||||
|             roundtrip(true, "\xEF\xB7\x94"); | ||||
|             roundtrip(true, "\xEF\xB7\x95"); | ||||
|             roundtrip(true, "\xEF\xB7\x96"); | ||||
|             roundtrip(true, "\xEF\xB7\x97"); | ||||
|             roundtrip(true, "\xEF\xB7\x98"); | ||||
|             roundtrip(true, "\xEF\xB7\x99"); | ||||
|             roundtrip(true, "\xEF\xB7\x9A"); | ||||
|             roundtrip(true, "\xEF\xB7\x9B"); | ||||
|             roundtrip(true, "\xEF\xB7\x9C"); | ||||
|             roundtrip(true, "\xEF\xB7\x9D"); | ||||
|             roundtrip(true, "\xEF\xB7\x9E"); | ||||
|             roundtrip(true, "\xEF\xB7\x9F"); | ||||
|             roundtrip(true, "\xEF\xB7\xA0"); | ||||
|             roundtrip(true, "\xEF\xB7\xA1"); | ||||
|             roundtrip(true, "\xEF\xB7\xA2"); | ||||
|             roundtrip(true, "\xEF\xB7\xA3"); | ||||
|             roundtrip(true, "\xEF\xB7\xA4"); | ||||
|             roundtrip(true, "\xEF\xB7\xA5"); | ||||
|             roundtrip(true, "\xEF\xB7\xA6"); | ||||
|             roundtrip(true, "\xEF\xB7\xA7"); | ||||
|             roundtrip(true, "\xEF\xB7\xA8"); | ||||
|             roundtrip(true, "\xEF\xB7\xA9"); | ||||
|             roundtrip(true, "\xEF\xB7\xAA"); | ||||
|             roundtrip(true, "\xEF\xB7\xAB"); | ||||
|             roundtrip(true, "\xEF\xB7\xAC"); | ||||
|             roundtrip(true, "\xEF\xB7\xAD"); | ||||
|             roundtrip(true, "\xEF\xB7\xAE"); | ||||
|             roundtrip(true, "\xEF\xB7\xAF"); | ||||
| 
 | ||||
|             // 5.3.4  U+nFFFE U+nFFFF (for n = 1..10)
 | ||||
|             roundtrip(true, "\xF0\x9F\xBF\xBF"); | ||||
|             roundtrip(true, "\xF0\xAF\xBF\xBF"); | ||||
|             roundtrip(true, "\xF0\xBF\xBF\xBF"); | ||||
|             roundtrip(true, "\xF1\x8F\xBF\xBF"); | ||||
|             roundtrip(true, "\xF1\x9F\xBF\xBF"); | ||||
|             roundtrip(true, "\xF1\xAF\xBF\xBF"); | ||||
|             roundtrip(true, "\xF1\xBF\xBF\xBF"); | ||||
|             roundtrip(true, "\xF2\x8F\xBF\xBF"); | ||||
|             roundtrip(true, "\xF2\x9F\xBF\xBF"); | ||||
|             roundtrip(true, "\xF2\xAF\xBF\xBF"); | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  |  | |||
|  | @ -1,7 +1,7 @@ | |||
| /*
 | ||||
|     __ _____ _____ _____ | ||||
|  __|  |   __|     |   | |  JSON for Modern C++ (test suite) | ||||
| |  |  |__   |  |  | | | |  version 2.1.1 | ||||
| |  |  |__   |  |  | | | |  version 3.0.1 | ||||
| |_____|_____|_____|_|___|  https://github.com/nlohmann/json
 | ||||
| 
 | ||||
| Licensed under the MIT License <http://opensource.org/licenses/MIT>.
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue