Fix root number parsing

This commit is contained in:
John Keiser 2020-09-26 11:40:35 -07:00
parent 2ba67c2bc2
commit 0bb83e06bc
10 changed files with 1692 additions and 7 deletions

View File

@ -49,5 +49,5 @@ jobs:
mkdir build32
cd build32
cmake -DSIMDJSON_BUILD_STATIC=ON -DSIMDJSON_COMPETITION=OFF -DSIMDJSON_GOOGLE_BENCHMARKS=OFF -DSIMDJSON_ENABLE_THREADS=OFF ..
cmake --build . --target parse_many_test jsoncheck basictests numberparsingcheck stringparsingcheck errortests integer_tests pointercheck --verbose
cmake --build . --target parse_many_test jsoncheck basictests ondemand_basictests numberparsingcheck stringparsingcheck errortests integer_tests pointercheck --verbose
ctest -R "(parse_many_test|jsoncheck|basictests|stringparsingcheck|numberparsingcheck|errortests|integer_tests|pointercheck)" --output-on-failure

View File

@ -49,11 +49,11 @@ jobs:
mkdir build64
cd build64
cmake -DSIMDJSON_BUILD_STATIC=ON -DSIMDJSON_COMPETITION=OFF -DSIMDJSON_GOOGLE_BENCHMARKS=OFF -DSIMDJSON_ENABLE_THREADS=OFF ..
cmake --build . --target parse_many_test jsoncheck basictests numberparsingcheck stringparsingcheck errortests integer_tests pointercheck --verbose
cmake --build . --target parse_many_test jsoncheck basictests ondemand_basictests numberparsingcheck stringparsingcheck errortests integer_tests pointercheck --verbose
ctest -R "(parse_many_test|jsoncheck|basictests|stringparsingcheck|numberparsingcheck|errortests|integer_tests|pointercheck)" --output-on-failure
cd ..
mkdir build64debug
cd build64debug
cmake -DCMAKE_BUILD_TYPE=Debug -DSIMDJSON_BUILD_STATIC=ON -DSIMDJSON_COMPETITION=OFF -DSIMDJSON_GOOGLE_BENCHMARKS=OFF -DSIMDJSON_ENABLE_THREADS=OFF ..
cmake --build . --target parse_many_test jsoncheck basictests numberparsingcheck stringparsingcheck errortests integer_tests pointercheck --verbose
cmake --build . --target parse_many_test jsoncheck basictests ondemand_basictests numberparsingcheck stringparsingcheck errortests integer_tests pointercheck --verbose
ctest -R "(parse_many_test|jsoncheck|basictests|stringparsingcheck|numberparsingcheck|errortests|integer_tests|pointercheck)" --output-on-failure

View File

@ -7,8 +7,10 @@
namespace simdjson {
namespace arm64 {
namespace {
using namespace simdjson;
using namespace simdjson::dom;
}
class implementation final : public simdjson::implementation {
public:

View File

@ -6,8 +6,10 @@
namespace simdjson {
namespace fallback {
namespace {
using namespace simdjson;
using namespace simdjson::dom;
}
class implementation final : public simdjson::implementation {
public:

View File

@ -41,7 +41,7 @@ simdjson_really_inline simdjson_result<object> document::get_object() & noexcept
}
simdjson_really_inline simdjson_result<uint64_t> document::get_uint64() noexcept {
assert_at_start();
return consume_if_success( iter.parse_uint64(json) );
return consume_if_success( iter.parse_root_uint64(json) );
}
simdjson_really_inline simdjson_result<int64_t> document::get_int64() noexcept {
assert_at_start();

View File

@ -215,7 +215,7 @@ SIMDJSON_WARN_UNUSED simdjson_result<uint64_t> json_iterator::parse_root_uint64(
uint8_t tmpbuf[20+1]; // <20 digits> is the longest possible unsigned integer
if (!copy_to_buffer(json, tmpbuf)) { logger::log_error(*this, "Root number more than 20 characters"); return NUMBER_ERROR; }
logger::log_value(*this, "uint64", "", 0);
auto result = numberparsing::parse_unsigned(buf);
auto result = numberparsing::parse_unsigned(tmpbuf);
if (result.error()) { logger::log_error(*this, "Error parsing unsigned integer"); return result.error(); }
return result;
}
@ -226,7 +226,7 @@ SIMDJSON_WARN_UNUSED simdjson_result<int64_t> json_iterator::parse_root_int64(co
uint8_t tmpbuf[20+1]; // -<19 digits> is the longest possible integer
if (!copy_to_buffer(json, tmpbuf)) { logger::log_error(*this, "Root number more than 20 characters"); return NUMBER_ERROR; }
logger::log_value(*this, "int64", "", 0);
auto result = numberparsing::parse_integer(buf);
auto result = numberparsing::parse_integer(tmpbuf);
if (result.error()) { report_error(result.error(), "Error parsing integer"); }
return result;
}
@ -238,7 +238,7 @@ SIMDJSON_WARN_UNUSED simdjson_result<double> json_iterator::parse_root_double(co
uint8_t tmpbuf[1074+8+1];
if (!copy_to_buffer(json, tmpbuf)) { logger::log_error(*this, "Root number more than 1082 characters"); return NUMBER_ERROR; }
logger::log_value(*this, "double", "", 0);
auto result = numberparsing::parse_double(buf);
auto result = numberparsing::parse_double(tmpbuf);
if (result.error()) { report_error(result.error(), "Error parsing double"); }
return result;
}

View File

@ -7,8 +7,10 @@
namespace simdjson {
namespace westmere {
namespace {
using namespace simdjson;
using namespace simdjson::dom;
}
class implementation final : public simdjson::implementation {
public:

View File

@ -34,11 +34,14 @@ function(add_cpp_test TEST_NAME)
set_property(TEST ${TEST_NAME} PROPERTY WILL_FAIL TRUE)
endif()
endfunction()
# Most tests need test data, and many need windows headers.
link_libraries(simdjson-internal-flags test-data simdjson-windows-headers)
include(${PROJECT_SOURCE_DIR}/cmake/add_cpp_test.cmake)
add_subdirectory(ondemand)
#
# These tests explicitly do #include "simdjson.cpp" so they can override stuff
#

View File

@ -0,0 +1,5 @@
# All remaining tests link with simdjson proper
link_libraries(simdjson)
include_directories(..)
add_cpp_test(ondemand_basictests LABELS acceptance per_implementation)

File diff suppressed because it is too large Load Diff