diff --git a/README.md b/README.md index af70c44d..1f85f81d 100644 --- a/README.md +++ b/README.md @@ -8,9 +8,9 @@ There are myriads of [JSON](http://json.org) libraries out there, and each may even have its reason to exist. Our class had these design goals: -- **Trivial integration**. Our whole code consists of just two files: A header file `JSON.h` and a source file `JSON.cc`. That's it. No library, no subproject, no dependencies. The class is written in vanilla C++11. All in all, the class should require no adjustment of your compiler flags or project settings. +- **Trivial integration**. Our whole code consists of a class in just two files: A header file `JSON.h` and a source file `JSON.cc`. That's it. No library, no subproject, no dependencies. The class is written in vanilla C++11. All in all, everything should require no adjustment of your compiler flags or project settings. -- **Intuitive syntax**. In languages such as Python, JSON feels like a first class data type. We used all the operator magic of C++ to achieve the same feeling in your code. Check out the [examples below](#examples) and you know, what I mean. +- **Intuitive syntax**. In languages such as Python, JSON feels like a first class data type. We used all the operator magic of modern C++ to achieve the same feeling in your code. Check out the [examples below](#examples) and the [reference](https://github.com/nlohmann/json/blob/master/Reference.md), and you know, what I mean. - **Serious testing**. Our library is heavily unit-tested and covers [100%](https://coveralls.io/r/nlohmann/json) of the code, including all exceptional behavior. Furthermore, we use [Valgrind](http://valgrind.org) to make sure no memory leaks exist. @@ -176,7 +176,7 @@ int vi = jn.get(); ## License - + The library is licensed under the [MIT License](http://opensource.org/licenses/MIT): diff --git a/src/JSON.cc b/src/JSON.cc index 95b2f0c6..c9b9fcdb 100644 --- a/src/JSON.cc +++ b/src/JSON.cc @@ -146,8 +146,6 @@ as is to create an array. @bug With the described approach, we would fail to recognize an array whose first element is again an arrays as array. - -@todo Create test case for described bug. */ JSON::JSON(list_init_t a) noexcept { @@ -598,7 +596,7 @@ JSON& JSON::operator+=(double f) } /*! -@todo comment me; test me +@todo comment me */ JSON& JSON::operator+=(const object_t::value_type& p) { @@ -606,7 +604,7 @@ JSON& JSON::operator+=(const object_t::value_type& p) } /*! -@todo comment me; test me +@todo comment me */ JSON& JSON::operator+=(list_init_t a) { @@ -731,7 +729,7 @@ void JSON::push_back(double f) } /*! -@todo comment me; test me +@todo comment me */ void JSON::push_back(const object_t::value_type& p) { @@ -739,7 +737,7 @@ void JSON::push_back(const object_t::value_type& p) } /*! -@todo comment me; test me +@todo comment me */ void JSON::push_back(list_init_t a) { @@ -1119,8 +1117,6 @@ Removes all elements from compounds and resets values to default. @invariant Clear will set any value type to its default value which is empty for compounds, false for booleans, 0 for integer numbers, and 0.0 for floating numbers. - -@todo Test me. */ void JSON::clear() noexcept { diff --git a/test/JSON_unit.cc b/test/JSON_unit.cc index 92ac0d51..aafa086a 100644 --- a/test/JSON_unit.cc +++ b/test/JSON_unit.cc @@ -281,6 +281,12 @@ TEST_CASE("array") } } + + // edge case: This should be an array with two elements which are in + // turn arrays with two strings. However, this is treated like the + // initializer list of an object. + JSON j_should_be_an_array = { {"foo", "bar"}, {"baz", "bat"} }; + CHECK(j_should_be_an_array.type() == JSON::value_type::object); } }