Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
bblanchon committed Jan 12, 2018
1 parent d8ede47 commit facac2a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 31 deletions.
19 changes: 2 additions & 17 deletions test/JsonArray/add.cpp
Expand Up @@ -78,29 +78,14 @@ TEST_CASE("JsonArray::add()") {
REQUIRE(str == _array[0]);
}

SECTION("should not duplicate string literals") {
_array.add("world");
const size_t expectedSize = JSON_ARRAY_SIZE(1);
REQUIRE(expectedSize == _jsonBuffer.size());
}

SECTION("should not duplicate const char*") {
const char* str = "world";
_array.add(str);
_array.add("world");
const size_t expectedSize = JSON_ARRAY_SIZE(1);
REQUIRE(expectedSize == _jsonBuffer.size());
}

SECTION("should duplicate char*") {
const char* str = "world";
_array.add(const_cast<char*>(str));
const size_t expectedSize = JSON_ARRAY_SIZE(1) + 6;
REQUIRE(expectedSize == _jsonBuffer.size());
}

SECTION("should duplicate char[]") {
char str[] = "world";
_array.add(str);
_array.add(const_cast<char*>("world"));
const size_t expectedSize = JSON_ARRAY_SIZE(1) + 6;
REQUIRE(expectedSize == _jsonBuffer.size());
}
Expand Down
15 changes: 1 addition & 14 deletions test/JsonArray/set.cpp
Expand Up @@ -78,14 +78,8 @@ TEST_CASE("JsonArray::set()") {
REQUIRE_THAT(_array[0].as<char*>(), Equals("hello"));
}

SECTION("should not duplicate string literals") {
_array.set(0, "world");
const size_t expectedSize = JSON_ARRAY_SIZE(1);
REQUIRE(expectedSize == _jsonBuffer.size());
}

SECTION("should not duplicate const char*") {
_array.set(0, static_cast<const char*>("world"));
_array.set(0, "world");
const size_t expectedSize = JSON_ARRAY_SIZE(1);
REQUIRE(expectedSize == _jsonBuffer.size());
}
Expand All @@ -96,13 +90,6 @@ TEST_CASE("JsonArray::set()") {
REQUIRE(expectedSize == _jsonBuffer.size());
}

SECTION("should duplicate char[]") {
char str[] = "world";
_array.set(0, str);
const size_t expectedSize = JSON_ARRAY_SIZE(1) + 6;
REQUIRE(expectedSize == _jsonBuffer.size());
}

SECTION("should duplicate std::string") {
_array.set(0, std::string("world"));
const size_t expectedSize = JSON_ARRAY_SIZE(1) + 6;
Expand Down

0 comments on commit facac2a

Please sign in to comment.