Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding tests for issue 2017 #2018

Merged
merged 1 commit into from
Jun 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 11 additions & 1 deletion tests/dom/basictests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,15 @@ namespace number_tests {
return true;
}

bool issue2017() {
TEST_START();
simdjson::dom::parser parser;
simdjson::padded_string docdata = R"({"score":0.8825149536132812})"_padded;
double score;
ASSERT_SUCCESS(parser.parse(docdata)["score"].get_double().get(score));
ASSERT_EQUAL(score, 0.8825149536132812);
TEST_SUCCEED();
}

bool small_integers() {
std::cout << __func__ << std::endl;
Expand Down Expand Up @@ -377,7 +386,8 @@ namespace number_tests {
}

bool run() {
return truncated_borderline() &&
return issue2017() &&
truncated_borderline() &&
specific_tests() &&
ground_truth() &&
small_integers() &&
Expand Down
17 changes: 16 additions & 1 deletion tests/ondemand/ondemand_number_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,8 @@ namespace number_tests {
TEST_SUCCEED();
}



bool get_root_number_tests() {
TEST_START();
ondemand::parser parser;
Expand Down Expand Up @@ -389,8 +391,21 @@ namespace number_tests {

TEST_SUCCEED();
}
bool issue2017() {
TEST_START();
ondemand::parser parser;
ondemand::document doc;
padded_string docdata = R"({"score":0.8825149536132812})"_padded;
ASSERT_SUCCESS(parser.iterate(docdata).get(doc));
double score;
ASSERT_SUCCESS(doc["score"].get_double().get(score));
ASSERT_EQUAL(score, 0.8825149536132812);
TEST_SUCCEED();
}

bool run() {
return issue_1898() &&
return issue2017() &&
issue_1898() &&
issue1878() &&
get_root_number_tests() &&
get_number_tests()&&
Expand Down