Skip to content

Commit

Permalink
- test: simd test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
oknenavin committed Jul 6, 2024
1 parent dccb640 commit 3e76f57
Showing 1 changed file with 69 additions and 0 deletions.
69 changes: 69 additions & 0 deletions test/src/json/json.core-compound.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -650,6 +650,7 @@ namespace {
};
};
}

TEST_BEG(single_quotes, cxon::JSON<single_quotes_traits>, "/core")
// char[]
R_TEST("", "''");
Expand Down Expand Up @@ -1600,3 +1601,71 @@ TEST_BEG(cxcf_simple_keys_map, cxon::CXCF<>, "/core")
R_TEST(Struct20 {{{"\t", 1}}}, R"({a = {\t = 1}})");
W_TEST(R"({a={\t=1}})", Struct20 {{{"\t", 1}}});
TEST_END()

TEST_BEG(simd, cxon::JSON<>, "/core")
{ char b[2];
auto c = cxon::cnt::make_range_container(std::begin(b), std::end(b));
auto r = cxon::to_bytes<XXON>(c, "12'4567812345678");
TEST_CHECK(r.ec == json::write_error::output_failure);
}
{ char b[2];
auto c = cxon::cnt::make_range_container(std::begin(b), std::end(b));
auto r = cxon::to_bytes<XXON>(c, "12\"4567812345678");
TEST_CHECK(r.ec == json::write_error::output_failure);
}
{ char b[3];
auto c = cxon::cnt::make_range_container(std::begin(b), std::end(b));
auto r = cxon::to_bytes<XXON>(c, "12\"4567812345678");
TEST_CHECK(r.ec == json::write_error::output_failure);
}
{ char b[3];
auto c = cxon::cnt::make_range_container(std::begin(b), std::end(b));
auto r = cxon::to_bytes<XXON>(c, "12\"4567812345678");
TEST_CHECK(r.ec == json::write_error::output_failure);
}
{ char b[5];
auto c = cxon::cnt::make_range_container(std::begin(b), std::end(b));
auto r = cxon::to_bytes<XXON>(c, "12\"4567812345678");
TEST_CHECK(r.ec == json::write_error::output_failure);
}
TEST_END()

TEST_BEG(double_quotes_simd, cxon::JSON<>, "/core")
// char[]
W_TEST("\"1'34567812345678\"", "1'34567812345678");
W_TEST("\"1\\\"34567812345678\"", "1\"34567812345678");
// wchar_t[]
W_TEST("\"1'34567812345678\"", L"1'34567812345678");
W_TEST("\"1\\\"34567812345678\"", L"1\"34567812345678");
// char8_t[]
# if defined(__cpp_char8_t)
W_TEST("\"1'34567812345678\"", u8"1'34567812345678");
W_TEST("\"1\\\"34567812345678\"", u8"1\"34567812345678");
# endif
// char16_t[]
W_TEST("\"1'34567812345678\"", u"1'34567812345678");
W_TEST("\"1\\\"34567812345678\"", u"1\"34567812345678");
// char32_t[]
W_TEST("\"1'34567812345678\"", U"1'34567812345678");
W_TEST("\"1\\\"34567812345678\"", U"1\"34567812345678");
TEST_END()

TEST_BEG(single_quotes_simd, cxon::JSON<single_quotes_traits>, "/core")
// char[]
W_TEST("'1\\'34567812345678'", "1'34567812345678");
W_TEST("'1\"34567812345678'", "1\"34567812345678");
// wchar_t[]
W_TEST("'1\\'34567812345678'", L"1'34567812345678");
W_TEST("'1\"34567812345678'", L"1\"34567812345678");
// char8_t[]
# if defined(__cpp_char8_t)
W_TEST("'1\\'34567812345678'", u8"1'34567812345678");
W_TEST("'1\"34567812345678'", u8"1\"34567812345678");
# endif
// char16_t[]
W_TEST("'1\\'34567812345678'", u"1'34567812345678");
W_TEST("'1\"34567812345678'", u"1\"34567812345678");
// char32_t[]
W_TEST("'1\\'34567812345678'", U"1'34567812345678");
W_TEST("'1\"34567812345678'", U"1\"34567812345678");
TEST_END()

0 comments on commit 3e76f57

Please sign in to comment.