diff --git a/.github/workflows/website-build.yml b/.github/workflows/website-build.yml index dfb13b744..f9ace447f 100644 --- a/.github/workflows/website-build.yml +++ b/.github/workflows/website-build.yml @@ -26,6 +26,7 @@ jobs: -DBLAZE_DOCUMENTATION:BOOL=OFF -DBLAZE_EDITOR:BOOL=OFF -DBLAZE_FOUNDATION:BOOL=OFF + -DBLAZE_FRAME:BOOL=OFF -DBLAZE_BUNDLE:BOOL=OFF -DBLAZE_FORMAT:BOOL=OFF -DBLAZE_TESTS:BOOL=OFF diff --git a/.github/workflows/website-deploy.yml b/.github/workflows/website-deploy.yml index df45b7b95..9e5936788 100644 --- a/.github/workflows/website-deploy.yml +++ b/.github/workflows/website-deploy.yml @@ -37,6 +37,7 @@ jobs: -DBLAZE_DOCUMENTATION:BOOL=OFF -DBLAZE_EDITOR:BOOL=OFF -DBLAZE_FOUNDATION:BOOL=OFF + -DBLAZE_FRAME:BOOL=OFF -DBLAZE_BUNDLE:BOOL=OFF -DBLAZE_FORMAT:BOOL=OFF -DBLAZE_TESTS:BOOL=OFF diff --git a/CMakeLists.txt b/CMakeLists.txt index 7b4e7b14a..aae7a5136 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,6 +15,7 @@ option(BLAZE_CODEGEN "Build the Blaze codegen library" ON) option(BLAZE_DOCUMENTATION "Build the Blaze documentation generator library" ON) option(BLAZE_EDITOR "Build the Blaze editor schema compatibility library" ON) option(BLAZE_FOUNDATION "Build the Blaze foundation JSON Schema library" ON) +option(BLAZE_FRAME "Build the Blaze frame library" ON) option(BLAZE_BUNDLE "Build the Blaze bundle library" ON) option(BLAZE_FORMAT "Build the Blaze format library" ON) option(BLAZE_TESTS "Build the Blaze tests" OFF) @@ -53,6 +54,10 @@ if(BLAZE_FOUNDATION) add_subdirectory(src/foundation) endif() +if(BLAZE_FRAME) + add_subdirectory(src/frame) +endif() + if(BLAZE_BUNDLE) add_subdirectory(src/bundle) endif() @@ -147,6 +152,10 @@ if(BLAZE_TESTS) add_subdirectory(test/foundation) endif() + if(BLAZE_FRAME) + add_subdirectory(test/frame) + endif() + if(BLAZE_BUNDLE) add_subdirectory(test/bundle) endif() diff --git a/benchmark/CMakeLists.txt b/benchmark/CMakeLists.txt index 15a03ed6a..1f7050b66 100644 --- a/benchmark/CMakeLists.txt +++ b/benchmark/CMakeLists.txt @@ -4,6 +4,10 @@ if(BLAZE_FOUNDATION) list(APPEND BENCHMARK_SOURCES foundation.cc) endif() +if(BLAZE_FRAME) + list(APPEND BENCHMARK_SOURCES frame.cc) +endif() + if(BLAZE_BUNDLE) list(APPEND BENCHMARK_SOURCES bundle.cc) endif() @@ -61,6 +65,10 @@ if(BENCHMARK_SOURCES) target_link_libraries(sourcemeta_blaze_benchmark PRIVATE sourcemeta::blaze::foundation) endif() + if(BLAZE_FRAME) + target_link_libraries(sourcemeta_blaze_benchmark + PRIVATE sourcemeta::blaze::frame) + endif() if(BLAZE_BUNDLE) target_link_libraries(sourcemeta_blaze_benchmark PRIVATE sourcemeta::blaze::bundle) diff --git a/benchmark/foundation.cc b/benchmark/foundation.cc index 5219c1299..f0873a7a9 100644 --- a/benchmark/foundation.cc +++ b/benchmark/foundation.cc @@ -2,118 +2,12 @@ #include // assert #include // std::filesystem -#include // std::vector +#include // std::ref #include #include -#include - -static void Schema_Frame_WoT_References(benchmark::State &state) { - const auto schema{ - sourcemeta::core::read_json(std::filesystem::path{CURRENT_DIRECTORY} / - "files" / "draft7_w3c_wot_td_v1_1.json")}; - - for (auto _ : state) { - sourcemeta::blaze::SchemaFrame frame{ - sourcemeta::blaze::SchemaFrame::Mode::References}; - frame.analyse(schema, sourcemeta::blaze::schema_walker, - sourcemeta::blaze::schema_resolver); - benchmark::DoNotOptimize(frame); - } -} - -static void Schema_Frame_OMC_References(benchmark::State &state) { - const auto schema{ - sourcemeta::core::read_json(std::filesystem::path{CURRENT_DIRECTORY} / - "files" / "2019_09_omc_json_v2.json")}; - - for (auto _ : state) { - sourcemeta::blaze::SchemaFrame frame{ - sourcemeta::blaze::SchemaFrame::Mode::References}; - frame.analyse(schema, sourcemeta::blaze::schema_walker, - sourcemeta::blaze::schema_resolver); - benchmark::DoNotOptimize(frame); - } -} - -static void Schema_Frame_OMC_Locations(benchmark::State &state) { - const auto schema{ - sourcemeta::core::read_json(std::filesystem::path{CURRENT_DIRECTORY} / - "files" / "2019_09_omc_json_v2.json")}; - - for (auto _ : state) { - sourcemeta::blaze::SchemaFrame frame{ - sourcemeta::blaze::SchemaFrame::Mode::Locations}; - frame.analyse(schema, sourcemeta::blaze::schema_walker, - sourcemeta::blaze::schema_resolver); - benchmark::DoNotOptimize(frame); - } -} - -static void Schema_Frame_ISO_Language_Locations(benchmark::State &state) { - const auto schema{sourcemeta::core::read_json( - std::filesystem::path{CURRENT_DIRECTORY} / "files" / - "2020_12_iso_language_2023_set_3.json")}; - - for (auto _ : state) { - sourcemeta::blaze::SchemaFrame frame{ - sourcemeta::blaze::SchemaFrame::Mode::Locations}; - frame.analyse(schema, sourcemeta::blaze::schema_walker, - sourcemeta::blaze::schema_resolver); - benchmark::DoNotOptimize(frame); - } -} - -static void Schema_Frame_KrakenD_References(benchmark::State &state) { - const auto schema{ - sourcemeta::core::read_json(std::filesystem::path{CURRENT_DIRECTORY} / - "files" / "2019_09_krakend.json")}; - - for (auto _ : state) { - sourcemeta::blaze::SchemaFrame frame{ - sourcemeta::blaze::SchemaFrame::Mode::References}; - frame.analyse(schema, sourcemeta::blaze::schema_walker, - sourcemeta::blaze::schema_resolver); - benchmark::DoNotOptimize(frame); - } -} - -static void Schema_Frame_KrakenD_Reachable(benchmark::State &state) { - const auto schema{ - sourcemeta::core::read_json(std::filesystem::path{CURRENT_DIRECTORY} / - "files" / "2019_09_krakend.json")}; - - sourcemeta::blaze::SchemaFrame frame{ - sourcemeta::blaze::SchemaFrame::Mode::References}; - - for (auto _ : state) { - state.PauseTiming(); - frame.reset(); - frame.analyse(schema, sourcemeta::blaze::schema_walker, - sourcemeta::blaze::schema_resolver); - state.ResumeTiming(); - - for (const auto &entry : frame.locations()) { - if (entry.second.type == - sourcemeta::blaze::SchemaFrame::LocationType::Pointer) { - continue; - } - - for (const auto &subentry : frame.locations()) { - if (subentry.second.type == - sourcemeta::blaze::SchemaFrame::LocationType::Resource || - subentry.second.type == - sourcemeta::blaze::SchemaFrame::LocationType::Subschema) { - auto result{frame.is_reachable(subentry.second, entry.second, - sourcemeta::blaze::schema_walker, - sourcemeta::blaze::schema_resolver)}; - benchmark::DoNotOptimize(result); - } - } - } - } -} +#include static void Schema_Iterator_ISO_Language(benchmark::State &state) { const auto schema{sourcemeta::core::read_json( @@ -130,27 +24,6 @@ static void Schema_Iterator_ISO_Language(benchmark::State &state) { } } -static void -Schema_Frame_ISO_Language_Locations_To_JSON(benchmark::State &state) { - sourcemeta::core::PointerPositionTracker tracker; - sourcemeta::core::JSON schema{nullptr}; - sourcemeta::core::read_json(std::filesystem::path{CURRENT_DIRECTORY} / - "files" / - "2020_12_iso_language_2023_set_3.json", - schema, std::ref(tracker)); - - sourcemeta::blaze::SchemaFrame frame{ - sourcemeta::blaze::SchemaFrame::Mode::Locations}; - frame.analyse(schema, sourcemeta::blaze::schema_walker, - sourcemeta::blaze::schema_resolver); - - for (auto _ : state) { - auto result{frame.to_json(tracker)}; - assert(result.is_object()); - benchmark::DoNotOptimize(result); - } -} - static void Schema_Tracker_ISO_Language(benchmark::State &state) { for (auto _ : state) { sourcemeta::core::PointerPositionTracker tracker; @@ -179,28 +52,6 @@ static void Schema_Tracker_ISO_Language_To_JSON(benchmark::State &state) { } } -static void Schema_Frame_Many_Resources_References(benchmark::State &state) { - const auto schema{ - sourcemeta::core::read_json(std::filesystem::path{CURRENT_DIRECTORY} / - "files" / "2020_12_many_resources.json")}; - - for (auto _ : state) { - sourcemeta::blaze::SchemaFrame frame{ - sourcemeta::blaze::SchemaFrame::Mode::References}; - frame.analyse(schema, sourcemeta::blaze::schema_walker, - sourcemeta::blaze::schema_resolver); - benchmark::DoNotOptimize(frame); - } -} - -BENCHMARK(Schema_Frame_WoT_References); -BENCHMARK(Schema_Frame_OMC_References); -BENCHMARK(Schema_Frame_OMC_Locations); -BENCHMARK(Schema_Frame_ISO_Language_Locations); -BENCHMARK(Schema_Frame_KrakenD_References); -BENCHMARK(Schema_Frame_KrakenD_Reachable); BENCHMARK(Schema_Iterator_ISO_Language); -BENCHMARK(Schema_Frame_ISO_Language_Locations_To_JSON); BENCHMARK(Schema_Tracker_ISO_Language); BENCHMARK(Schema_Tracker_ISO_Language_To_JSON); -BENCHMARK(Schema_Frame_Many_Resources_References); diff --git a/benchmark/frame.cc b/benchmark/frame.cc new file mode 100644 index 000000000..7e6528e31 --- /dev/null +++ b/benchmark/frame.cc @@ -0,0 +1,161 @@ +#include + +#include // assert +#include // std::filesystem +#include // std::ref + +#include +#include + +#include +#include + +static void Schema_Frame_WoT_References(benchmark::State &state) { + const auto schema{ + sourcemeta::core::read_json(std::filesystem::path{CURRENT_DIRECTORY} / + "files" / "draft7_w3c_wot_td_v1_1.json")}; + + for (auto _ : state) { + sourcemeta::blaze::SchemaFrame frame{ + sourcemeta::blaze::SchemaFrame::Mode::References}; + frame.analyse(schema, sourcemeta::blaze::schema_walker, + sourcemeta::blaze::schema_resolver); + benchmark::DoNotOptimize(frame); + } +} + +static void Schema_Frame_OMC_References(benchmark::State &state) { + const auto schema{ + sourcemeta::core::read_json(std::filesystem::path{CURRENT_DIRECTORY} / + "files" / "2019_09_omc_json_v2.json")}; + + for (auto _ : state) { + sourcemeta::blaze::SchemaFrame frame{ + sourcemeta::blaze::SchemaFrame::Mode::References}; + frame.analyse(schema, sourcemeta::blaze::schema_walker, + sourcemeta::blaze::schema_resolver); + benchmark::DoNotOptimize(frame); + } +} + +static void Schema_Frame_OMC_Locations(benchmark::State &state) { + const auto schema{ + sourcemeta::core::read_json(std::filesystem::path{CURRENT_DIRECTORY} / + "files" / "2019_09_omc_json_v2.json")}; + + for (auto _ : state) { + sourcemeta::blaze::SchemaFrame frame{ + sourcemeta::blaze::SchemaFrame::Mode::Locations}; + frame.analyse(schema, sourcemeta::blaze::schema_walker, + sourcemeta::blaze::schema_resolver); + benchmark::DoNotOptimize(frame); + } +} + +static void Schema_Frame_ISO_Language_Locations(benchmark::State &state) { + const auto schema{sourcemeta::core::read_json( + std::filesystem::path{CURRENT_DIRECTORY} / "files" / + "2020_12_iso_language_2023_set_3.json")}; + + for (auto _ : state) { + sourcemeta::blaze::SchemaFrame frame{ + sourcemeta::blaze::SchemaFrame::Mode::Locations}; + frame.analyse(schema, sourcemeta::blaze::schema_walker, + sourcemeta::blaze::schema_resolver); + benchmark::DoNotOptimize(frame); + } +} + +static void Schema_Frame_KrakenD_References(benchmark::State &state) { + const auto schema{ + sourcemeta::core::read_json(std::filesystem::path{CURRENT_DIRECTORY} / + "files" / "2019_09_krakend.json")}; + + for (auto _ : state) { + sourcemeta::blaze::SchemaFrame frame{ + sourcemeta::blaze::SchemaFrame::Mode::References}; + frame.analyse(schema, sourcemeta::blaze::schema_walker, + sourcemeta::blaze::schema_resolver); + benchmark::DoNotOptimize(frame); + } +} + +static void Schema_Frame_KrakenD_Reachable(benchmark::State &state) { + const auto schema{ + sourcemeta::core::read_json(std::filesystem::path{CURRENT_DIRECTORY} / + "files" / "2019_09_krakend.json")}; + + sourcemeta::blaze::SchemaFrame frame{ + sourcemeta::blaze::SchemaFrame::Mode::References}; + + for (auto _ : state) { + state.PauseTiming(); + frame.reset(); + frame.analyse(schema, sourcemeta::blaze::schema_walker, + sourcemeta::blaze::schema_resolver); + state.ResumeTiming(); + + for (const auto &entry : frame.locations()) { + if (entry.second.type == + sourcemeta::blaze::SchemaFrame::LocationType::Pointer) { + continue; + } + + for (const auto &subentry : frame.locations()) { + if (subentry.second.type == + sourcemeta::blaze::SchemaFrame::LocationType::Resource || + subentry.second.type == + sourcemeta::blaze::SchemaFrame::LocationType::Subschema) { + auto result{frame.is_reachable(subentry.second, entry.second, + sourcemeta::blaze::schema_walker, + sourcemeta::blaze::schema_resolver)}; + benchmark::DoNotOptimize(result); + } + } + } + } +} + +static void +Schema_Frame_ISO_Language_Locations_To_JSON(benchmark::State &state) { + sourcemeta::core::PointerPositionTracker tracker; + sourcemeta::core::JSON schema{nullptr}; + sourcemeta::core::read_json(std::filesystem::path{CURRENT_DIRECTORY} / + "files" / + "2020_12_iso_language_2023_set_3.json", + schema, std::ref(tracker)); + + sourcemeta::blaze::SchemaFrame frame{ + sourcemeta::blaze::SchemaFrame::Mode::Locations}; + frame.analyse(schema, sourcemeta::blaze::schema_walker, + sourcemeta::blaze::schema_resolver); + + for (auto _ : state) { + auto result{frame.to_json(tracker)}; + assert(result.is_object()); + benchmark::DoNotOptimize(result); + } +} + +static void Schema_Frame_Many_Resources_References(benchmark::State &state) { + const auto schema{ + sourcemeta::core::read_json(std::filesystem::path{CURRENT_DIRECTORY} / + "files" / "2020_12_many_resources.json")}; + + for (auto _ : state) { + sourcemeta::blaze::SchemaFrame frame{ + sourcemeta::blaze::SchemaFrame::Mode::References}; + frame.analyse(schema, sourcemeta::blaze::schema_walker, + sourcemeta::blaze::schema_resolver); + benchmark::DoNotOptimize(frame); + } +} + +BENCHMARK(Schema_Frame_WoT_References); +BENCHMARK(Schema_Frame_OMC_References); +BENCHMARK(Schema_Frame_OMC_Locations); +BENCHMARK(Schema_Frame_ISO_Language_Locations); +BENCHMARK(Schema_Frame_KrakenD_References); +BENCHMARK(Schema_Frame_KrakenD_Reachable); +BENCHMARK(Schema_Frame_ISO_Language_Locations_To_JSON); +BENCHMARK(Schema_Frame_Many_Resources_References); diff --git a/config.cmake.in b/config.cmake.in index 71ed882b7..499cd43c2 100644 --- a/config.cmake.in +++ b/config.cmake.in @@ -5,6 +5,7 @@ list(APPEND BLAZE_COMPONENTS ${Blaze_FIND_COMPONENTS}) list(APPEND BLAZE_COMPONENTS ${blaze_FIND_COMPONENTS}) if(NOT BLAZE_COMPONENTS) list(APPEND BLAZE_COMPONENTS foundation) + list(APPEND BLAZE_COMPONENTS frame) list(APPEND BLAZE_COMPONENTS compiler) list(APPEND BLAZE_COMPONENTS evaluator) list(APPEND BLAZE_COMPONENTS output) @@ -24,8 +25,12 @@ find_dependency(Core COMPONENTS regex uri uritemplate json jsonpointer io yaml c foreach(component ${BLAZE_COMPONENTS}) if(component STREQUAL "foundation") include("${CMAKE_CURRENT_LIST_DIR}/sourcemeta_blaze_foundation.cmake") + elseif(component STREQUAL "frame") + include("${CMAKE_CURRENT_LIST_DIR}/sourcemeta_blaze_foundation.cmake") + include("${CMAKE_CURRENT_LIST_DIR}/sourcemeta_blaze_frame.cmake") elseif(component STREQUAL "compiler") include("${CMAKE_CURRENT_LIST_DIR}/sourcemeta_blaze_foundation.cmake") + include("${CMAKE_CURRENT_LIST_DIR}/sourcemeta_blaze_frame.cmake") include("${CMAKE_CURRENT_LIST_DIR}/sourcemeta_blaze_bundle.cmake") include("${CMAKE_CURRENT_LIST_DIR}/sourcemeta_blaze_evaluator.cmake") include("${CMAKE_CURRENT_LIST_DIR}/sourcemeta_blaze_compiler.cmake") @@ -34,26 +39,31 @@ foreach(component ${BLAZE_COMPONENTS}) include("${CMAKE_CURRENT_LIST_DIR}/sourcemeta_blaze_evaluator.cmake") elseif(component STREQUAL "test") include("${CMAKE_CURRENT_LIST_DIR}/sourcemeta_blaze_foundation.cmake") + include("${CMAKE_CURRENT_LIST_DIR}/sourcemeta_blaze_frame.cmake") include("${CMAKE_CURRENT_LIST_DIR}/sourcemeta_blaze_bundle.cmake") include("${CMAKE_CURRENT_LIST_DIR}/sourcemeta_blaze_evaluator.cmake") include("${CMAKE_CURRENT_LIST_DIR}/sourcemeta_blaze_compiler.cmake") include("${CMAKE_CURRENT_LIST_DIR}/sourcemeta_blaze_test.cmake") elseif(component STREQUAL "output") include("${CMAKE_CURRENT_LIST_DIR}/sourcemeta_blaze_foundation.cmake") + include("${CMAKE_CURRENT_LIST_DIR}/sourcemeta_blaze_frame.cmake") include("${CMAKE_CURRENT_LIST_DIR}/sourcemeta_blaze_evaluator.cmake") include("${CMAKE_CURRENT_LIST_DIR}/sourcemeta_blaze_output.cmake") elseif(component STREQUAL "configuration") include("${CMAKE_CURRENT_LIST_DIR}/sourcemeta_blaze_foundation.cmake") + include("${CMAKE_CURRENT_LIST_DIR}/sourcemeta_blaze_frame.cmake") include("${CMAKE_CURRENT_LIST_DIR}/sourcemeta_blaze_bundle.cmake") include("${CMAKE_CURRENT_LIST_DIR}/sourcemeta_blaze_configuration.cmake") elseif(component STREQUAL "alterschema") include("${CMAKE_CURRENT_LIST_DIR}/sourcemeta_blaze_foundation.cmake") + include("${CMAKE_CURRENT_LIST_DIR}/sourcemeta_blaze_frame.cmake") include("${CMAKE_CURRENT_LIST_DIR}/sourcemeta_blaze_evaluator.cmake") include("${CMAKE_CURRENT_LIST_DIR}/sourcemeta_blaze_compiler.cmake") include("${CMAKE_CURRENT_LIST_DIR}/sourcemeta_blaze_output.cmake") include("${CMAKE_CURRENT_LIST_DIR}/sourcemeta_blaze_alterschema.cmake") elseif(component STREQUAL "codegen") include("${CMAKE_CURRENT_LIST_DIR}/sourcemeta_blaze_foundation.cmake") + include("${CMAKE_CURRENT_LIST_DIR}/sourcemeta_blaze_frame.cmake") include("${CMAKE_CURRENT_LIST_DIR}/sourcemeta_blaze_bundle.cmake") include("${CMAKE_CURRENT_LIST_DIR}/sourcemeta_blaze_evaluator.cmake") include("${CMAKE_CURRENT_LIST_DIR}/sourcemeta_blaze_compiler.cmake") @@ -62,15 +72,19 @@ foreach(component ${BLAZE_COMPONENTS}) include("${CMAKE_CURRENT_LIST_DIR}/sourcemeta_blaze_codegen.cmake") elseif(component STREQUAL "documentation") include("${CMAKE_CURRENT_LIST_DIR}/sourcemeta_blaze_foundation.cmake") + include("${CMAKE_CURRENT_LIST_DIR}/sourcemeta_blaze_frame.cmake") include("${CMAKE_CURRENT_LIST_DIR}/sourcemeta_blaze_documentation.cmake") elseif(component STREQUAL "editor") include("${CMAKE_CURRENT_LIST_DIR}/sourcemeta_blaze_foundation.cmake") + include("${CMAKE_CURRENT_LIST_DIR}/sourcemeta_blaze_frame.cmake") include("${CMAKE_CURRENT_LIST_DIR}/sourcemeta_blaze_editor.cmake") elseif(component STREQUAL "bundle") include("${CMAKE_CURRENT_LIST_DIR}/sourcemeta_blaze_foundation.cmake") + include("${CMAKE_CURRENT_LIST_DIR}/sourcemeta_blaze_frame.cmake") include("${CMAKE_CURRENT_LIST_DIR}/sourcemeta_blaze_bundle.cmake") elseif(component STREQUAL "format") include("${CMAKE_CURRENT_LIST_DIR}/sourcemeta_blaze_foundation.cmake") + include("${CMAKE_CURRENT_LIST_DIR}/sourcemeta_blaze_frame.cmake") include("${CMAKE_CURRENT_LIST_DIR}/sourcemeta_blaze_format.cmake") else() message(FATAL_ERROR "Unknown Blaze component: ${component}") diff --git a/doxygen/index.markdown b/doxygen/index.markdown index 6afc174ca..651f4a554 100644 --- a/doxygen/index.markdown +++ b/doxygen/index.markdown @@ -74,6 +74,7 @@ CMake | `BLAZE_DOCUMENTATION` | Boolean | `ON` | Build the Blaze documentation library | | `BLAZE_EDITOR` | Boolean | `ON` | Build the Blaze editor library | | `BLAZE_FOUNDATION` | Boolean | `ON` | Build the Blaze foundation library | +| `BLAZE_FRAME` | Boolean | `ON` | Build the Blaze frame library | | `BLAZE_BUNDLE` | Boolean | `ON` | Build the Blaze bundle library | | `BLAZE_FORMAT` | Boolean | `ON` | Build the Blaze format library | | `BLAZE_TESTS` | Boolean | `OFF` | Build the Blaze tests | diff --git a/src/alterschema/CMakeLists.txt b/src/alterschema/CMakeLists.txt index 91c6f9cae..37c5b5a15 100644 --- a/src/alterschema/CMakeLists.txt +++ b/src/alterschema/CMakeLists.txt @@ -170,6 +170,8 @@ endif() target_link_libraries(sourcemeta_blaze_alterschema PUBLIC sourcemeta::blaze::foundation) +target_link_libraries(sourcemeta_blaze_alterschema PUBLIC + sourcemeta::blaze::frame) target_link_libraries(sourcemeta_blaze_alterschema PUBLIC sourcemeta::blaze::compiler) target_link_libraries(sourcemeta_blaze_alterschema PRIVATE diff --git a/src/alterschema/alterschema.cc b/src/alterschema/alterschema.cc index 30b5417cd..2f1a6cb76 100644 --- a/src/alterschema/alterschema.cc +++ b/src/alterschema/alterschema.cc @@ -1,6 +1,7 @@ #include #include #include +#include #include #include #include diff --git a/src/alterschema/include/sourcemeta/blaze/alterschema.h b/src/alterschema/include/sourcemeta/blaze/alterschema.h index 66105405b..e1fa7ea6b 100644 --- a/src/alterschema/include/sourcemeta/blaze/alterschema.h +++ b/src/alterschema/include/sourcemeta/blaze/alterschema.h @@ -19,6 +19,7 @@ #include #include +#include #include // std::uint8_t #include // std::optional, std::nullopt diff --git a/src/alterschema/include/sourcemeta/blaze/alterschema_transformer.h b/src/alterschema/include/sourcemeta/blaze/alterschema_transformer.h index bd46c3cfc..1dec5e413 100644 --- a/src/alterschema/include/sourcemeta/blaze/alterschema_transformer.h +++ b/src/alterschema/include/sourcemeta/blaze/alterschema_transformer.h @@ -6,6 +6,7 @@ #endif #include +#include #include #include diff --git a/src/alterschema/schema_rule.cc b/src/alterschema/schema_rule.cc index 5d50a1597..4c5a9937b 100644 --- a/src/alterschema/schema_rule.cc +++ b/src/alterschema/schema_rule.cc @@ -2,6 +2,7 @@ #include #include #include +#include #include #include diff --git a/src/alterschema/transformer.cc b/src/alterschema/transformer.cc index 08b417776..68e1f54cf 100644 --- a/src/alterschema/transformer.cc +++ b/src/alterschema/transformer.cc @@ -1,5 +1,6 @@ #include #include +#include #include #include // std::erase_if diff --git a/src/alterschema/wrap.cc b/src/alterschema/wrap.cc index 5a08c5561..9235cd89f 100644 --- a/src/alterschema/wrap.cc +++ b/src/alterschema/wrap.cc @@ -1,6 +1,7 @@ #include #include +#include #include #include diff --git a/src/bundle/CMakeLists.txt b/src/bundle/CMakeLists.txt index 42096c775..a1dd3ec9d 100644 --- a/src/bundle/CMakeLists.txt +++ b/src/bundle/CMakeLists.txt @@ -12,5 +12,7 @@ target_link_libraries(sourcemeta_blaze_bundle PUBLIC sourcemeta::core::jsonpointer) target_link_libraries(sourcemeta_blaze_bundle PUBLIC sourcemeta::blaze::foundation) +target_link_libraries(sourcemeta_blaze_bundle PUBLIC + sourcemeta::blaze::frame) target_link_libraries(sourcemeta_blaze_bundle PRIVATE sourcemeta::core::uri) diff --git a/src/bundle/bundle.cc b/src/bundle/bundle.cc index d28a00dd9..ad28457d7 100644 --- a/src/bundle/bundle.cc +++ b/src/bundle/bundle.cc @@ -1,6 +1,7 @@ #include #include +#include #include "helpers.h" diff --git a/src/bundle/include/sourcemeta/blaze/bundle.h b/src/bundle/include/sourcemeta/blaze/bundle.h index 311a2189c..9a21f9293 100644 --- a/src/bundle/include/sourcemeta/blaze/bundle.h +++ b/src/bundle/include/sourcemeta/blaze/bundle.h @@ -18,6 +18,7 @@ #include #include +#include #include // std::function #include // std::optional, std::nullopt diff --git a/src/codegen/CMakeLists.txt b/src/codegen/CMakeLists.txt index c4dcfc252..cb512d2c5 100644 --- a/src/codegen/CMakeLists.txt +++ b/src/codegen/CMakeLists.txt @@ -16,6 +16,8 @@ target_link_libraries(sourcemeta_blaze_codegen PUBLIC sourcemeta::core::json) target_link_libraries(sourcemeta_blaze_codegen PUBLIC sourcemeta::blaze::foundation) +target_link_libraries(sourcemeta_blaze_codegen PUBLIC + sourcemeta::blaze::frame) target_link_libraries(sourcemeta_blaze_codegen PRIVATE sourcemeta::blaze::bundle) target_link_libraries(sourcemeta_blaze_codegen PRIVATE diff --git a/src/codegen/codegen.cc b/src/codegen/codegen.cc index 334758ac7..583566305 100644 --- a/src/codegen/codegen.cc +++ b/src/codegen/codegen.cc @@ -1,6 +1,7 @@ #include #include #include +#include #include // std::ranges::sort #include // assert diff --git a/src/codegen/codegen_default_compiler.h b/src/codegen/codegen_default_compiler.h index 98eced569..cbb4a517a 100644 --- a/src/codegen/codegen_default_compiler.h +++ b/src/codegen/codegen_default_compiler.h @@ -4,6 +4,7 @@ #include #include +#include #include #include diff --git a/src/codegen/codegen_symbol.cc b/src/codegen/codegen_symbol.cc index ebe40ddf2..d6d4f9a53 100644 --- a/src/codegen/codegen_symbol.cc +++ b/src/codegen/codegen_symbol.cc @@ -1,4 +1,5 @@ #include +#include #include diff --git a/src/codegen/include/sourcemeta/blaze/codegen.h b/src/codegen/include/sourcemeta/blaze/codegen.h index d7319bdbb..63e4296c2 100644 --- a/src/codegen/include/sourcemeta/blaze/codegen.h +++ b/src/codegen/include/sourcemeta/blaze/codegen.h @@ -11,6 +11,7 @@ // NOLINTEND(misc-include-cleaner) #include +#include #include #include diff --git a/src/compiler/CMakeLists.txt b/src/compiler/CMakeLists.txt index b6a1dfd96..459f84564 100644 --- a/src/compiler/CMakeLists.txt +++ b/src/compiler/CMakeLists.txt @@ -26,6 +26,8 @@ target_link_libraries(sourcemeta_blaze_compiler PRIVATE sourcemeta::core::uri) target_link_libraries(sourcemeta_blaze_compiler PUBLIC sourcemeta::blaze::foundation) +target_link_libraries(sourcemeta_blaze_compiler PUBLIC + sourcemeta::blaze::frame) target_link_libraries(sourcemeta_blaze_compiler PRIVATE sourcemeta::blaze::bundle) target_link_libraries(sourcemeta_blaze_compiler PUBLIC diff --git a/src/compiler/compile.cc b/src/compiler/compile.cc index 8a6bf7cb6..425dc18ac 100644 --- a/src/compiler/compile.cc +++ b/src/compiler/compile.cc @@ -2,6 +2,7 @@ #include #include #include +#include #include // std::move, std::sort, std::unique #include // assert diff --git a/src/compiler/compile_helpers.h b/src/compiler/compile_helpers.h index d0e6df3c6..1a93740bd 100644 --- a/src/compiler/compile_helpers.h +++ b/src/compiler/compile_helpers.h @@ -2,6 +2,7 @@ #define SOURCEMETA_BLAZE_COMPILER_COMPILE_HELPERS_H_ #include +#include #include #include // std::ranges::find, std::ranges::any_of diff --git a/src/compiler/include/sourcemeta/blaze/compiler.h b/src/compiler/include/sourcemeta/blaze/compiler.h index f5dec141f..f823bc30d 100644 --- a/src/compiler/include/sourcemeta/blaze/compiler.h +++ b/src/compiler/include/sourcemeta/blaze/compiler.h @@ -11,6 +11,7 @@ #include #include +#include #include #include #include diff --git a/src/compiler/include/sourcemeta/blaze/compiler_unevaluated.h b/src/compiler/include/sourcemeta/blaze/compiler_unevaluated.h index 12b9fd65c..aa5b0e955 100644 --- a/src/compiler/include/sourcemeta/blaze/compiler_unevaluated.h +++ b/src/compiler/include/sourcemeta/blaze/compiler_unevaluated.h @@ -6,6 +6,7 @@ #endif #include +#include #include #include diff --git a/src/compiler/unevaluated.cc b/src/compiler/unevaluated.cc index 058393591..1cc8f61a2 100644 --- a/src/compiler/unevaluated.cc +++ b/src/compiler/unevaluated.cc @@ -1,4 +1,5 @@ #include +#include #include "compile_helpers.h" diff --git a/src/documentation/CMakeLists.txt b/src/documentation/CMakeLists.txt index 147d3410d..189ac91c2 100644 --- a/src/documentation/CMakeLists.txt +++ b/src/documentation/CMakeLists.txt @@ -10,6 +10,8 @@ target_link_libraries(sourcemeta_blaze_documentation PUBLIC sourcemeta::core::json) target_link_libraries(sourcemeta_blaze_documentation PUBLIC sourcemeta::blaze::foundation) +target_link_libraries(sourcemeta_blaze_documentation PRIVATE + sourcemeta::blaze::frame) target_link_libraries(sourcemeta_blaze_documentation PRIVATE sourcemeta::blaze::alterschema) target_link_libraries(sourcemeta_blaze_documentation PRIVATE diff --git a/src/documentation/documentation.cc b/src/documentation/documentation.cc index 2f2b89fee..83470ef94 100644 --- a/src/documentation/documentation.cc +++ b/src/documentation/documentation.cc @@ -3,6 +3,7 @@ #include #include +#include #include #include // assert diff --git a/src/editor/CMakeLists.txt b/src/editor/CMakeLists.txt index 3c2cd375c..8dd4c489c 100644 --- a/src/editor/CMakeLists.txt +++ b/src/editor/CMakeLists.txt @@ -10,3 +10,5 @@ target_link_libraries(sourcemeta_blaze_editor PUBLIC sourcemeta::core::json) target_link_libraries(sourcemeta_blaze_editor PUBLIC sourcemeta::blaze::foundation) +target_link_libraries(sourcemeta_blaze_editor PRIVATE + sourcemeta::blaze::frame) diff --git a/src/editor/editor.cc b/src/editor/editor.cc index 638cd7279..7b3f31660 100644 --- a/src/editor/editor.cc +++ b/src/editor/editor.cc @@ -1,4 +1,5 @@ #include +#include #include // assert #include // std::map diff --git a/src/format/CMakeLists.txt b/src/format/CMakeLists.txt index 42c7df429..d30c6a9f7 100644 --- a/src/format/CMakeLists.txt +++ b/src/format/CMakeLists.txt @@ -12,3 +12,5 @@ target_link_libraries(sourcemeta_blaze_format PUBLIC sourcemeta::core::jsonpointer) target_link_libraries(sourcemeta_blaze_format PUBLIC sourcemeta::blaze::foundation) +target_link_libraries(sourcemeta_blaze_format PRIVATE + sourcemeta::blaze::frame) diff --git a/src/format/format.cc b/src/format/format.cc index d52596f34..c6c659ff2 100644 --- a/src/format/format.cc +++ b/src/format/format.cc @@ -1,6 +1,7 @@ #include #include +#include #include // std::uint64_t #include // std::numeric_limits diff --git a/src/foundation/CMakeLists.txt b/src/foundation/CMakeLists.txt index fd7b9b368..99b8d7896 100644 --- a/src/foundation/CMakeLists.txt +++ b/src/foundation/CMakeLists.txt @@ -4,10 +4,10 @@ include(./known_resolver.cmake) sourcemeta_library(NAMESPACE sourcemeta PROJECT blaze NAME foundation FOLDER "Blaze/Foundation" - PRIVATE_HEADERS walker.h frame.h error.h + PRIVATE_HEADERS walker.h error.h types.h vocabularies.h SOURCES foundation.cc vocabularies.cc known_walker.cc - frame.cc walker.cc helpers.h + walker.cc helpers.h "${CMAKE_CURRENT_BINARY_DIR}/known_resolver.cc") if(BLAZE_INSTALL) diff --git a/src/foundation/include/sourcemeta/blaze/foundation.h b/src/foundation/include/sourcemeta/blaze/foundation.h index 3b2871129..4f8cc5cd4 100644 --- a/src/foundation/include/sourcemeta/blaze/foundation.h +++ b/src/foundation/include/sourcemeta/blaze/foundation.h @@ -10,7 +10,6 @@ // NOLINTBEGIN(misc-include-cleaner) #include -#include #include #include // NOLINTEND(misc-include-cleaner) diff --git a/src/foundation/include/sourcemeta/blaze/foundation_error.h b/src/foundation/include/sourcemeta/blaze/foundation_error.h index 9a3283211..d9a20ad31 100644 --- a/src/foundation/include/sourcemeta/blaze/foundation_error.h +++ b/src/foundation/include/sourcemeta/blaze/foundation_error.h @@ -218,62 +218,6 @@ class SOURCEMETA_BLAZE_FOUNDATION_EXPORT SchemaKeywordError const char *message_; }; -/// @ingroup foundation -/// An error that represents a schema frame error -class SOURCEMETA_BLAZE_FOUNDATION_EXPORT SchemaFrameError - : public std::exception { -public: - SchemaFrameError(const std::string_view identifier, const char *message) - : identifier_{identifier}, message_{message} {} - - [[nodiscard]] auto what() const noexcept -> const char * override { - return this->message_; - } - - [[nodiscard]] auto identifier() const noexcept -> std::string_view { - return this->identifier_; - } - -private: - std::string identifier_; - const char *message_; -}; - -/// @ingroup foundation -/// An error that represents a schema anchor collision error -class SOURCEMETA_BLAZE_FOUNDATION_EXPORT SchemaAnchorCollisionError - : public std::exception { -public: - SchemaAnchorCollisionError(const std::string_view identifier, - sourcemeta::core::Pointer location, - sourcemeta::core::Pointer other) - : identifier_{identifier}, location_(std::move(location)), - other_(std::move(other)) {} - - [[nodiscard]] auto what() const noexcept -> const char * override { - return "Schema anchor already exists"; - } - - [[nodiscard]] auto identifier() const noexcept -> std::string_view { - return this->identifier_; - } - - [[nodiscard]] auto location() const noexcept - -> const sourcemeta::core::Pointer & { - return this->location_; - } - - [[nodiscard]] auto other() const noexcept - -> const sourcemeta::core::Pointer & { - return this->other_; - } - -private: - std::string identifier_; - sourcemeta::core::Pointer location_; - sourcemeta::core::Pointer other_; -}; - #if defined(_MSC_VER) #pragma warning(default : 4251 4275) #endif diff --git a/src/frame/CMakeLists.txt b/src/frame/CMakeLists.txt new file mode 100644 index 000000000..606d2f04d --- /dev/null +++ b/src/frame/CMakeLists.txt @@ -0,0 +1,17 @@ +sourcemeta_library(NAMESPACE sourcemeta PROJECT blaze NAME frame + FOLDER "Blaze/Frame" + PRIVATE_HEADERS error.h + SOURCES frame.cc helpers.h) + +if(BLAZE_INSTALL) + sourcemeta_library_install(NAMESPACE sourcemeta PROJECT blaze NAME frame) +endif() + +target_link_libraries(sourcemeta_blaze_frame PUBLIC + sourcemeta::core::json) +target_link_libraries(sourcemeta_blaze_frame PUBLIC + sourcemeta::core::jsonpointer) +target_link_libraries(sourcemeta_blaze_frame PUBLIC + sourcemeta::blaze::foundation) +target_link_libraries(sourcemeta_blaze_frame PRIVATE + sourcemeta::core::uri) diff --git a/src/foundation/frame.cc b/src/frame/frame.cc similarity index 99% rename from src/foundation/frame.cc rename to src/frame/frame.cc index 353488fac..a8e4a4ee7 100644 --- a/src/foundation/frame.cc +++ b/src/frame/frame.cc @@ -1,3 +1,5 @@ +#include + #include #include "helpers.h" diff --git a/src/frame/helpers.h b/src/frame/helpers.h new file mode 100644 index 000000000..75bf31b5d --- /dev/null +++ b/src/frame/helpers.h @@ -0,0 +1,89 @@ +#ifndef SOURCEMETA_BLAZE_FRAME_HELPERS_H +#define SOURCEMETA_BLAZE_FRAME_HELPERS_H + +#include + +#include // assert +#include // std::string_view + +namespace sourcemeta::blaze { + +inline auto id_keyword(const SchemaBaseDialect base_dialect) + -> std::string_view { + switch (base_dialect) { + case SchemaBaseDialect::JSON_Schema_2020_12: + case SchemaBaseDialect::JSON_Schema_2020_12_Hyper: + case SchemaBaseDialect::JSON_Schema_2019_09: + case SchemaBaseDialect::JSON_Schema_2019_09_Hyper: + case SchemaBaseDialect::JSON_Schema_Draft_7: + case SchemaBaseDialect::JSON_Schema_Draft_7_Hyper: + case SchemaBaseDialect::JSON_Schema_Draft_6: + case SchemaBaseDialect::JSON_Schema_Draft_6_Hyper: + return "$id"; + case SchemaBaseDialect::JSON_Schema_Draft_4: + case SchemaBaseDialect::JSON_Schema_Draft_4_Hyper: + case SchemaBaseDialect::JSON_Schema_Draft_3: + case SchemaBaseDialect::JSON_Schema_Draft_3_Hyper: + case SchemaBaseDialect::JSON_Schema_Draft_2_Hyper: + case SchemaBaseDialect::JSON_Schema_Draft_1_Hyper: + case SchemaBaseDialect::JSON_Schema_Draft_0_Hyper: + return "id"; + } + + assert(false); + return "$id"; +} + +inline auto definitions_keyword(const SchemaBaseDialect base_dialect) + -> std::string_view { + switch (base_dialect) { + case SchemaBaseDialect::JSON_Schema_2020_12: + case SchemaBaseDialect::JSON_Schema_2020_12_Hyper: + case SchemaBaseDialect::JSON_Schema_2019_09: + case SchemaBaseDialect::JSON_Schema_2019_09_Hyper: + return "$defs"; + case SchemaBaseDialect::JSON_Schema_Draft_7: + case SchemaBaseDialect::JSON_Schema_Draft_7_Hyper: + case SchemaBaseDialect::JSON_Schema_Draft_6: + case SchemaBaseDialect::JSON_Schema_Draft_6_Hyper: + case SchemaBaseDialect::JSON_Schema_Draft_4: + case SchemaBaseDialect::JSON_Schema_Draft_4_Hyper: + case SchemaBaseDialect::JSON_Schema_Draft_3: + case SchemaBaseDialect::JSON_Schema_Draft_3_Hyper: + return "definitions"; + case SchemaBaseDialect::JSON_Schema_Draft_2_Hyper: + case SchemaBaseDialect::JSON_Schema_Draft_1_Hyper: + case SchemaBaseDialect::JSON_Schema_Draft_0_Hyper: + return ""; + } + + assert(false); + return "$defs"; +} + +// In older drafts, the presence of `$ref` would override any sibling keywords +// See +// https://json-schema.org/draft-07/draft-handrews-json-schema-01#rfc.section.8.3 +inline auto +ref_overrides_adjacent_keywords(const SchemaBaseDialect base_dialect) -> bool { + switch (base_dialect) { + case SchemaBaseDialect::JSON_Schema_Draft_7: + case SchemaBaseDialect::JSON_Schema_Draft_7_Hyper: + case SchemaBaseDialect::JSON_Schema_Draft_6: + case SchemaBaseDialect::JSON_Schema_Draft_6_Hyper: + case SchemaBaseDialect::JSON_Schema_Draft_4: + case SchemaBaseDialect::JSON_Schema_Draft_4_Hyper: + case SchemaBaseDialect::JSON_Schema_Draft_3: + case SchemaBaseDialect::JSON_Schema_Draft_3_Hyper: + case SchemaBaseDialect::JSON_Schema_Draft_2_Hyper: + case SchemaBaseDialect::JSON_Schema_Draft_1_Hyper: + case SchemaBaseDialect::JSON_Schema_Draft_0_Hyper: + return true; + default: + return false; + } +} + +} // namespace sourcemeta::blaze + +#endif diff --git a/src/foundation/include/sourcemeta/blaze/foundation_frame.h b/src/frame/include/sourcemeta/blaze/frame.h similarity index 95% rename from src/foundation/include/sourcemeta/blaze/foundation_frame.h rename to src/frame/include/sourcemeta/blaze/frame.h index dbfdb4e5f..7481f64db 100644 --- a/src/foundation/include/sourcemeta/blaze/foundation_frame.h +++ b/src/frame/include/sourcemeta/blaze/frame.h @@ -1,16 +1,28 @@ -#ifndef SOURCEMETA_BLAZE_FOUNDATION_FRAME_H_ -#define SOURCEMETA_BLAZE_FOUNDATION_FRAME_H_ +#ifndef SOURCEMETA_BLAZE_FRAME_H_ +#define SOURCEMETA_BLAZE_FRAME_H_ -#ifndef SOURCEMETA_BLAZE_FOUNDATION_EXPORT -#include +/// @defgroup frame Frame +/// @brief A static analysis pass that maps URIs and pointers to subschemas. +/// +/// This functionality is included as follows: +/// +/// ```cpp +/// #include +/// ``` + +#ifndef SOURCEMETA_BLAZE_FRAME_EXPORT +#include #endif +// NOLINTBEGIN(misc-include-cleaner) +#include +// NOLINTEND(misc-include-cleaner) + +#include + #include #include -#include -#include - #include // std::invocable #include // std::uint8_t #include // std::reference_wrapper @@ -25,7 +37,7 @@ namespace sourcemeta::blaze { -/// @ingroup foundation +/// @ingroup frame /// /// This class performs a static analysis pass on the input schema, computing /// things such as the static identifiers and references of a schema. @@ -55,7 +67,7 @@ namespace sourcemeta::blaze { /// sourcemeta::blaze::schema_walker, /// sourcemeta::blaze::schema_resolver); /// ``` -class SOURCEMETA_BLAZE_FOUNDATION_EXPORT SchemaFrame { +class SOURCEMETA_BLAZE_FRAME_EXPORT SchemaFrame { public: /// The mode of framing. More extensive analysis can be compute and memory /// intensive @@ -100,7 +112,7 @@ class SOURCEMETA_BLAZE_FOUNDATION_EXPORT SchemaFrame { // definition), can shadow an alias defined even on a different namespace. #pragma GCC diagnostic ignored "-Wshadow" #endif - /// @ingroup foundation + /// @ingroup frame /// The type of a location frame enum class LocationType : std::uint8_t { Resource, diff --git a/src/frame/include/sourcemeta/blaze/frame_error.h b/src/frame/include/sourcemeta/blaze/frame_error.h new file mode 100644 index 000000000..0cbd333d1 --- /dev/null +++ b/src/frame/include/sourcemeta/blaze/frame_error.h @@ -0,0 +1,85 @@ +#ifndef SOURCEMETA_BLAZE_FRAME_ERROR_H +#define SOURCEMETA_BLAZE_FRAME_ERROR_H + +#ifndef SOURCEMETA_BLAZE_FRAME_EXPORT +#include +#endif + +#include + +#include // std::exception +#include // std::string +#include // std::string_view +#include // std::move + +namespace sourcemeta::blaze { + +// Exporting symbols that depends on the standard C++ library is considered +// safe. +// https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-2-c4275?view=msvc-170&redirectedfrom=MSDN +#if defined(_MSC_VER) +#pragma warning(disable : 4251 4275) +#endif + +/// @ingroup frame +/// An error that represents a schema frame error +class SOURCEMETA_BLAZE_FRAME_EXPORT SchemaFrameError : public std::exception { +public: + SchemaFrameError(const std::string_view identifier, const char *message) + : identifier_{identifier}, message_{message} {} + + [[nodiscard]] auto what() const noexcept -> const char * override { + return this->message_; + } + + [[nodiscard]] auto identifier() const noexcept -> std::string_view { + return this->identifier_; + } + +private: + std::string identifier_; + const char *message_; +}; + +/// @ingroup frame +/// An error that represents a schema anchor collision error +class SOURCEMETA_BLAZE_FRAME_EXPORT SchemaAnchorCollisionError + : public std::exception { +public: + SchemaAnchorCollisionError(const std::string_view identifier, + sourcemeta::core::Pointer location, + sourcemeta::core::Pointer other) + : identifier_{identifier}, location_(std::move(location)), + other_(std::move(other)) {} + + [[nodiscard]] auto what() const noexcept -> const char * override { + return "Schema anchor already exists"; + } + + [[nodiscard]] auto identifier() const noexcept -> std::string_view { + return this->identifier_; + } + + [[nodiscard]] auto location() const noexcept + -> const sourcemeta::core::Pointer & { + return this->location_; + } + + [[nodiscard]] auto other() const noexcept + -> const sourcemeta::core::Pointer & { + return this->other_; + } + +private: + std::string identifier_; + sourcemeta::core::Pointer location_; + sourcemeta::core::Pointer other_; +}; + +#if defined(_MSC_VER) +#pragma warning(default : 4251 4275) +#endif + +} // namespace sourcemeta::blaze + +#endif diff --git a/src/output/CMakeLists.txt b/src/output/CMakeLists.txt index dc5a79336..486d47cf9 100644 --- a/src/output/CMakeLists.txt +++ b/src/output/CMakeLists.txt @@ -16,6 +16,8 @@ target_link_libraries(sourcemeta_blaze_output PUBLIC sourcemeta::core::jsonpointer) target_link_libraries(sourcemeta_blaze_output PUBLIC sourcemeta::blaze::foundation) +target_link_libraries(sourcemeta_blaze_output PUBLIC + sourcemeta::blaze::frame) target_link_libraries(sourcemeta_blaze_output PUBLIC sourcemeta::blaze::evaluator) diff --git a/src/output/include/sourcemeta/blaze/output_trace.h b/src/output/include/sourcemeta/blaze/output_trace.h index 75aca202f..8e8c05231 100644 --- a/src/output/include/sourcemeta/blaze/output_trace.h +++ b/src/output/include/sourcemeta/blaze/output_trace.h @@ -5,12 +5,13 @@ #include #endif +#include #include +#include + #include #include -#include - #include // std::uint8_t #include // std::function, std::reference_wrapper #include // std::optional, std::nullopt diff --git a/src/output/output_trace.cc b/src/output/output_trace.cc index eb9fd0bfb..6f8e23e89 100644 --- a/src/output/output_trace.cc +++ b/src/output/output_trace.cc @@ -1,3 +1,4 @@ +#include #include #include diff --git a/test/alterschema/CMakeLists.txt b/test/alterschema/CMakeLists.txt index 31de01c9f..652a5684f 100644 --- a/test/alterschema/CMakeLists.txt +++ b/test/alterschema/CMakeLists.txt @@ -46,6 +46,8 @@ target_link_libraries(sourcemeta_blaze_alterschema_unit PRIVATE sourcemeta::core::json) target_link_libraries(sourcemeta_blaze_alterschema_unit PRIVATE sourcemeta::blaze::foundation) +target_link_libraries(sourcemeta_blaze_alterschema_unit + PRIVATE sourcemeta::blaze::frame) target_link_libraries(sourcemeta_blaze_alterschema_unit PRIVATE sourcemeta::blaze::alterschema) target_link_libraries(sourcemeta_blaze_alterschema_unit diff --git a/test/alterschema/alterschema_transform_rules.h b/test/alterschema/alterschema_transform_rules.h index 97444b880..b79cd5814 100644 --- a/test/alterschema/alterschema_transform_rules.h +++ b/test/alterschema/alterschema_transform_rules.h @@ -3,6 +3,7 @@ #include #include +#include class ExampleRule1 final : public sourcemeta::blaze::SchemaTransformRule { public: diff --git a/test/alterschema/alterschema_wrap_test.cc b/test/alterschema/alterschema_wrap_test.cc index fd8c37375..db3dab558 100644 --- a/test/alterschema/alterschema_wrap_test.cc +++ b/test/alterschema/alterschema_wrap_test.cc @@ -2,6 +2,7 @@ #include #include +#include #include #include // std::pair diff --git a/test/codegen/codegen_symbol_test.cc b/test/codegen/codegen_symbol_test.cc index 3adc03e95..8d2a687ee 100644 --- a/test/codegen/codegen_symbol_test.cc +++ b/test/codegen/codegen_symbol_test.cc @@ -3,6 +3,7 @@ #include #include +#include TEST(Codegen_symbol, nested_additional_properties_items) { const sourcemeta::core::JSON schema{sourcemeta::core::parse_json(R"JSON({ diff --git a/test/compiler/CMakeLists.txt b/test/compiler/CMakeLists.txt index 8b981436e..dcaa34d69 100644 --- a/test/compiler/CMakeLists.txt +++ b/test/compiler/CMakeLists.txt @@ -10,6 +10,8 @@ target_link_libraries(sourcemeta_blaze_compiler_unit PRIVATE sourcemeta::core::json) target_link_libraries(sourcemeta_blaze_compiler_unit PRIVATE sourcemeta::blaze::foundation) +target_link_libraries(sourcemeta_blaze_compiler_unit + PRIVATE sourcemeta::blaze::frame) target_link_libraries(sourcemeta_blaze_compiler_unit PRIVATE sourcemeta::blaze::compiler) target_link_libraries(sourcemeta_blaze_compiler_unit diff --git a/test/compiler/compiler_unevaluated_2019_09_test.cc b/test/compiler/compiler_unevaluated_2019_09_test.cc index c53be6464..7f8dd022d 100644 --- a/test/compiler/compiler_unevaluated_2019_09_test.cc +++ b/test/compiler/compiler_unevaluated_2019_09_test.cc @@ -1,6 +1,7 @@ #include #include +#include #include "compiler_test_utils.h" diff --git a/test/compiler/compiler_unevaluated_2020_12_test.cc b/test/compiler/compiler_unevaluated_2020_12_test.cc index 2fbf44e9c..27e18f87a 100644 --- a/test/compiler/compiler_unevaluated_2020_12_test.cc +++ b/test/compiler/compiler_unevaluated_2020_12_test.cc @@ -3,6 +3,7 @@ #include #include +#include #include #include diff --git a/test/editor/CMakeLists.txt b/test/editor/CMakeLists.txt index 275c75c87..f7b3c8bda 100644 --- a/test/editor/CMakeLists.txt +++ b/test/editor/CMakeLists.txt @@ -6,6 +6,8 @@ target_link_libraries(sourcemeta_blaze_editor_unit PRIVATE sourcemeta::core::json) target_link_libraries(sourcemeta_blaze_editor_unit PRIVATE sourcemeta::blaze::foundation) +target_link_libraries(sourcemeta_blaze_editor_unit + PRIVATE sourcemeta::blaze::frame) target_link_libraries(sourcemeta_blaze_editor_unit PRIVATE sourcemeta::blaze::bundle) target_link_libraries(sourcemeta_blaze_editor_unit diff --git a/test/evaluator/CMakeLists.txt b/test/evaluator/CMakeLists.txt index aac3f8186..484fa5146 100644 --- a/test/evaluator/CMakeLists.txt +++ b/test/evaluator/CMakeLists.txt @@ -16,6 +16,8 @@ target_link_libraries(sourcemeta_blaze_evaluator_unit PRIVATE sourcemeta::core::json) target_link_libraries(sourcemeta_blaze_evaluator_unit PRIVATE sourcemeta::blaze::foundation) +target_link_libraries(sourcemeta_blaze_evaluator_unit + PRIVATE sourcemeta::blaze::frame) target_link_libraries(sourcemeta_blaze_evaluator_unit PRIVATE sourcemeta::blaze::bundle) target_link_libraries(sourcemeta_blaze_evaluator_unit @@ -47,6 +49,7 @@ target_compile_definitions(sourcemeta_blaze_evaluator_annotation_suite_unit PRIVATE ANNOTATION_SUITE_PATH="${PROJECT_SOURCE_DIR}/vendor/jsonschema-test-suite/annotations/tests") target_link_libraries(sourcemeta_blaze_evaluator_annotation_suite_unit PRIVATE sourcemeta::core::json) target_link_libraries(sourcemeta_blaze_evaluator_annotation_suite_unit PRIVATE sourcemeta::blaze::foundation) +target_link_libraries(sourcemeta_blaze_evaluator_annotation_suite_unit PRIVATE sourcemeta::blaze::frame) target_link_libraries(sourcemeta_blaze_evaluator_annotation_suite_unit PRIVATE sourcemeta::core::jsonpointer) target_link_libraries(sourcemeta_blaze_evaluator_annotation_suite_unit PRIVATE sourcemeta::blaze::compiler) target_link_libraries(sourcemeta_blaze_evaluator_annotation_suite_unit PRIVATE sourcemeta::blaze::evaluator) diff --git a/test/evaluator/annotationsuite.cc b/test/evaluator/annotationsuite.cc index b6c418968..ae3c3651d 100644 --- a/test/evaluator/annotationsuite.cc +++ b/test/evaluator/annotationsuite.cc @@ -2,6 +2,7 @@ #include #include +#include #include #include diff --git a/test/evaluator/evaluator_test.cc b/test/evaluator/evaluator_test.cc index ca8f8bffe..d1e879e31 100644 --- a/test/evaluator/evaluator_test.cc +++ b/test/evaluator/evaluator_test.cc @@ -4,6 +4,7 @@ #include #include #include +#include #include diff --git a/test/foundation/CMakeLists.txt b/test/foundation/CMakeLists.txt index 9f44e1dee..854bb6b7d 100644 --- a/test/foundation/CMakeLists.txt +++ b/test/foundation/CMakeLists.txt @@ -1,7 +1,6 @@ sourcemeta_googletest(NAMESPACE sourcemeta PROJECT blaze NAME foundation FOLDER "Blaze/Foundation" SOURCES - foundation_test_utils.h foundation_identify_2020_12_test.cc foundation_identify_2019_09_test.cc foundation_identify_draft7_test.cc @@ -14,16 +13,6 @@ sourcemeta_googletest(NAMESPACE sourcemeta PROJECT blaze NAME foundation foundation_identify_test.cc foundation_is_schema_test.cc foundation_is_empty_schema_test.cc - foundation_frame_2020_12_test.cc - foundation_frame_2019_09_test.cc - foundation_frame_draft7_test.cc - foundation_frame_draft6_test.cc - foundation_frame_draft4_test.cc - foundation_frame_draft3_test.cc - foundation_frame_draft2_test.cc - foundation_frame_draft1_test.cc - foundation_frame_draft0_test.cc - foundation_frame_test.cc foundation_metaschema_test.cc foundation_dialect_test.cc foundation_dialect_2020_12_test.cc @@ -80,18 +69,3 @@ target_link_libraries(sourcemeta_blaze_foundation_unit PRIVATE sourcemeta::blaze::foundation) target_link_libraries(sourcemeta_blaze_foundation_unit PRIVATE sourcemeta::core::uri) - -if(MSVC) - target_compile_options(sourcemeta_blaze_foundation_unit PRIVATE /bigobj) -endif() - -# JSON Schema Referencing Suite -# See https://github.com/python-jsonschema/referencing-suite -sourcemeta_googletest(NAMESPACE sourcemeta PROJECT blaze NAME foundation_referencing_suite - SOURCES referencingsuite.cc) -target_compile_definitions(sourcemeta_blaze_foundation_referencing_suite_unit - PRIVATE REFERENCING_SUITE_PATH="${PROJECT_SOURCE_DIR}/vendor/referencing-suite/tests") -target_link_libraries(sourcemeta_blaze_foundation_referencing_suite_unit PRIVATE sourcemeta::core::uri) -target_link_libraries(sourcemeta_blaze_foundation_referencing_suite_unit PRIVATE sourcemeta::core::json) -target_link_libraries(sourcemeta_blaze_foundation_referencing_suite_unit PRIVATE sourcemeta::blaze::foundation) -target_link_libraries(sourcemeta_blaze_foundation_referencing_suite_unit PRIVATE sourcemeta::core::jsonpointer) diff --git a/test/foundation/foundation_test_utils.h b/test/foundation/foundation_test_utils.h index 8790419cb..e761b6f64 100644 --- a/test/foundation/foundation_test_utils.h +++ b/test/foundation/foundation_test_utils.h @@ -3,9 +3,7 @@ #include #include -#include #include -#include #define EXPECT_VOCABULARY_KNOWN(vocabulary_value, expected_known) \ EXPECT_TRUE(std::holds_alternative( \ @@ -50,271 +48,6 @@ #define TO_POINTER(pointer_string) \ sourcemeta::core::to_pointer((pointer_string)) -#define EXPECT_FRAME(frame, expected_type, reference, root_id, \ - expected_pointer, expected_dialect, \ - expected_base_dialect, expected_base, \ - expected_relative_pointer, expected_parent, \ - expected_property_name, expected_orphan) \ - EXPECT_TRUE((frame).locations().contains({(expected_type), (reference)})); \ - EXPECT_EQ((frame).root(), (root_id)); \ - EXPECT_EQ( \ - sourcemeta::core::to_string( \ - (frame).locations().at({(expected_type), (reference)}).pointer), \ - (expected_pointer)); \ - EXPECT_EQ((frame).locations().at({(expected_type), (reference)}).dialect, \ - (expected_dialect)); \ - EXPECT_EQ((frame).locations().at({(expected_type), (reference)}).base, \ - (expected_base)); \ - EXPECT_TRUE( \ - (frame) \ - .traverse( \ - (frame).locations().at({(expected_type), (reference)}).base) \ - .has_value()); \ - EXPECT_EQ( \ - (frame).locations().at({(expected_type), (reference)}).base_dialect, \ - sourcemeta::blaze::SchemaBaseDialect::expected_base_dialect); \ - EXPECT_EQ(sourcemeta::core::to_string((frame).relative_instance_location( \ - (frame).locations().at({(expected_type), (reference)}))), \ - (expected_relative_pointer)); \ - EXPECT_OPTIONAL_POINTER( \ - (frame).locations().at({(expected_type), (reference)}).parent, \ - expected_parent); \ - EXPECT_EQ( \ - (frame).locations().at({(expected_type), (reference)}).property_name, \ - (expected_property_name)); \ - EXPECT_EQ((frame).locations().at({(expected_type), (reference)}).orphan, \ - (expected_orphan)); - -#define EXPECT_FRAME_STATIC( \ - frame, reference, root_id, expected_pointer, expected_dialect, \ - expected_base_dialect, expected_base, expected_relative_pointer, \ - expected_parent, expected_property_name, expected_orphan) \ - EXPECT_FRAME(frame, sourcemeta::blaze::SchemaReferenceType::Static, \ - reference, root_id, expected_pointer, expected_dialect, \ - expected_base_dialect, expected_base, \ - expected_relative_pointer, expected_parent, \ - expected_property_name, expected_orphan) - -#define EXPECT_FRAME_STATIC_RESOURCE( \ - frame, reference, root_id, expected_pointer, expected_dialect, \ - expected_base_dialect, expected_base, expected_relative_pointer, \ - expected_parent, expected_property_name, expected_orphan) \ - EXPECT_FRAME_STATIC(frame, reference, root_id, expected_pointer, \ - expected_dialect, expected_base_dialect, expected_base, \ - expected_relative_pointer, expected_parent, \ - expected_property_name, expected_orphan) \ - EXPECT_EQ( \ - (frame) \ - .locations() \ - .at({sourcemeta::blaze::SchemaReferenceType::Static, (reference)}) \ - .type, \ - sourcemeta::blaze::SchemaFrame::LocationType::Resource); - -#define EXPECT_FRAME_STATIC_POINTER( \ - frame, reference, root_id, expected_pointer, expected_dialect, \ - expected_base_dialect, expected_base, expected_relative_pointer, \ - expected_parent, expected_property_name, expected_orphan) \ - EXPECT_FRAME_STATIC(frame, reference, root_id, expected_pointer, \ - expected_dialect, expected_base_dialect, expected_base, \ - expected_relative_pointer, expected_parent, \ - expected_property_name, expected_orphan) \ - EXPECT_EQ( \ - (frame) \ - .locations() \ - .at({sourcemeta::blaze::SchemaReferenceType::Static, (reference)}) \ - .type, \ - sourcemeta::blaze::SchemaFrame::LocationType::Pointer); - -#define EXPECT_FRAME_STATIC_SUBSCHEMA( \ - frame, reference, root_id, expected_pointer, expected_dialect, \ - expected_base_dialect, expected_base, expected_relative_pointer, \ - expected_parent, expected_property_name, expected_orphan) \ - EXPECT_FRAME_STATIC(frame, reference, root_id, expected_pointer, \ - expected_dialect, expected_base_dialect, expected_base, \ - expected_relative_pointer, expected_parent, \ - expected_property_name, expected_orphan) \ - EXPECT_EQ( \ - (frame) \ - .locations() \ - .at({sourcemeta::blaze::SchemaReferenceType::Static, (reference)}) \ - .type, \ - sourcemeta::blaze::SchemaFrame::LocationType::Subschema); - -#define EXPECT_FRAME_STATIC_ANCHOR( \ - frame, reference, root_id, expected_pointer, expected_dialect, \ - expected_base_dialect, expected_base, expected_relative_pointer, \ - expected_parent, expected_property_name, expected_orphan) \ - EXPECT_FRAME_STATIC(frame, reference, root_id, expected_pointer, \ - expected_dialect, expected_base_dialect, expected_base, \ - expected_relative_pointer, expected_parent, \ - expected_property_name, expected_orphan) \ - EXPECT_EQ( \ - (frame) \ - .locations() \ - .at({sourcemeta::blaze::SchemaReferenceType::Static, (reference)}) \ - .type, \ - sourcemeta::blaze::SchemaFrame::LocationType::Anchor); - -#define EXPECT_FRAME_DYNAMIC_ANCHOR( \ - frame, reference, root_id, expected_pointer, expected_dialect, \ - expected_base_dialect, expected_base, expected_relative_pointer, \ - expected_parent, expected_property_name, expected_orphan) \ - EXPECT_FRAME_DYNAMIC(frame, reference, root_id, expected_pointer, \ - expected_dialect, expected_base_dialect, expected_base, \ - expected_relative_pointer, expected_parent, \ - expected_property_name, expected_orphan) \ - EXPECT_EQ( \ - (frame) \ - .locations() \ - .at({sourcemeta::blaze::SchemaReferenceType::Dynamic, (reference)}) \ - .type, \ - sourcemeta::blaze::SchemaFrame::LocationType::Anchor); - -#define EXPECT_FRAME_DYNAMIC( \ - frame, reference, root_id, expected_pointer, expected_dialect, \ - expected_base_dialect, expected_base, expected_relative_pointer, \ - expected_parent, expected_property_name, expected_orphan) \ - EXPECT_FRAME(frame, sourcemeta::blaze::SchemaReferenceType::Dynamic, \ - reference, root_id, expected_pointer, expected_dialect, \ - expected_base_dialect, expected_base, \ - expected_relative_pointer, expected_parent, \ - expected_property_name, expected_orphan) - -#define __EXPECT_ANONYMOUS_FRAME(frame, expected_type, reference, \ - expected_pointer, expected_dialect, \ - expected_base_dialect, expected_parent, \ - expected_property_name, expected_orphan) \ - EXPECT_TRUE((frame).locations().contains({(expected_type), (reference)})); \ - EXPECT_TRUE((frame).root().empty()); \ - EXPECT_EQ( \ - sourcemeta::core::to_string( \ - (frame).locations().at({(expected_type), (reference)}).pointer), \ - (expected_pointer)); \ - EXPECT_EQ((frame).locations().at({(expected_type), (reference)}).dialect, \ - (expected_dialect)); \ - EXPECT_EQ( \ - (frame).locations().at({(expected_type), (reference)}).base_dialect, \ - sourcemeta::blaze::SchemaBaseDialect::expected_base_dialect); \ - EXPECT_OPTIONAL_POINTER( \ - (frame).locations().at({(expected_type), (reference)}).parent, \ - expected_parent); \ - EXPECT_EQ( \ - (frame).locations().at({(expected_type), (reference)}).property_name, \ - (expected_property_name)); \ - EXPECT_EQ((frame).locations().at({(expected_type), (reference)}).orphan, \ - (expected_orphan)); - -#define EXPECT_ANONYMOUS_FRAME_STATIC(frame, reference, expected_pointer, \ - expected_dialect, expected_base_dialect, \ - expected_parent, expected_property_name, \ - expected_orphan) \ - __EXPECT_ANONYMOUS_FRAME( \ - frame, sourcemeta::blaze::SchemaReferenceType::Static, reference, \ - expected_pointer, expected_dialect, expected_base_dialect, \ - expected_parent, expected_property_name, expected_orphan) - -#define EXPECT_ANONYMOUS_FRAME_STATIC_RESOURCE( \ - frame, reference, expected_pointer, expected_dialect, \ - expected_base_dialect, expected_parent, expected_property_name, \ - expected_orphan) \ - __EXPECT_ANONYMOUS_FRAME( \ - frame, sourcemeta::blaze::SchemaReferenceType::Static, reference, \ - expected_pointer, expected_dialect, expected_base_dialect, \ - expected_parent, expected_property_name, expected_orphan) \ - EXPECT_EQ( \ - (frame) \ - .locations() \ - .at({sourcemeta::blaze::SchemaReferenceType::Static, (reference)}) \ - .type, \ - sourcemeta::blaze::SchemaFrame::LocationType::Resource); - -#define EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( \ - frame, reference, expected_pointer, expected_dialect, \ - expected_base_dialect, expected_parent, expected_property_name, \ - expected_orphan) \ - __EXPECT_ANONYMOUS_FRAME( \ - frame, sourcemeta::blaze::SchemaReferenceType::Static, reference, \ - expected_pointer, expected_dialect, expected_base_dialect, \ - expected_parent, expected_property_name, expected_orphan) \ - EXPECT_EQ( \ - (frame) \ - .locations() \ - .at({sourcemeta::blaze::SchemaReferenceType::Static, (reference)}) \ - .type, \ - sourcemeta::blaze::SchemaFrame::LocationType::Pointer); - -#define EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( \ - frame, reference, expected_pointer, expected_dialect, \ - expected_base_dialect, expected_parent, expected_property_name, \ - expected_orphan) \ - __EXPECT_ANONYMOUS_FRAME( \ - frame, sourcemeta::blaze::SchemaReferenceType::Static, reference, \ - expected_pointer, expected_dialect, expected_base_dialect, \ - expected_parent, expected_property_name, expected_orphan) \ - EXPECT_EQ( \ - (frame) \ - .locations() \ - .at({sourcemeta::blaze::SchemaReferenceType::Static, (reference)}) \ - .type, \ - sourcemeta::blaze::SchemaFrame::LocationType::Subschema); - -#define EXPECT_ANONYMOUS_FRAME_STATIC_ANCHOR( \ - frame, reference, expected_pointer, expected_dialect, \ - expected_base_dialect, expected_parent, expected_property_name, \ - expected_orphan) \ - __EXPECT_ANONYMOUS_FRAME( \ - frame, sourcemeta::blaze::SchemaReferenceType::Static, reference, \ - expected_pointer, expected_dialect, expected_base_dialect, \ - expected_parent, expected_property_name, expected_orphan) \ - EXPECT_EQ( \ - (frame) \ - .locations() \ - .at({sourcemeta::blaze::SchemaReferenceType::Static, (reference)}) \ - .type, \ - sourcemeta::blaze::SchemaFrame::LocationType::Anchor); - -#define EXPECT_ANONYMOUS_FRAME_DYNAMIC_ANCHOR( \ - frame, reference, expected_pointer, expected_dialect, \ - expected_base_dialect, expected_parent, expected_property_name, \ - expected_orphan) \ - __EXPECT_ANONYMOUS_FRAME( \ - frame, sourcemeta::blaze::SchemaReferenceType::Dynamic, reference, \ - expected_pointer, expected_dialect, expected_base_dialect, \ - expected_parent, expected_property_name, expected_orphan) \ - EXPECT_EQ( \ - (frame) \ - .locations() \ - .at({sourcemeta::blaze::SchemaReferenceType::Dynamic, (reference)}) \ - .type, \ - sourcemeta::blaze::SchemaFrame::LocationType::Anchor); - -#define EXPECT_REFERENCE(frame, expected_type, expected_pointer, expected_uri, \ - expected_base, expected_fragment, expected_original) \ - { \ - const auto __ref_pointer{TO_POINTER(expected_pointer)}; \ - const auto __ref_entry{(frame).reference( \ - expected_type, sourcemeta::core::to_weak_pointer(__ref_pointer))}; \ - EXPECT_TRUE(__ref_entry.has_value()); \ - EXPECT_EQ(__ref_entry->get().destination, (expected_uri)); \ - EXPECT_EQ(__ref_entry->get().base, (expected_base)); \ - EXPECT_EQ(__ref_entry->get().fragment, (expected_fragment)); \ - EXPECT_EQ(__ref_entry->get().original, (expected_original)); \ - } - -#define EXPECT_STATIC_REFERENCE(frame, expected_pointer, expected_uri, \ - expected_base, expected_fragment, \ - expected_original) \ - EXPECT_REFERENCE(frame, sourcemeta::blaze::SchemaReferenceType::Static, \ - expected_pointer, expected_uri, expected_base, \ - expected_fragment, expected_original) - -#define EXPECT_DYNAMIC_REFERENCE(frame, expected_pointer, expected_uri, \ - expected_base, expected_fragment, \ - expected_original) \ - EXPECT_REFERENCE(frame, sourcemeta::blaze::SchemaReferenceType::Dynamic, \ - expected_pointer, expected_uri, expected_base, \ - expected_fragment, expected_original) - #define __EXPECT_WALKER_ENTRY(entries, index, expected_schema_location, \ expected_parent_location, expected_dialect, \ expected_base_dialect) \ @@ -484,35 +217,4 @@ "http://json-schema.org/draft-00/hyper-schema#"); \ EXPECT_TRUE(entries.at(index).orphan); -#define EXPECT_REFERENCE_TO(result, index, type, origin) \ - EXPECT_EQ((result).at((index)).get().first.first, \ - sourcemeta::blaze::SchemaReferenceType::type); \ - EXPECT_EQ( \ - sourcemeta::core::to_string((result).at((index)).get().first.second), \ - (origin)); - -#define EXPECT_FRAME_LOCATION_REACHABLE(frame, reference_type, reference, \ - base) \ - EXPECT_TRUE((frame).locations().contains( \ - {sourcemeta::blaze::SchemaReferenceType::reference_type, (reference)})); \ - EXPECT_TRUE((frame).traverse((base)).has_value()); \ - EXPECT_TRUE((frame).is_reachable( \ - (frame).traverse((base))->get(), \ - (frame).locations().at( \ - {sourcemeta::blaze::SchemaReferenceType::reference_type, \ - (reference)}), \ - sourcemeta::blaze::schema_walker, sourcemeta::blaze::schema_resolver)) - -#define EXPECT_FRAME_LOCATION_NON_REACHABLE(frame, reference_type, reference, \ - base) \ - EXPECT_TRUE((frame).locations().contains( \ - {sourcemeta::blaze::SchemaReferenceType::reference_type, (reference)})); \ - EXPECT_TRUE((frame).traverse((base)).has_value()); \ - EXPECT_FALSE((frame).is_reachable( \ - (frame).traverse((base))->get(), \ - (frame).locations().at( \ - {sourcemeta::blaze::SchemaReferenceType::reference_type, \ - (reference)}), \ - sourcemeta::blaze::schema_walker, sourcemeta::blaze::schema_resolver)) - #endif diff --git a/test/frame/CMakeLists.txt b/test/frame/CMakeLists.txt new file mode 100644 index 000000000..0d8db13c1 --- /dev/null +++ b/test/frame/CMakeLists.txt @@ -0,0 +1,39 @@ +sourcemeta_googletest(NAMESPACE sourcemeta PROJECT blaze NAME frame + FOLDER "Blaze/Frame" + SOURCES + frame_test_utils.h + frame_2020_12_test.cc + frame_2019_09_test.cc + frame_draft7_test.cc + frame_draft6_test.cc + frame_draft4_test.cc + frame_draft3_test.cc + frame_draft2_test.cc + frame_draft1_test.cc + frame_draft0_test.cc + frame_test.cc) + +target_link_libraries(sourcemeta_blaze_frame_unit + PRIVATE sourcemeta::core::json) +target_link_libraries(sourcemeta_blaze_frame_unit + PRIVATE sourcemeta::core::jsonpointer) +target_link_libraries(sourcemeta_blaze_frame_unit + PRIVATE sourcemeta::blaze::foundation) +target_link_libraries(sourcemeta_blaze_frame_unit + PRIVATE sourcemeta::blaze::frame) + +if(MSVC) + target_compile_options(sourcemeta_blaze_frame_unit PRIVATE /bigobj) +endif() + +# JSON Schema Referencing Suite +# See https://github.com/python-jsonschema/referencing-suite +sourcemeta_googletest(NAMESPACE sourcemeta PROJECT blaze NAME frame_referencing_suite + SOURCES referencingsuite.cc) +target_compile_definitions(sourcemeta_blaze_frame_referencing_suite_unit + PRIVATE REFERENCING_SUITE_PATH="${PROJECT_SOURCE_DIR}/vendor/referencing-suite/tests") +target_link_libraries(sourcemeta_blaze_frame_referencing_suite_unit PRIVATE sourcemeta::core::uri) +target_link_libraries(sourcemeta_blaze_frame_referencing_suite_unit PRIVATE sourcemeta::core::json) +target_link_libraries(sourcemeta_blaze_frame_referencing_suite_unit PRIVATE sourcemeta::blaze::foundation) +target_link_libraries(sourcemeta_blaze_frame_referencing_suite_unit PRIVATE sourcemeta::blaze::frame) +target_link_libraries(sourcemeta_blaze_frame_referencing_suite_unit PRIVATE sourcemeta::core::jsonpointer) diff --git a/test/foundation/foundation_frame_2019_09_test.cc b/test/frame/frame_2019_09_test.cc similarity index 97% rename from test/foundation/foundation_frame_2019_09_test.cc rename to test/frame/frame_2019_09_test.cc index 1895fe119..8fed2e0ba 100644 --- a/test/foundation/foundation_frame_2019_09_test.cc +++ b/test/frame/frame_2019_09_test.cc @@ -1,10 +1,11 @@ #include #include +#include #include #include -#include "foundation_test_utils.h" +#include "frame_test_utils.h" #define EXPECT_FRAME_STATIC_2019_09_POINTER( \ frame, reference, root_id, expected_pointer, expected_base, \ @@ -56,7 +57,7 @@ expected_relative_pointer, expected_parent, \ expected_property_name, expected_orphan); -TEST(Foundation_frame_2019_09, anonymous_with_nested_schema_resource) { +TEST(Frame_2019_09, anonymous_with_nested_schema_resource) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2019-09/schema", "additionalProperties": { "$id": "https://example.com" } @@ -120,7 +121,7 @@ TEST(Foundation_frame_2019_09, anonymous_with_nested_schema_resource) { "https://example.com"); } -TEST(Foundation_frame_2019_09, empty_schema) { +TEST(Frame_2019_09, empty_schema) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://www.sourcemeta.com/schema", "$schema": "https://json-schema.org/draft/2019-09/schema" @@ -163,7 +164,7 @@ TEST(Foundation_frame_2019_09, empty_schema) { frame, Static, "https://www.sourcemeta.com/schema", frame.root()); } -TEST(Foundation_frame_2019_09, empty_schema_trailing_hash) { +TEST(Frame_2019_09, empty_schema_trailing_hash) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://www.sourcemeta.com/schema#", "$schema": "https://json-schema.org/draft/2019-09/schema" @@ -206,7 +207,7 @@ TEST(Foundation_frame_2019_09, empty_schema_trailing_hash) { frame, Static, "https://www.sourcemeta.com/schema", frame.root()); } -TEST(Foundation_frame_2019_09, one_level_applicators_without_identifiers) { +TEST(Frame_2019_09, one_level_applicators_without_identifiers) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://www.sourcemeta.com/schema", "$schema": "https://json-schema.org/draft/2019-09/schema", @@ -300,7 +301,7 @@ TEST(Foundation_frame_2019_09, one_level_applicators_without_identifiers) { "https://www.sourcemeta.com/schema#/properties/foo"); } -TEST(Foundation_frame_2019_09, one_level_applicators_with_identifiers) { +TEST(Frame_2019_09, one_level_applicators_with_identifiers) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://www.sourcemeta.com/test/qux", "$schema": "https://json-schema.org/draft/2019-09/schema", @@ -433,7 +434,7 @@ TEST(Foundation_frame_2019_09, one_level_applicators_with_identifiers) { "https://www.sourcemeta.com/test/qux#/properties/foo"); } -TEST(Foundation_frame_2019_09, subschema_absolute_identifier) { +TEST(Frame_2019_09, subschema_absolute_identifier) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://www.sourcemeta.com/schema", "$schema": "https://json-schema.org/draft/2019-09/schema", @@ -518,7 +519,7 @@ TEST(Foundation_frame_2019_09, subschema_absolute_identifier) { "https://www.sourcemeta.com/foo"); } -TEST(Foundation_frame_2019_09, nested_schemas) { +TEST(Frame_2019_09, nested_schemas) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://www.sourcemeta.com/schema", "$schema": "https://json-schema.org/draft/2019-09/schema", @@ -789,7 +790,7 @@ TEST(Foundation_frame_2019_09, nested_schemas) { "https://www.sourcemeta.com/qux"); } -TEST(Foundation_frame_2019_09, id_override) { +TEST(Frame_2019_09, id_override) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://www.sourcemeta.com/schema", "$schema": "https://json-schema.org/draft/2019-09/schema", @@ -803,7 +804,7 @@ TEST(Foundation_frame_2019_09, id_override) { sourcemeta::blaze::SchemaFrameError); } -TEST(Foundation_frame_2019_09, static_anchor_override) { +TEST(Frame_2019_09, static_anchor_override) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://www.sourcemeta.com/schema", "$schema": "https://json-schema.org/draft/2019-09/schema", @@ -826,7 +827,7 @@ TEST(Foundation_frame_2019_09, static_anchor_override) { } } -TEST(Foundation_frame_2019_09, explicit_argument_id_same) { +TEST(Frame_2019_09, explicit_argument_id_same) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://www.sourcemeta.com/schema", "$schema": "https://json-schema.org/draft/2019-09/schema" @@ -871,7 +872,7 @@ TEST(Foundation_frame_2019_09, explicit_argument_id_same) { frame, Static, "https://www.sourcemeta.com/schema", frame.root()); } -TEST(Foundation_frame_2019_09, anchor_top_level) { +TEST(Frame_2019_09, anchor_top_level) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://www.sourcemeta.com/schema", "$schema": "https://json-schema.org/draft/2019-09/schema", @@ -926,7 +927,7 @@ TEST(Foundation_frame_2019_09, anchor_top_level) { frame, Static, "https://www.sourcemeta.com/schema#foo", frame.root()); } -TEST(Foundation_frame_2019_09, explicit_argument_id_different) { +TEST(Frame_2019_09, explicit_argument_id_different) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://www.sourcemeta.com/schema", "$schema": "https://json-schema.org/draft/2019-09/schema", @@ -1109,7 +1110,7 @@ TEST(Foundation_frame_2019_09, explicit_argument_id_different) { frame, Static, "https://www.example.com#/properties/two", frame.root()); } -TEST(Foundation_frame_2019_09, ref_metaschema) { +TEST(Frame_2019_09, ref_metaschema) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2019-09/schema", "$ref": "https://json-schema.org/draft/2019-09/schema" @@ -1151,7 +1152,7 @@ TEST(Foundation_frame_2019_09, ref_metaschema) { EXPECT_FRAME_LOCATION_REACHABLE(frame, Static, "", frame.root()); } -TEST(Foundation_frame_2019_09, location_independent_identifier_anonymous) { +TEST(Frame_2019_09, location_independent_identifier_anonymous) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2019-09/schema", "$defs": { @@ -1178,7 +1179,7 @@ TEST(Foundation_frame_2019_09, location_independent_identifier_anonymous) { } } -TEST(Foundation_frame_2019_09, recursive_anchor_true_with_id) { +TEST(Frame_2019_09, recursive_anchor_true_with_id) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://www.sourcemeta.com/schema", "$schema": "https://json-schema.org/draft/2019-09/schema", @@ -1239,7 +1240,7 @@ TEST(Foundation_frame_2019_09, recursive_anchor_true_with_id) { frame, Static, "https://www.sourcemeta.com/schema", frame.root()); } -TEST(Foundation_frame_2019_09, recursive_anchor_false_with_id) { +TEST(Frame_2019_09, recursive_anchor_false_with_id) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://www.sourcemeta.com/schema", "$schema": "https://json-schema.org/draft/2019-09/schema", @@ -1291,7 +1292,7 @@ TEST(Foundation_frame_2019_09, recursive_anchor_false_with_id) { frame, Static, "https://www.sourcemeta.com/schema", frame.root()); } -TEST(Foundation_frame_2019_09, recursive_anchor_true_without_id) { +TEST(Frame_2019_09, recursive_anchor_true_without_id) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2019-09/schema", "properties": { @@ -1355,7 +1356,7 @@ TEST(Foundation_frame_2019_09, recursive_anchor_true_without_id) { frame.root()); } -TEST(Foundation_frame_2019_09, recursive_anchor_false_without_id) { +TEST(Frame_2019_09, recursive_anchor_false_without_id) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2019-09/schema", "properties": { @@ -1411,7 +1412,7 @@ TEST(Foundation_frame_2019_09, recursive_anchor_false_without_id) { frame.root()); } -TEST(Foundation_frame_2019_09, recursive_ref_no_recursive_anchor_anonymous) { +TEST(Frame_2019_09, recursive_ref_no_recursive_anchor_anonymous) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2019-09/schema", "additionalItems": { @@ -1465,7 +1466,7 @@ TEST(Foundation_frame_2019_09, recursive_ref_no_recursive_anchor_anonymous) { "#/additionalItems"); } -TEST(Foundation_frame_2019_09, recursive_ref_no_recursive_anchor) { +TEST(Frame_2019_09, recursive_ref_no_recursive_anchor) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://www.sourcemeta.com/schema", "$schema": "https://json-schema.org/draft/2019-09/schema", @@ -1534,7 +1535,7 @@ TEST(Foundation_frame_2019_09, recursive_ref_no_recursive_anchor) { "https://www.sourcemeta.com/schema#/additionalItems"); } -TEST(Foundation_frame_2019_09, recursive_ref_recursive_anchor_false_anonymous) { +TEST(Frame_2019_09, recursive_ref_recursive_anchor_false_anonymous) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2019-09/schema", "$recursiveAnchor": false, @@ -1593,7 +1594,7 @@ TEST(Foundation_frame_2019_09, recursive_ref_recursive_anchor_false_anonymous) { "#/additionalItems"); } -TEST(Foundation_frame_2019_09, recursive_ref_recursive_anchor_false) { +TEST(Frame_2019_09, recursive_ref_recursive_anchor_false) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://www.sourcemeta.com/schema", "$schema": "https://json-schema.org/draft/2019-09/schema", @@ -1668,7 +1669,7 @@ TEST(Foundation_frame_2019_09, recursive_ref_recursive_anchor_false) { "https://www.sourcemeta.com/schema#/additionalItems"); } -TEST(Foundation_frame_2019_09, recursive_ref_recursive_anchor_true_anonymous) { +TEST(Frame_2019_09, recursive_ref_recursive_anchor_true_anonymous) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2019-09/schema", "$recursiveAnchor": true, @@ -1735,7 +1736,7 @@ TEST(Foundation_frame_2019_09, recursive_ref_recursive_anchor_true_anonymous) { "#/additionalItems"); } -TEST(Foundation_frame_2019_09, recursive_ref_recursive_anchor_true) { +TEST(Frame_2019_09, recursive_ref_recursive_anchor_true) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://www.sourcemeta.com/schema", "$schema": "https://json-schema.org/draft/2019-09/schema", @@ -1822,8 +1823,7 @@ TEST(Foundation_frame_2019_09, recursive_ref_recursive_anchor_true) { "https://www.sourcemeta.com/schema#/additionalItems"); } -TEST(Foundation_frame_2019_09, - recursive_ref_recursive_anchor_false_anonymous_nested) { +TEST(Frame_2019_09, recursive_ref_recursive_anchor_false_anonymous_nested) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2019-09/schema", "additionalItems": { @@ -1911,8 +1911,7 @@ TEST(Foundation_frame_2019_09, "https://example.com"); } -TEST(Foundation_frame_2019_09, - recursive_ref_recursive_anchor_true_anonymous_nested) { +TEST(Frame_2019_09, recursive_ref_recursive_anchor_true_anonymous_nested) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2019-09/schema", "additionalItems": { @@ -2011,7 +2010,7 @@ TEST(Foundation_frame_2019_09, "https://example.com"); } -TEST(Foundation_frame_2019_09, recursive_ref_nested_recursive_anchor_true) { +TEST(Frame_2019_09, recursive_ref_nested_recursive_anchor_true) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://www.sourcemeta.com/schema", "$schema": "https://json-schema.org/draft/2019-09/schema", @@ -2100,7 +2099,7 @@ TEST(Foundation_frame_2019_09, recursive_ref_nested_recursive_anchor_true) { "https://www.sourcemeta.com/schema#/additionalItems"); } -TEST(Foundation_frame_2019_09, recursive_ref_multiple_recursive_anchor_true) { +TEST(Frame_2019_09, recursive_ref_multiple_recursive_anchor_true) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://www.sourcemeta.com/schema", "$schema": "https://json-schema.org/draft/2019-09/schema", @@ -2227,7 +2226,7 @@ TEST(Foundation_frame_2019_09, recursive_ref_multiple_recursive_anchor_true) { "https://www.sourcemeta.com/nested"); } -TEST(Foundation_frame_2019_09, recursive_anchor_conflict) { +TEST(Frame_2019_09, recursive_anchor_conflict) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://www.sourcemeta.com/schema", "$schema": "https://json-schema.org/draft/2019-09/schema", @@ -2252,7 +2251,7 @@ TEST(Foundation_frame_2019_09, recursive_anchor_conflict) { } } -TEST(Foundation_frame_2019_09, invalid_recursive_ref) { +TEST(Frame_2019_09, invalid_recursive_ref) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://www.sourcemeta.com/schema", "$schema": "https://json-schema.org/draft/2019-09/schema", @@ -2274,7 +2273,7 @@ TEST(Foundation_frame_2019_09, invalid_recursive_ref) { } } -TEST(Foundation_frame_2019_09, recursive_anchor_on_relative_id) { +TEST(Frame_2019_09, recursive_anchor_on_relative_id) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2019-09/schema", "$recursiveAnchor": true, @@ -2364,7 +2363,7 @@ TEST(Foundation_frame_2019_09, recursive_anchor_on_relative_id) { EXPECT_FRAME_LOCATION_REACHABLE(frame, Dynamic, "middle", "middle"); } -TEST(Foundation_frame_2019_09, ref_with_id) { +TEST(Frame_2019_09, ref_with_id) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://www.sourcemeta.com/schema", "$schema": "https://json-schema.org/draft/2019-09/schema", @@ -2442,7 +2441,7 @@ TEST(Foundation_frame_2019_09, ref_with_id) { "https://www.sourcemeta.com/schema#/$defs/string"); } -TEST(Foundation_frame_2019_09, ref_from_definitions) { +TEST(Frame_2019_09, ref_from_definitions) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://www.sourcemeta.com/schema", "$schema": "https://json-schema.org/draft/2019-09/schema", @@ -2554,7 +2553,7 @@ TEST(Foundation_frame_2019_09, ref_from_definitions) { "https://www.sourcemeta.com/schema#/definitions/string"); } -TEST(Foundation_frame_2019_09, relative_base_uri_without_ref) { +TEST(Frame_2019_09, relative_base_uri_without_ref) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2019-09/schema", "$id": "common" @@ -2592,7 +2591,7 @@ TEST(Foundation_frame_2019_09, relative_base_uri_without_ref) { EXPECT_FRAME_LOCATION_REACHABLE(frame, Static, "common", frame.root()); } -TEST(Foundation_frame_2019_09, relative_base_uri_with_ref) { +TEST(Frame_2019_09, relative_base_uri_with_ref) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2019-09/schema", "$id": "common", @@ -2666,7 +2665,7 @@ TEST(Foundation_frame_2019_09, relative_base_uri_with_ref) { frame.root()); } -TEST(Foundation_frame_2019_09, relative_id_leading_slash) { +TEST(Frame_2019_09, relative_id_leading_slash) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "/base", "$schema": "https://json-schema.org/draft/2019-09/schema" @@ -2703,8 +2702,7 @@ TEST(Foundation_frame_2019_09, relative_id_leading_slash) { EXPECT_FRAME_LOCATION_REACHABLE(frame, Static, "/base", frame.root()); } -TEST(Foundation_frame_2019_09, - ref_does_not_invalidate_sibling_subschemas_and_refs) { +TEST(Frame_2019_09, ref_does_not_invalidate_sibling_subschemas_and_refs) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2019-09/schema", "properties": { @@ -2802,7 +2800,7 @@ TEST(Foundation_frame_2019_09, frame.root()); } -TEST(Foundation_frame_2019_09, propertyNames_with_nested_applicators) { +TEST(Frame_2019_09, propertyNames_with_nested_applicators) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2019-09/schema", "$anchor": "outer", @@ -2962,7 +2960,7 @@ TEST(Foundation_frame_2019_09, propertyNames_with_nested_applicators) { EXPECT_FRAME_LOCATION_REACHABLE(frame, Static, "#other", frame.root()); } -TEST(Foundation_frame_2019_09, invalid_recursive_anchor_not_boolean) { +TEST(Frame_2019_09, invalid_recursive_anchor_not_boolean) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2019-09/schema", "$recursiveAnchor": "foo" @@ -2983,7 +2981,7 @@ TEST(Foundation_frame_2019_09, invalid_recursive_anchor_not_boolean) { } } -TEST(Foundation_frame_2019_09, invalid_recursive_ref_not_string) { +TEST(Frame_2019_09, invalid_recursive_ref_not_string) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2019-09/schema", "$recursiveRef": 123 @@ -3004,7 +3002,7 @@ TEST(Foundation_frame_2019_09, invalid_recursive_ref_not_string) { } } -TEST(Foundation_frame_2019_09, ref_from_def_to_sibling_def) { +TEST(Frame_2019_09, ref_from_def_to_sibling_def) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2019-09/schema", "$defs": { @@ -3104,7 +3102,7 @@ TEST(Foundation_frame_2019_09, ref_from_def_to_sibling_def) { EXPECT_FRAME_LOCATION_REACHABLE(frame, Static, "#/$defs/bar", "#/$defs/bar"); } -TEST(Foundation_frame_2019_09, anchor_with_invalid_format_empty) { +TEST(Frame_2019_09, anchor_with_invalid_format_empty) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2019-09/schema", "$anchor": "" @@ -3125,7 +3123,7 @@ TEST(Foundation_frame_2019_09, anchor_with_invalid_format_empty) { } } -TEST(Foundation_frame_2019_09, anchor_with_invalid_format_leading_digit) { +TEST(Frame_2019_09, anchor_with_invalid_format_leading_digit) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2019-09/schema", "$anchor": "1foo" @@ -3146,7 +3144,7 @@ TEST(Foundation_frame_2019_09, anchor_with_invalid_format_leading_digit) { } } -TEST(Foundation_frame_2019_09, anchor_with_invalid_format_leading_underscore) { +TEST(Frame_2019_09, anchor_with_invalid_format_leading_underscore) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2019-09/schema", "$anchor": "_foo" @@ -3167,7 +3165,7 @@ TEST(Foundation_frame_2019_09, anchor_with_invalid_format_leading_underscore) { } } -TEST(Foundation_frame_2019_09, anchor_with_invalid_format_whitespace) { +TEST(Frame_2019_09, anchor_with_invalid_format_whitespace) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2019-09/schema", "$anchor": "foo bar" @@ -3188,7 +3186,7 @@ TEST(Foundation_frame_2019_09, anchor_with_invalid_format_whitespace) { } } -TEST(Foundation_frame_2019_09, anchor_with_invalid_format_punctuation) { +TEST(Frame_2019_09, anchor_with_invalid_format_punctuation) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2019-09/schema", "$anchor": "foo!bar" @@ -3209,7 +3207,7 @@ TEST(Foundation_frame_2019_09, anchor_with_invalid_format_punctuation) { } } -TEST(Foundation_frame_2019_09, anchor_with_valid_colon) { +TEST(Frame_2019_09, anchor_with_valid_colon) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://www.sourcemeta.com/schema", "$schema": "https://json-schema.org/draft/2019-09/schema", @@ -3264,7 +3262,7 @@ TEST(Foundation_frame_2019_09, anchor_with_valid_colon) { frame, Static, "https://www.sourcemeta.com/schema#foo:bar", frame.root()); } -TEST(Foundation_frame_2019_09, top_level_id_absolute_with_non_empty_fragment) { +TEST(Frame_2019_09, top_level_id_absolute_with_non_empty_fragment) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://www.sourcemeta.com/schema#foo", "$schema": "https://json-schema.org/draft/2019-09/schema" @@ -3284,7 +3282,7 @@ TEST(Foundation_frame_2019_09, top_level_id_absolute_with_non_empty_fragment) { } } -TEST(Foundation_frame_2019_09, nested_id_absolute_with_non_empty_fragment) { +TEST(Frame_2019_09, nested_id_absolute_with_non_empty_fragment) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://www.sourcemeta.com/schema", "$schema": "https://json-schema.org/draft/2019-09/schema", @@ -3309,7 +3307,7 @@ TEST(Foundation_frame_2019_09, nested_id_absolute_with_non_empty_fragment) { } } -TEST(Foundation_frame_2019_09, top_level_id_empty_fragment_only) { +TEST(Frame_2019_09, top_level_id_empty_fragment_only) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "#", "$schema": "https://json-schema.org/draft/2019-09/schema" @@ -3349,7 +3347,7 @@ TEST(Foundation_frame_2019_09, top_level_id_empty_fragment_only) { EXPECT_FRAME_LOCATION_REACHABLE(frame, Static, "", frame.root()); } -TEST(Foundation_frame_2019_09, nested_id_empty_fragment_only) { +TEST(Frame_2019_09, nested_id_empty_fragment_only) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://www.sourcemeta.com/schema", "$schema": "https://json-schema.org/draft/2019-09/schema", @@ -3410,7 +3408,7 @@ TEST(Foundation_frame_2019_09, nested_id_empty_fragment_only) { frame, Static, "https://www.sourcemeta.com/schema", frame.root()); } -TEST(Foundation_frame_2019_09, top_level_id_empty_string) { +TEST(Frame_2019_09, top_level_id_empty_string) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "", "$schema": "https://json-schema.org/draft/2019-09/schema" @@ -3450,7 +3448,7 @@ TEST(Foundation_frame_2019_09, top_level_id_empty_string) { EXPECT_FRAME_LOCATION_REACHABLE(frame, Static, "", frame.root()); } -TEST(Foundation_frame_2019_09, nested_id_empty_string) { +TEST(Frame_2019_09, nested_id_empty_string) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://www.sourcemeta.com/schema", "$schema": "https://json-schema.org/draft/2019-09/schema", diff --git a/test/foundation/foundation_frame_2020_12_test.cc b/test/frame/frame_2020_12_test.cc similarity index 98% rename from test/foundation/foundation_frame_2020_12_test.cc rename to test/frame/frame_2020_12_test.cc index de993ae31..fb5e78a66 100644 --- a/test/foundation/foundation_frame_2020_12_test.cc +++ b/test/frame/frame_2020_12_test.cc @@ -1,10 +1,11 @@ #include #include +#include #include #include -#include "foundation_test_utils.h" +#include "frame_test_utils.h" #define EXPECT_FRAME_STATIC_2020_12_POINTER( \ frame, reference, root_id, expected_pointer, expected_base, \ @@ -56,7 +57,7 @@ expected_relative_pointer, expected_parent, \ expected_property_name, expected_orphan); -TEST(Foundation_frame_2020_12, anonymous_with_nested_schema_resource) { +TEST(Frame_2020_12, anonymous_with_nested_schema_resource) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2020-12/schema", "additionalProperties": { "$id": "https://example.com" } @@ -120,7 +121,7 @@ TEST(Foundation_frame_2020_12, anonymous_with_nested_schema_resource) { "https://example.com"); } -TEST(Foundation_frame_2020_12, empty_schema) { +TEST(Frame_2020_12, empty_schema) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://www.sourcemeta.com/schema", "$schema": "https://json-schema.org/draft/2020-12/schema" @@ -163,7 +164,7 @@ TEST(Foundation_frame_2020_12, empty_schema) { frame, Static, "https://www.sourcemeta.com/schema", frame.root()); } -TEST(Foundation_frame_2020_12, empty_schema_trailing_hash) { +TEST(Frame_2020_12, empty_schema_trailing_hash) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://www.sourcemeta.com/schema#", "$schema": "https://json-schema.org/draft/2020-12/schema" @@ -206,7 +207,7 @@ TEST(Foundation_frame_2020_12, empty_schema_trailing_hash) { frame, Static, "https://www.sourcemeta.com/schema", frame.root()); } -TEST(Foundation_frame_2020_12, one_level_applicators_without_identifiers) { +TEST(Frame_2020_12, one_level_applicators_without_identifiers) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://www.sourcemeta.com/schema", "$schema": "https://json-schema.org/draft/2020-12/schema", @@ -300,7 +301,7 @@ TEST(Foundation_frame_2020_12, one_level_applicators_without_identifiers) { "https://www.sourcemeta.com/schema#/properties/foo"); } -TEST(Foundation_frame_2020_12, one_level_applicators_with_identifiers) { +TEST(Frame_2020_12, one_level_applicators_with_identifiers) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://www.sourcemeta.com/test/qux", "$schema": "https://json-schema.org/draft/2020-12/schema", @@ -441,7 +442,7 @@ TEST(Foundation_frame_2020_12, one_level_applicators_with_identifiers) { "https://www.sourcemeta.com/test/qux#/properties/foo"); } -TEST(Foundation_frame_2020_12, subschema_absolute_identifier) { +TEST(Frame_2020_12, subschema_absolute_identifier) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://www.sourcemeta.com/schema", "$schema": "https://json-schema.org/draft/2020-12/schema", @@ -518,7 +519,7 @@ TEST(Foundation_frame_2020_12, subschema_absolute_identifier) { "https://www.sourcemeta.com/foo"); } -TEST(Foundation_frame_2020_12, nested_schemas) { +TEST(Frame_2020_12, nested_schemas) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://www.sourcemeta.com/schema", "$schema": "https://json-schema.org/draft/2020-12/schema", @@ -825,7 +826,7 @@ TEST(Foundation_frame_2020_12, nested_schemas) { "https://www.sourcemeta.com/baz"); } -TEST(Foundation_frame_2020_12, id_override) { +TEST(Frame_2020_12, id_override) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://www.sourcemeta.com/schema", "$schema": "https://json-schema.org/draft/2020-12/schema", @@ -839,7 +840,7 @@ TEST(Foundation_frame_2020_12, id_override) { sourcemeta::blaze::SchemaFrameError); } -TEST(Foundation_frame_2020_12, static_anchor_override) { +TEST(Frame_2020_12, static_anchor_override) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://www.sourcemeta.com/schema", "$schema": "https://json-schema.org/draft/2020-12/schema", @@ -862,7 +863,7 @@ TEST(Foundation_frame_2020_12, static_anchor_override) { } } -TEST(Foundation_frame_2020_12, explicit_argument_id_same) { +TEST(Frame_2020_12, explicit_argument_id_same) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://www.sourcemeta.com/schema", "$schema": "https://json-schema.org/draft/2020-12/schema" @@ -907,7 +908,7 @@ TEST(Foundation_frame_2020_12, explicit_argument_id_same) { frame, Static, "https://www.sourcemeta.com/schema", frame.root()); } -TEST(Foundation_frame_2020_12, anchor_top_level) { +TEST(Frame_2020_12, anchor_top_level) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://www.sourcemeta.com/schema", "$schema": "https://json-schema.org/draft/2020-12/schema", @@ -962,7 +963,7 @@ TEST(Foundation_frame_2020_12, anchor_top_level) { frame, Static, "https://www.sourcemeta.com/schema#foo", frame.root()); } -TEST(Foundation_frame_2020_12, explicit_argument_id_different) { +TEST(Frame_2020_12, explicit_argument_id_different) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://www.sourcemeta.com/schema", "$schema": "https://json-schema.org/draft/2020-12/schema", @@ -1190,7 +1191,7 @@ TEST(Foundation_frame_2020_12, explicit_argument_id_different) { "https://www.test.com"); } -TEST(Foundation_frame_2020_12, dynamic_refs_with_id) { +TEST(Frame_2020_12, dynamic_refs_with_id) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://www.sourcemeta.com/schema", "$schema": "https://json-schema.org/draft/2020-12/schema", @@ -1597,7 +1598,7 @@ TEST(Foundation_frame_2020_12, dynamic_refs_with_id) { "https://www.sourcemeta.com/schema#/properties/unknown"); } -TEST(Foundation_frame_2020_12, dynamic_refs_with_no_id) { +TEST(Frame_2020_12, dynamic_refs_with_no_id) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2020-12/schema", "properties": { @@ -1887,7 +1888,7 @@ TEST(Foundation_frame_2020_12, dynamic_refs_with_no_id) { "#/properties/unknown"); } -TEST(Foundation_frame_2020_12, ref_to_dynamic_anchor) { +TEST(Frame_2020_12, ref_to_dynamic_anchor) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://www.sourcemeta.com/schema", "$schema": "https://json-schema.org/draft/2020-12/schema", @@ -2010,7 +2011,7 @@ TEST(Foundation_frame_2020_12, ref_to_dynamic_anchor) { "https://www.sourcemeta.com/schema#/properties/bar"); } -TEST(Foundation_frame_2020_12, different_dynamic_and_refs_in_same_object) { +TEST(Frame_2020_12, different_dynamic_and_refs_in_same_object) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://www.sourcemeta.com/schema", "$schema": "https://json-schema.org/draft/2020-12/schema", @@ -2128,7 +2129,7 @@ TEST(Foundation_frame_2020_12, different_dynamic_and_refs_in_same_object) { "https://www.sourcemeta.com/schema#/properties/bar"); } -TEST(Foundation_frame_2020_12, same_dynamic_and_refs_in_same_object) { +TEST(Frame_2020_12, same_dynamic_and_refs_in_same_object) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://www.sourcemeta.com/schema", "$schema": "https://json-schema.org/draft/2020-12/schema", @@ -2247,7 +2248,7 @@ TEST(Foundation_frame_2020_12, same_dynamic_and_refs_in_same_object) { "https://www.sourcemeta.com/schema#/properties/bar"); } -TEST(Foundation_frame_2020_12, dynamic_anchor_with_id) { +TEST(Frame_2020_12, dynamic_anchor_with_id) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://www.sourcemeta.com/schema", "$schema": "https://json-schema.org/draft/2020-12/schema", @@ -2444,7 +2445,7 @@ TEST(Foundation_frame_2020_12, dynamic_anchor_with_id) { "https://www.sourcemeta.com/bar"); } -TEST(Foundation_frame_2020_12, dynamic_anchor_without_id) { +TEST(Frame_2020_12, dynamic_anchor_without_id) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2020-12/schema", "properties": { @@ -2519,8 +2520,7 @@ TEST(Foundation_frame_2020_12, dynamic_anchor_without_id) { EXPECT_FRAME_LOCATION_REACHABLE(frame, Dynamic, "#test", "#/properties/foo"); } -TEST(Foundation_frame_2020_12, - dynamic_ref_to_single_dynamic_anchor_standalone) { +TEST(Frame_2020_12, dynamic_ref_to_single_dynamic_anchor_standalone) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2020-12/schema", "$dynamicRef": "#test", @@ -2599,7 +2599,7 @@ TEST(Foundation_frame_2020_12, EXPECT_FRAME_LOCATION_REACHABLE(frame, Dynamic, "#test", "#/$defs/test"); } -TEST(Foundation_frame_2020_12, dynamic_ref_to_single_dynamic_anchor_external) { +TEST(Frame_2020_12, dynamic_ref_to_single_dynamic_anchor_external) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2020-12/schema", "$dynamicRef": "#test", @@ -2701,7 +2701,7 @@ TEST(Foundation_frame_2020_12, dynamic_ref_to_single_dynamic_anchor_external) { "#/$defs/foo"); } -TEST(Foundation_frame_2020_12, dynamic_anchor_same_on_schema_resource) { +TEST(Frame_2020_12, dynamic_anchor_same_on_schema_resource) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://www.sourcemeta.com/schema", "$schema": "https://json-schema.org/draft/2020-12/schema", @@ -2726,7 +2726,7 @@ TEST(Foundation_frame_2020_12, dynamic_anchor_same_on_schema_resource) { } } -TEST(Foundation_frame_2020_12, no_id_recursive_empty_pointer) { +TEST(Frame_2020_12, no_id_recursive_empty_pointer) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2020-12/schema", "properties": { @@ -2785,7 +2785,7 @@ TEST(Foundation_frame_2020_12, no_id_recursive_empty_pointer) { "#/properties/foo"); } -TEST(Foundation_frame_2020_12, ref_metaschema) { +TEST(Frame_2020_12, ref_metaschema) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2020-12/schema", "$ref": "https://json-schema.org/draft/2020-12/schema" @@ -2827,7 +2827,7 @@ TEST(Foundation_frame_2020_12, ref_metaschema) { EXPECT_FRAME_LOCATION_REACHABLE(frame, Static, "", frame.root()); } -TEST(Foundation_frame_2020_12, location_independent_identifier_anonymous) { +TEST(Frame_2020_12, location_independent_identifier_anonymous) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2020-12/schema", "$defs": { @@ -2854,7 +2854,7 @@ TEST(Foundation_frame_2020_12, location_independent_identifier_anonymous) { } } -TEST(Foundation_frame_2020_12, ref_with_id) { +TEST(Frame_2020_12, ref_with_id) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://www.sourcemeta.com/schema", "$schema": "https://json-schema.org/draft/2020-12/schema", @@ -2932,7 +2932,7 @@ TEST(Foundation_frame_2020_12, ref_with_id) { "https://www.sourcemeta.com/schema#/$defs/string"); } -TEST(Foundation_frame_2020_12, ref_from_definitions) { +TEST(Frame_2020_12, ref_from_definitions) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://www.sourcemeta.com/schema", "$schema": "https://json-schema.org/draft/2020-12/schema", @@ -3044,7 +3044,7 @@ TEST(Foundation_frame_2020_12, ref_from_definitions) { "https://www.sourcemeta.com/schema#/definitions/string"); } -TEST(Foundation_frame_2020_12, relative_base_uri_without_ref) { +TEST(Frame_2020_12, relative_base_uri_without_ref) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "common" @@ -3082,7 +3082,7 @@ TEST(Foundation_frame_2020_12, relative_base_uri_without_ref) { EXPECT_FRAME_LOCATION_REACHABLE(frame, Static, "common", frame.root()); } -TEST(Foundation_frame_2020_12, relative_base_uri_with_ref) { +TEST(Frame_2020_12, relative_base_uri_with_ref) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "common", @@ -3170,7 +3170,7 @@ TEST(Foundation_frame_2020_12, relative_base_uri_with_ref) { "common#/$defs/foo"); } -TEST(Foundation_frame_2020_12, relative_base_with_relative_path_ref) { +TEST(Frame_2020_12, relative_base_with_relative_path_ref) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "foo/bar/baz", @@ -3216,7 +3216,7 @@ TEST(Foundation_frame_2020_12, relative_base_with_relative_path_ref) { EXPECT_FRAME_LOCATION_REACHABLE(frame, Static, "foo/bar/baz", frame.root()); } -TEST(Foundation_frame_2020_12, idempotent_with_refs) { +TEST(Frame_2020_12, idempotent_with_refs) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://www.sourcemeta.com/schema", "$schema": "https://json-schema.org/draft/2020-12/schema", @@ -3294,7 +3294,7 @@ TEST(Foundation_frame_2020_12, idempotent_with_refs) { "https://www.sourcemeta.com/schema#/$defs/string"); } -TEST(Foundation_frame_2020_12, allof_refs) { +TEST(Frame_2020_12, allof_refs) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2020-12/schema", "allOf": [ @@ -3376,7 +3376,7 @@ TEST(Foundation_frame_2020_12, allof_refs) { EXPECT_FRAME_LOCATION_REACHABLE(frame, Static, "#/allOf/1", "#/allOf/1"); } -TEST(Foundation_frame_2020_12, properties_with_refs) { +TEST(Frame_2020_12, properties_with_refs) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://www.sourcemeta.com/schema", "$schema": "https://json-schema.org/draft/2020-12/schema", @@ -3556,7 +3556,7 @@ TEST(Foundation_frame_2020_12, properties_with_refs) { "https://www.sourcemeta.com/schema#/properties/baz/items"); } -TEST(Foundation_frame_2020_12, property_ref_defs) { +TEST(Frame_2020_12, property_ref_defs) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://www.sourcemeta.com/schema", "$schema": "https://json-schema.org/draft/2020-12/schema", @@ -3808,7 +3808,7 @@ TEST(Foundation_frame_2020_12, property_ref_defs) { "additionalProperties"); } -TEST(Foundation_frame_2020_12, property_cross_ref) { +TEST(Frame_2020_12, property_cross_ref) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://www.sourcemeta.com/schema", "$schema": "https://json-schema.org/draft/2020-12/schema", @@ -4003,7 +4003,7 @@ TEST(Foundation_frame_2020_12, property_cross_ref) { "additionalProperties"); } -TEST(Foundation_frame_2020_12, dynamic_ref_multiple_targets) { +TEST(Frame_2020_12, dynamic_ref_multiple_targets) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://www.example.com", "$schema": "https://json-schema.org/draft/2020-12/schema", @@ -4156,7 +4156,7 @@ TEST(Foundation_frame_2020_12, dynamic_ref_multiple_targets) { "https://www.example.com#/properties/bar"); } -TEST(Foundation_frame_2020_12, cross_id_anonymous_nested) { +TEST(Frame_2020_12, cross_id_anonymous_nested) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2020-12/schema", "$ref": "#/$defs/schema/items", @@ -4274,7 +4274,7 @@ TEST(Foundation_frame_2020_12, cross_id_anonymous_nested) { "#/$defs/schema/items"); } -TEST(Foundation_frame_2020_12, relative_id_with_absolute_default_id) { +TEST(Frame_2020_12, relative_id_with_absolute_default_id) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "relative", "$schema": "https://json-schema.org/draft/2020-12/schema" @@ -4327,7 +4327,7 @@ TEST(Foundation_frame_2020_12, relative_id_with_absolute_default_id) { frame.root()); } -TEST(Foundation_frame_2020_12, zero_paths) { +TEST(Frame_2020_12, zero_paths) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://www.sourcemeta.com/schema", "$schema": "https://json-schema.org/draft/2020-12/schema" @@ -4342,7 +4342,7 @@ TEST(Foundation_frame_2020_12, zero_paths) { EXPECT_EQ(frame.references().size(), 0); } -TEST(Foundation_frame_2020_12, single_nested_path_recursive_with_identifier) { +TEST(Frame_2020_12, single_nested_path_recursive_with_identifier) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "wrapper": { "$id": "https://www.sourcemeta.com/schema", @@ -4418,8 +4418,7 @@ TEST(Foundation_frame_2020_12, single_nested_path_recursive_with_identifier) { "https://www.sourcemeta.com/schema"); } -TEST(Foundation_frame_2020_12, - single_nested_path_recursive_without_identifiers) { +TEST(Frame_2020_12, single_nested_path_recursive_without_identifiers) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "wrapper": { "$ref": "#/wrapper" @@ -4458,7 +4457,7 @@ TEST(Foundation_frame_2020_12, EXPECT_FRAME_LOCATION_REACHABLE(frame, Static, "#/wrapper", "#/wrapper"); } -TEST(Foundation_frame_2020_12, single_nested_anonymous_with_nested_resource) { +TEST(Frame_2020_12, single_nested_anonymous_with_nested_resource) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "wrapper": { "items": { @@ -4549,7 +4548,7 @@ TEST(Foundation_frame_2020_12, single_nested_anonymous_with_nested_resource) { "#/wrapper/items"); } -TEST(Foundation_frame_2020_12, multiple_nested_cross_ref) { +TEST(Frame_2020_12, multiple_nested_cross_ref) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "wrapper": { "$ref": "#/common/test" @@ -4696,7 +4695,7 @@ TEST(Foundation_frame_2020_12, multiple_nested_cross_ref) { "#/common/with-id"); } -TEST(Foundation_frame_2020_12, multiple_nested_cross_ref_missing_target) { +TEST(Frame_2020_12, multiple_nested_cross_ref_missing_target) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "wrapper": { "$ref": "#/common/test" @@ -4763,7 +4762,7 @@ TEST(Foundation_frame_2020_12, multiple_nested_cross_ref_missing_target) { "#/common/test"); } -TEST(Foundation_frame_2020_12, multiple_nested_no_base_dialect) { +TEST(Frame_2020_12, multiple_nested_no_base_dialect) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "wrapper": { "$ref": "#/common/test" @@ -4794,7 +4793,7 @@ TEST(Foundation_frame_2020_12, multiple_nested_no_base_dialect) { sourcemeta::blaze::SchemaUnknownBaseDialectError); } -TEST(Foundation_frame_2020_12, multiple_nested_same_id) { +TEST(Frame_2020_12, multiple_nested_same_id) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "common": { "foo": { @@ -4820,7 +4819,7 @@ TEST(Foundation_frame_2020_12, multiple_nested_same_id) { sourcemeta::blaze::SchemaFrameError); } -TEST(Foundation_frame_2020_12, multiple_nested_same_anonymous_anchors) { +TEST(Frame_2020_12, multiple_nested_same_anonymous_anchors) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "common": { "foo": { @@ -4853,7 +4852,7 @@ TEST(Foundation_frame_2020_12, multiple_nested_same_anonymous_anchors) { } } -TEST(Foundation_frame_2020_12, multiple_nested_with_default_id) { +TEST(Frame_2020_12, multiple_nested_with_default_id) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "wrapper": { "$ref": "#/common/test" @@ -4923,7 +4922,7 @@ TEST(Foundation_frame_2020_12, multiple_nested_with_default_id) { "#/common/test"); } -TEST(Foundation_frame_2020_12, anchor_with_invalid_type) { +TEST(Frame_2020_12, anchor_with_invalid_type) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2020-12/schema", "$anchor": 123 @@ -4958,7 +4957,7 @@ TEST(Foundation_frame_2020_12, anchor_with_invalid_type) { EXPECT_FRAME_LOCATION_REACHABLE(frame, Static, "", frame.root()); } -TEST(Foundation_frame_2020_12, dynamic_anchor_with_invalid_type) { +TEST(Frame_2020_12, dynamic_anchor_with_invalid_type) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2020-12/schema", "$dynamicAnchor": 123 @@ -4993,7 +4992,7 @@ TEST(Foundation_frame_2020_12, dynamic_anchor_with_invalid_type) { EXPECT_FRAME_LOCATION_REACHABLE(frame, Static, "", frame.root()); } -TEST(Foundation_frame_2020_12, dynamic_ref_with_invalid_type) { +TEST(Frame_2020_12, dynamic_ref_with_invalid_type) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2020-12/schema", "$dynamicRef": 123 @@ -5014,8 +5013,7 @@ TEST(Foundation_frame_2020_12, dynamic_ref_with_invalid_type) { } } -TEST(Foundation_frame_2020_12, - ref_does_not_invalidate_sibling_subschemas_and_refs) { +TEST(Frame_2020_12, ref_does_not_invalidate_sibling_subschemas_and_refs) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2020-12/schema", "properties": { @@ -5113,7 +5111,7 @@ TEST(Foundation_frame_2020_12, frame.root()); } -TEST(Foundation_frame_2020_12, ref_to_ref_chain) { +TEST(Frame_2020_12, ref_to_ref_chain) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://www.sourcemeta.com/schema", "$schema": "https://json-schema.org/draft/2020-12/schema", @@ -5221,7 +5219,7 @@ TEST(Foundation_frame_2020_12, ref_to_ref_chain) { "https://www.sourcemeta.com/schema#/$defs/child"); } -TEST(Foundation_frame_2020_12, nested_defs_unreferenced) { +TEST(Frame_2020_12, nested_defs_unreferenced) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://www.sourcemeta.com/schema", "$schema": "https://json-schema.org/draft/2020-12/schema", @@ -5328,7 +5326,7 @@ TEST(Foundation_frame_2020_12, nested_defs_unreferenced) { "https://www.sourcemeta.com/schema#/properties/foo/$defs/unused"); } -TEST(Foundation_frame_2020_12, circular_ref_through_defs) { +TEST(Frame_2020_12, circular_ref_through_defs) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://www.sourcemeta.com/schema", "$schema": "https://json-schema.org/draft/2020-12/schema", @@ -5438,7 +5436,7 @@ TEST(Foundation_frame_2020_12, circular_ref_through_defs) { "https://www.sourcemeta.com/schema#/$defs/b"); } -TEST(Foundation_frame_2020_12, nested_invalid_schema_keyword) { +TEST(Frame_2020_12, nested_invalid_schema_keyword) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2020-12/schema", "properties": { @@ -5463,7 +5461,7 @@ TEST(Foundation_frame_2020_12, nested_invalid_schema_keyword) { } } -TEST(Foundation_frame_2020_12, invalid_id_not_string) { +TEST(Frame_2020_12, invalid_id_not_string) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": 123 @@ -5484,7 +5482,7 @@ TEST(Foundation_frame_2020_12, invalid_id_not_string) { } } -TEST(Foundation_frame_2020_12, invalid_id_not_uri) { +TEST(Frame_2020_12, invalid_id_not_uri) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "not a valid uri" @@ -5505,7 +5503,7 @@ TEST(Foundation_frame_2020_12, invalid_id_not_uri) { } } -TEST(Foundation_frame_2020_12, nested_invalid_schema_not_uri) { +TEST(Frame_2020_12, nested_invalid_schema_not_uri) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2020-12/schema", "properties": { @@ -5530,7 +5528,7 @@ TEST(Foundation_frame_2020_12, nested_invalid_schema_not_uri) { } } -TEST(Foundation_frame_2020_12, invalid_ref_not_string) { +TEST(Frame_2020_12, invalid_ref_not_string) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2020-12/schema", "$ref": 123 @@ -5551,7 +5549,7 @@ TEST(Foundation_frame_2020_12, invalid_ref_not_string) { } } -TEST(Foundation_frame_2020_12, invalid_ref_not_uri) { +TEST(Frame_2020_12, invalid_ref_not_uri) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2020-12/schema", "$ref": "not a valid uri" @@ -5572,7 +5570,7 @@ TEST(Foundation_frame_2020_12, invalid_ref_not_uri) { } } -TEST(Foundation_frame_2020_12, invalid_dynamic_ref_not_string) { +TEST(Frame_2020_12, invalid_dynamic_ref_not_string) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2020-12/schema", "$dynamicRef": 123 @@ -5593,7 +5591,7 @@ TEST(Foundation_frame_2020_12, invalid_dynamic_ref_not_string) { } } -TEST(Foundation_frame_2020_12, invalid_dynamic_ref_not_uri) { +TEST(Frame_2020_12, invalid_dynamic_ref_not_uri) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2020-12/schema", "$dynamicRef": "not a valid uri" @@ -5614,7 +5612,7 @@ TEST(Foundation_frame_2020_12, invalid_dynamic_ref_not_uri) { } } -TEST(Foundation_frame_2020_12, ref_to_orphan_chain) { +TEST(Frame_2020_12, ref_to_orphan_chain) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2020-12/schema", "properties": { @@ -5743,7 +5741,7 @@ TEST(Foundation_frame_2020_12, ref_to_orphan_chain) { EXPECT_FRAME_LOCATION_REACHABLE(frame, Static, "#/$defs/c", "#/$defs/c"); } -TEST(Foundation_frame_2020_12, orphan_chain_unreferenced) { +TEST(Frame_2020_12, orphan_chain_unreferenced) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2020-12/schema", "$defs": { @@ -5837,7 +5835,7 @@ TEST(Foundation_frame_2020_12, orphan_chain_unreferenced) { EXPECT_FRAME_LOCATION_REACHABLE(frame, Static, "#/$defs/c", "#/$defs/c"); } -TEST(Foundation_frame_2020_12, circular_orphan_refs) { +TEST(Frame_2020_12, circular_orphan_refs) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2020-12/schema", "$defs": { @@ -5914,7 +5912,7 @@ TEST(Foundation_frame_2020_12, circular_orphan_refs) { EXPECT_FRAME_LOCATION_REACHABLE(frame, Static, "#/$defs/b", "#/$defs/b"); } -TEST(Foundation_frame_2020_12, ref_from_deep_nesting) { +TEST(Frame_2020_12, ref_from_deep_nesting) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2020-12/schema", "properties": { @@ -6041,7 +6039,7 @@ TEST(Foundation_frame_2020_12, ref_from_deep_nesting) { "#/$defs/string"); } -TEST(Foundation_frame_2020_12, orphan_refs_reachable_target) { +TEST(Frame_2020_12, orphan_refs_reachable_target) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2020-12/schema", "properties": { @@ -6153,7 +6151,7 @@ TEST(Foundation_frame_2020_12, orphan_refs_reachable_target) { "#/$defs/orphan"); } -TEST(Foundation_frame_2020_12, root_dynamic_anchor) { +TEST(Frame_2020_12, root_dynamic_anchor) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2020-12/schema", "$dynamicAnchor": "root", @@ -6209,7 +6207,7 @@ TEST(Foundation_frame_2020_12, root_dynamic_anchor) { EXPECT_FRAME_LOCATION_REACHABLE(frame, Dynamic, "#root", frame.root()); } -TEST(Foundation_frame_2020_12, dynamic_ref_to_static_anchor) { +TEST(Frame_2020_12, dynamic_ref_to_static_anchor) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2020-12/schema", "properties": { @@ -6308,7 +6306,7 @@ TEST(Foundation_frame_2020_12, dynamic_ref_to_static_anchor) { "#/$defs/string"); } -TEST(Foundation_frame_2020_12, dynamic_ref_to_pointer) { +TEST(Frame_2020_12, dynamic_ref_to_pointer) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2020-12/schema", "properties": { @@ -6396,7 +6394,7 @@ TEST(Foundation_frame_2020_12, dynamic_ref_to_pointer) { "#/$defs/string"); } -TEST(Foundation_frame_2020_12, dynamic_ref_to_dynamic_anchor) { +TEST(Frame_2020_12, dynamic_ref_to_dynamic_anchor) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2020-12/schema", "properties": { @@ -6505,7 +6503,7 @@ TEST(Foundation_frame_2020_12, dynamic_ref_to_dynamic_anchor) { "#/$defs/string"); } -TEST(Foundation_frame_2020_12, static_ref_to_dynamic_anchor) { +TEST(Frame_2020_12, static_ref_to_dynamic_anchor) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2020-12/schema", "properties": { @@ -6685,7 +6683,7 @@ TEST(Foundation_frame_2020_12, static_ref_to_dynamic_anchor) { "#/$defs/string/additionalProperties/$defs/nested"); } -TEST(Foundation_frame_2020_12, unreferenced_dynamic_anchor) { +TEST(Frame_2020_12, unreferenced_dynamic_anchor) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2020-12/schema", "$defs": { @@ -6764,7 +6762,7 @@ TEST(Foundation_frame_2020_12, unreferenced_dynamic_anchor) { "#/$defs/string"); } -TEST(Foundation_frame_2020_12, property_named_defs) { +TEST(Frame_2020_12, property_named_defs) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "https://example.com/schema", @@ -6914,7 +6912,7 @@ TEST(Foundation_frame_2020_12, property_named_defs) { "https://example.com/schema#/$defs/helper/properties/definitions"); } -TEST(Foundation_frame_2020_12, nested_schema_with_dynamic_anchor_and_refs) { +TEST(Frame_2020_12, nested_schema_with_dynamic_anchor_and_refs) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2020-12/schema", "$defs": { @@ -7176,8 +7174,7 @@ TEST(Foundation_frame_2020_12, nested_schema_with_dynamic_anchor_and_refs) { "__sourcemeta-core-wrap__#/$defs/baz"); } -TEST(Foundation_frame_2020_12, - dynamic_ref_with_unreferenced_dynamic_anchor_target) { +TEST(Frame_2020_12, dynamic_ref_with_unreferenced_dynamic_anchor_target) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "https://example.com/root", @@ -7292,8 +7289,7 @@ TEST(Foundation_frame_2020_12, "https://example.com/unreferenced"); } -TEST(Foundation_frame_2020_12, - dynamic_ref_with_unreferenced_static_anchor_target) { +TEST(Frame_2020_12, dynamic_ref_with_unreferenced_static_anchor_target) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "https://example.com/root", @@ -7399,7 +7395,7 @@ TEST(Foundation_frame_2020_12, "https://example.com/unreferenced"); } -TEST(Foundation_frame_2020_12, anchor_with_invalid_format_empty) { +TEST(Frame_2020_12, anchor_with_invalid_format_empty) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2020-12/schema", "$anchor": "" @@ -7420,7 +7416,7 @@ TEST(Foundation_frame_2020_12, anchor_with_invalid_format_empty) { } } -TEST(Foundation_frame_2020_12, anchor_with_invalid_format_leading_digit) { +TEST(Frame_2020_12, anchor_with_invalid_format_leading_digit) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2020-12/schema", "$anchor": "1foo" @@ -7441,7 +7437,7 @@ TEST(Foundation_frame_2020_12, anchor_with_invalid_format_leading_digit) { } } -TEST(Foundation_frame_2020_12, anchor_with_invalid_format_leading_hyphen) { +TEST(Frame_2020_12, anchor_with_invalid_format_leading_hyphen) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2020-12/schema", "$anchor": "-foo" @@ -7462,7 +7458,7 @@ TEST(Foundation_frame_2020_12, anchor_with_invalid_format_leading_hyphen) { } } -TEST(Foundation_frame_2020_12, anchor_with_invalid_format_whitespace) { +TEST(Frame_2020_12, anchor_with_invalid_format_whitespace) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2020-12/schema", "$anchor": "foo bar" @@ -7483,7 +7479,7 @@ TEST(Foundation_frame_2020_12, anchor_with_invalid_format_whitespace) { } } -TEST(Foundation_frame_2020_12, anchor_with_invalid_format_punctuation) { +TEST(Frame_2020_12, anchor_with_invalid_format_punctuation) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2020-12/schema", "$anchor": "foo!bar" @@ -7504,7 +7500,7 @@ TEST(Foundation_frame_2020_12, anchor_with_invalid_format_punctuation) { } } -TEST(Foundation_frame_2020_12, anchor_with_invalid_format_colon) { +TEST(Frame_2020_12, anchor_with_invalid_format_colon) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2020-12/schema", "$anchor": "foo:bar" @@ -7525,7 +7521,7 @@ TEST(Foundation_frame_2020_12, anchor_with_invalid_format_colon) { } } -TEST(Foundation_frame_2020_12, anchor_with_valid_leading_underscore) { +TEST(Frame_2020_12, anchor_with_valid_leading_underscore) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://www.sourcemeta.com/schema", "$schema": "https://json-schema.org/draft/2020-12/schema", @@ -7580,7 +7576,7 @@ TEST(Foundation_frame_2020_12, anchor_with_valid_leading_underscore) { frame, Static, "https://www.sourcemeta.com/schema#_foo", frame.root()); } -TEST(Foundation_frame_2020_12, dynamic_anchor_with_invalid_format_empty) { +TEST(Frame_2020_12, dynamic_anchor_with_invalid_format_empty) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2020-12/schema", "$dynamicAnchor": "" @@ -7601,8 +7597,7 @@ TEST(Foundation_frame_2020_12, dynamic_anchor_with_invalid_format_empty) { } } -TEST(Foundation_frame_2020_12, - dynamic_anchor_with_invalid_format_leading_digit) { +TEST(Frame_2020_12, dynamic_anchor_with_invalid_format_leading_digit) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2020-12/schema", "$dynamicAnchor": "1foo" @@ -7623,7 +7618,7 @@ TEST(Foundation_frame_2020_12, } } -TEST(Foundation_frame_2020_12, dynamic_anchor_with_invalid_format_colon) { +TEST(Frame_2020_12, dynamic_anchor_with_invalid_format_colon) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2020-12/schema", "$dynamicAnchor": "foo:bar" @@ -7644,7 +7639,7 @@ TEST(Foundation_frame_2020_12, dynamic_anchor_with_invalid_format_colon) { } } -TEST(Foundation_frame_2020_12, dynamic_anchor_with_valid_leading_underscore) { +TEST(Frame_2020_12, dynamic_anchor_with_valid_leading_underscore) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://www.sourcemeta.com/schema", "$schema": "https://json-schema.org/draft/2020-12/schema", @@ -7703,7 +7698,7 @@ TEST(Foundation_frame_2020_12, dynamic_anchor_with_valid_leading_underscore) { frame, Static, "https://www.sourcemeta.com/schema#_foo", frame.root()); } -TEST(Foundation_frame_2020_12, top_level_id_absolute_with_non_empty_fragment) { +TEST(Frame_2020_12, top_level_id_absolute_with_non_empty_fragment) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://www.sourcemeta.com/schema#foo", "$schema": "https://json-schema.org/draft/2020-12/schema" @@ -7723,7 +7718,7 @@ TEST(Foundation_frame_2020_12, top_level_id_absolute_with_non_empty_fragment) { } } -TEST(Foundation_frame_2020_12, nested_id_absolute_with_non_empty_fragment) { +TEST(Frame_2020_12, nested_id_absolute_with_non_empty_fragment) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://www.sourcemeta.com/schema", "$schema": "https://json-schema.org/draft/2020-12/schema", @@ -7748,7 +7743,7 @@ TEST(Foundation_frame_2020_12, nested_id_absolute_with_non_empty_fragment) { } } -TEST(Foundation_frame_2020_12, top_level_id_empty_fragment_only) { +TEST(Frame_2020_12, top_level_id_empty_fragment_only) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "#", "$schema": "https://json-schema.org/draft/2020-12/schema" @@ -7788,7 +7783,7 @@ TEST(Foundation_frame_2020_12, top_level_id_empty_fragment_only) { EXPECT_FRAME_LOCATION_REACHABLE(frame, Static, "", frame.root()); } -TEST(Foundation_frame_2020_12, nested_id_empty_fragment_only) { +TEST(Frame_2020_12, nested_id_empty_fragment_only) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://www.sourcemeta.com/schema", "$schema": "https://json-schema.org/draft/2020-12/schema", @@ -7849,7 +7844,7 @@ TEST(Foundation_frame_2020_12, nested_id_empty_fragment_only) { frame, Static, "https://www.sourcemeta.com/schema", frame.root()); } -TEST(Foundation_frame_2020_12, top_level_id_empty_string) { +TEST(Frame_2020_12, top_level_id_empty_string) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "", "$schema": "https://json-schema.org/draft/2020-12/schema" @@ -7889,7 +7884,7 @@ TEST(Foundation_frame_2020_12, top_level_id_empty_string) { EXPECT_FRAME_LOCATION_REACHABLE(frame, Static, "", frame.root()); } -TEST(Foundation_frame_2020_12, nested_id_empty_string) { +TEST(Frame_2020_12, nested_id_empty_string) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://www.sourcemeta.com/schema", "$schema": "https://json-schema.org/draft/2020-12/schema", diff --git a/test/foundation/foundation_frame_draft0_test.cc b/test/frame/frame_draft0_test.cc similarity index 97% rename from test/foundation/foundation_frame_draft0_test.cc rename to test/frame/frame_draft0_test.cc index 7b15c5ca9..8f9698de4 100644 --- a/test/foundation/foundation_frame_draft0_test.cc +++ b/test/frame/frame_draft0_test.cc @@ -1,10 +1,11 @@ #include #include +#include #include #include -#include "foundation_test_utils.h" +#include "frame_test_utils.h" #define EXPECT_FRAME_STATIC_DRAFT0_RESOURCE( \ frame, reference, root_id, expected_pointer, expected_base, \ @@ -36,7 +37,7 @@ expected_relative_pointer, expected_parent, \ expected_property_name, expected_orphan); -TEST(Foundation_frame_draft0, anonymous_with_nested_schema_resource) { +TEST(Frame_draft0, anonymous_with_nested_schema_resource) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "http://json-schema.org/draft-00/schema#", "additionalProperties": { "id": "https://example.com" } @@ -97,7 +98,7 @@ TEST(Foundation_frame_draft0, anonymous_with_nested_schema_resource) { "https://example.com"); } -TEST(Foundation_frame_draft0, empty_schema) { +TEST(Frame_draft0, empty_schema) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "id": "https://www.sourcemeta.com/schema", "$schema": "http://json-schema.org/draft-00/schema#" @@ -140,7 +141,7 @@ TEST(Foundation_frame_draft0, empty_schema) { frame, Static, "https://www.sourcemeta.com/schema", frame.root()); } -TEST(Foundation_frame_draft0, empty_schema_trailing_hash) { +TEST(Frame_draft0, empty_schema_trailing_hash) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "id": "https://www.sourcemeta.com/schema#", "$schema": "http://json-schema.org/draft-00/schema#" @@ -183,7 +184,7 @@ TEST(Foundation_frame_draft0, empty_schema_trailing_hash) { frame, Static, "https://www.sourcemeta.com/schema", frame.root()); } -TEST(Foundation_frame_draft0, one_level_applicators_without_identifiers) { +TEST(Frame_draft0, one_level_applicators_without_identifiers) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "id": "https://www.sourcemeta.com/schema", "$schema": "http://json-schema.org/draft-00/schema#", @@ -271,7 +272,7 @@ TEST(Foundation_frame_draft0, one_level_applicators_without_identifiers) { "https://www.sourcemeta.com/schema#/properties/foo"); } -TEST(Foundation_frame_draft0, one_level_applicators_with_identifiers) { +TEST(Frame_draft0, one_level_applicators_with_identifiers) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "id": "https://www.sourcemeta.com/test/qux", "$schema": "http://json-schema.org/draft-00/schema#", @@ -351,7 +352,7 @@ TEST(Foundation_frame_draft0, one_level_applicators_with_identifiers) { "https://www.sourcemeta.com/foo"); } -TEST(Foundation_frame_draft0, subschema_absolute_identifier) { +TEST(Frame_draft0, subschema_absolute_identifier) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "id": "https://www.sourcemeta.com/schema", "$schema": "http://json-schema.org/draft-00/schema#", @@ -433,7 +434,7 @@ TEST(Foundation_frame_draft0, subschema_absolute_identifier) { "https://www.sourcemeta.com/foo"); } -TEST(Foundation_frame_draft0, id_override) { +TEST(Frame_draft0, id_override) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "id": "https://www.sourcemeta.com/schema", "$schema": "http://json-schema.org/draft-00/schema#", @@ -447,7 +448,7 @@ TEST(Foundation_frame_draft0, id_override) { sourcemeta::blaze::SchemaFrameError); } -TEST(Foundation_frame_draft0, explicit_argument_id_same) { +TEST(Frame_draft0, explicit_argument_id_same) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "id": "https://www.sourcemeta.com/schema", "$schema": "http://json-schema.org/draft-00/schema#" @@ -492,7 +493,7 @@ TEST(Foundation_frame_draft0, explicit_argument_id_same) { frame, Static, "https://www.sourcemeta.com/schema", frame.root()); } -TEST(Foundation_frame_draft0, explicit_argument_id_different) { +TEST(Frame_draft0, explicit_argument_id_different) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "id": "https://www.sourcemeta.com/schema", "$schema": "http://json-schema.org/draft-00/schema#", @@ -627,7 +628,7 @@ TEST(Foundation_frame_draft0, explicit_argument_id_different) { "https://www.test.com"); } -TEST(Foundation_frame_draft0, ref_metaschema) { +TEST(Frame_draft0, ref_metaschema) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "http://json-schema.org/draft-00/schema#", "$ref": "http://json-schema.org/draft-00/schema#" diff --git a/test/foundation/foundation_frame_draft1_test.cc b/test/frame/frame_draft1_test.cc similarity index 97% rename from test/foundation/foundation_frame_draft1_test.cc rename to test/frame/frame_draft1_test.cc index b0eb7fd11..518da8fad 100644 --- a/test/foundation/foundation_frame_draft1_test.cc +++ b/test/frame/frame_draft1_test.cc @@ -1,10 +1,11 @@ #include #include +#include #include #include -#include "foundation_test_utils.h" +#include "frame_test_utils.h" #define EXPECT_FRAME_STATIC_DRAFT1_RESOURCE( \ frame, reference, root_id, expected_pointer, expected_base, \ @@ -36,7 +37,7 @@ expected_relative_pointer, expected_parent, \ expected_property_name, expected_orphan); -TEST(Foundation_frame_draft1, anonymous_with_nested_schema_resource) { +TEST(Frame_draft1, anonymous_with_nested_schema_resource) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "http://json-schema.org/draft-01/schema#", "additionalProperties": { "id": "https://example.com" } @@ -97,7 +98,7 @@ TEST(Foundation_frame_draft1, anonymous_with_nested_schema_resource) { "https://example.com"); } -TEST(Foundation_frame_draft1, empty_schema) { +TEST(Frame_draft1, empty_schema) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "id": "https://www.sourcemeta.com/schema", "$schema": "http://json-schema.org/draft-01/schema#" @@ -140,7 +141,7 @@ TEST(Foundation_frame_draft1, empty_schema) { frame, Static, "https://www.sourcemeta.com/schema", frame.root()); } -TEST(Foundation_frame_draft1, empty_schema_trailing_hash) { +TEST(Frame_draft1, empty_schema_trailing_hash) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "id": "https://www.sourcemeta.com/schema#", "$schema": "http://json-schema.org/draft-01/schema#" @@ -183,7 +184,7 @@ TEST(Foundation_frame_draft1, empty_schema_trailing_hash) { frame, Static, "https://www.sourcemeta.com/schema", frame.root()); } -TEST(Foundation_frame_draft1, one_level_applicators_without_identifiers) { +TEST(Frame_draft1, one_level_applicators_without_identifiers) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "id": "https://www.sourcemeta.com/schema", "$schema": "http://json-schema.org/draft-01/schema#", @@ -271,7 +272,7 @@ TEST(Foundation_frame_draft1, one_level_applicators_without_identifiers) { "https://www.sourcemeta.com/schema#/properties/foo"); } -TEST(Foundation_frame_draft1, one_level_applicators_with_identifiers) { +TEST(Frame_draft1, one_level_applicators_with_identifiers) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "id": "https://www.sourcemeta.com/test/qux", "$schema": "http://json-schema.org/draft-01/schema#", @@ -351,7 +352,7 @@ TEST(Foundation_frame_draft1, one_level_applicators_with_identifiers) { "https://www.sourcemeta.com/foo"); } -TEST(Foundation_frame_draft1, subschema_absolute_identifier) { +TEST(Frame_draft1, subschema_absolute_identifier) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "id": "https://www.sourcemeta.com/schema", "$schema": "http://json-schema.org/draft-01/schema#", @@ -433,7 +434,7 @@ TEST(Foundation_frame_draft1, subschema_absolute_identifier) { "https://www.sourcemeta.com/foo"); } -TEST(Foundation_frame_draft1, id_override) { +TEST(Frame_draft1, id_override) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "id": "https://www.sourcemeta.com/schema", "$schema": "http://json-schema.org/draft-01/schema#", @@ -447,7 +448,7 @@ TEST(Foundation_frame_draft1, id_override) { sourcemeta::blaze::SchemaFrameError); } -TEST(Foundation_frame_draft1, explicit_argument_id_same) { +TEST(Frame_draft1, explicit_argument_id_same) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "id": "https://www.sourcemeta.com/schema", "$schema": "http://json-schema.org/draft-01/schema#" @@ -492,7 +493,7 @@ TEST(Foundation_frame_draft1, explicit_argument_id_same) { frame, Static, "https://www.sourcemeta.com/schema", frame.root()); } -TEST(Foundation_frame_draft1, explicit_argument_id_different) { +TEST(Frame_draft1, explicit_argument_id_different) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "id": "https://www.sourcemeta.com/schema", "$schema": "http://json-schema.org/draft-01/schema#", @@ -627,7 +628,7 @@ TEST(Foundation_frame_draft1, explicit_argument_id_different) { "https://www.test.com"); } -TEST(Foundation_frame_draft1, ref_metaschema) { +TEST(Frame_draft1, ref_metaschema) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "http://json-schema.org/draft-01/schema#", "$ref": "http://json-schema.org/draft-01/schema#" diff --git a/test/foundation/foundation_frame_draft2_test.cc b/test/frame/frame_draft2_test.cc similarity index 97% rename from test/foundation/foundation_frame_draft2_test.cc rename to test/frame/frame_draft2_test.cc index 32c31f743..591274723 100644 --- a/test/foundation/foundation_frame_draft2_test.cc +++ b/test/frame/frame_draft2_test.cc @@ -1,10 +1,11 @@ #include #include +#include #include #include -#include "foundation_test_utils.h" +#include "frame_test_utils.h" #define EXPECT_FRAME_STATIC_DRAFT2_POINTER( \ frame, reference, root_id, expected_pointer, expected_base, \ @@ -36,7 +37,7 @@ expected_relative_pointer, expected_parent, \ expected_property_name, expected_orphan); -TEST(Foundation_frame_draft2, anonymous_with_nested_schema_resource) { +TEST(Frame_draft2, anonymous_with_nested_schema_resource) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "http://json-schema.org/draft-02/schema#", "additionalProperties": { "id": "https://example.com" } @@ -97,7 +98,7 @@ TEST(Foundation_frame_draft2, anonymous_with_nested_schema_resource) { "https://example.com"); } -TEST(Foundation_frame_draft2, empty_schema) { +TEST(Frame_draft2, empty_schema) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "id": "https://www.sourcemeta.com/schema", "$schema": "http://json-schema.org/draft-02/schema#" @@ -140,7 +141,7 @@ TEST(Foundation_frame_draft2, empty_schema) { frame, Static, "https://www.sourcemeta.com/schema", frame.root()); } -TEST(Foundation_frame_draft2, empty_schema_trailing_hash) { +TEST(Frame_draft2, empty_schema_trailing_hash) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "id": "https://www.sourcemeta.com/schema#", "$schema": "http://json-schema.org/draft-02/schema#" @@ -183,7 +184,7 @@ TEST(Foundation_frame_draft2, empty_schema_trailing_hash) { frame, Static, "https://www.sourcemeta.com/schema", frame.root()); } -TEST(Foundation_frame_draft2, one_level_applicators_without_identifiers) { +TEST(Frame_draft2, one_level_applicators_without_identifiers) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "id": "https://www.sourcemeta.com/schema", "$schema": "http://json-schema.org/draft-02/schema#", @@ -271,7 +272,7 @@ TEST(Foundation_frame_draft2, one_level_applicators_without_identifiers) { "https://www.sourcemeta.com/schema#/properties/foo"); } -TEST(Foundation_frame_draft2, one_level_applicators_with_identifiers) { +TEST(Frame_draft2, one_level_applicators_with_identifiers) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "id": "https://www.sourcemeta.com/test/qux", "$schema": "http://json-schema.org/draft-02/schema#", @@ -351,7 +352,7 @@ TEST(Foundation_frame_draft2, one_level_applicators_with_identifiers) { "https://www.sourcemeta.com/foo"); } -TEST(Foundation_frame_draft2, subschema_absolute_identifier) { +TEST(Frame_draft2, subschema_absolute_identifier) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "id": "https://www.sourcemeta.com/schema", "$schema": "http://json-schema.org/draft-02/schema#", @@ -433,7 +434,7 @@ TEST(Foundation_frame_draft2, subschema_absolute_identifier) { "https://www.sourcemeta.com/foo"); } -TEST(Foundation_frame_draft2, id_override) { +TEST(Frame_draft2, id_override) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "id": "https://www.sourcemeta.com/schema", "$schema": "http://json-schema.org/draft-02/schema#", @@ -447,7 +448,7 @@ TEST(Foundation_frame_draft2, id_override) { sourcemeta::blaze::SchemaFrameError); } -TEST(Foundation_frame_draft2, explicit_argument_id_same) { +TEST(Frame_draft2, explicit_argument_id_same) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "id": "https://www.sourcemeta.com/schema", "$schema": "http://json-schema.org/draft-02/schema#" @@ -492,7 +493,7 @@ TEST(Foundation_frame_draft2, explicit_argument_id_same) { frame, Static, "https://www.sourcemeta.com/schema", frame.root()); } -TEST(Foundation_frame_draft2, explicit_argument_id_different) { +TEST(Frame_draft2, explicit_argument_id_different) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "id": "https://www.sourcemeta.com/schema", "$schema": "http://json-schema.org/draft-02/schema#", @@ -627,7 +628,7 @@ TEST(Foundation_frame_draft2, explicit_argument_id_different) { "https://www.test.com"); } -TEST(Foundation_frame_draft2, ref_metaschema) { +TEST(Frame_draft2, ref_metaschema) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "http://json-schema.org/draft-02/schema#", "$ref": "http://json-schema.org/draft-02/schema#" diff --git a/test/foundation/foundation_frame_draft3_test.cc b/test/frame/frame_draft3_test.cc similarity index 97% rename from test/foundation/foundation_frame_draft3_test.cc rename to test/frame/frame_draft3_test.cc index 85820cb8e..292669525 100644 --- a/test/foundation/foundation_frame_draft3_test.cc +++ b/test/frame/frame_draft3_test.cc @@ -1,10 +1,11 @@ #include #include +#include #include #include -#include "foundation_test_utils.h" +#include "frame_test_utils.h" #define EXPECT_FRAME_STATIC_DRAFT3_POINTER( \ frame, reference, root_id, expected_pointer, expected_base, \ @@ -36,7 +37,7 @@ expected_relative_pointer, expected_parent, \ expected_property_name, expected_orphan); -TEST(Foundation_frame_draft3, anonymous_with_nested_schema_resource) { +TEST(Frame_draft3, anonymous_with_nested_schema_resource) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "http://json-schema.org/draft-03/schema#", "additionalProperties": { "id": "https://example.com" } @@ -97,7 +98,7 @@ TEST(Foundation_frame_draft3, anonymous_with_nested_schema_resource) { "https://example.com"); } -TEST(Foundation_frame_draft3, empty_schema) { +TEST(Frame_draft3, empty_schema) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "id": "https://www.sourcemeta.com/schema", "$schema": "http://json-schema.org/draft-03/schema#" @@ -140,7 +141,7 @@ TEST(Foundation_frame_draft3, empty_schema) { frame, Static, "https://www.sourcemeta.com/schema", frame.root()); } -TEST(Foundation_frame_draft3, empty_schema_trailing_slash) { +TEST(Frame_draft3, empty_schema_trailing_slash) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "id": "https://www.sourcemeta.com/schema#", "$schema": "http://json-schema.org/draft-03/schema#" @@ -183,7 +184,7 @@ TEST(Foundation_frame_draft3, empty_schema_trailing_slash) { frame, Static, "https://www.sourcemeta.com/schema", frame.root()); } -TEST(Foundation_frame_draft3, one_level_applicators_without_identifiers) { +TEST(Frame_draft3, one_level_applicators_without_identifiers) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "id": "https://www.sourcemeta.com/schema", "$schema": "http://json-schema.org/draft-03/schema#", @@ -271,7 +272,7 @@ TEST(Foundation_frame_draft3, one_level_applicators_without_identifiers) { "https://www.sourcemeta.com/schema#/properties/foo"); } -TEST(Foundation_frame_draft3, one_level_applicators_with_identifiers) { +TEST(Frame_draft3, one_level_applicators_with_identifiers) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "id": "https://www.sourcemeta.com/test/qux", "$schema": "http://json-schema.org/draft-03/schema#", @@ -351,7 +352,7 @@ TEST(Foundation_frame_draft3, one_level_applicators_with_identifiers) { "https://www.sourcemeta.com/foo"); } -TEST(Foundation_frame_draft3, subschema_absolute_identifier) { +TEST(Frame_draft3, subschema_absolute_identifier) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "id": "https://www.sourcemeta.com/schema", "$schema": "http://json-schema.org/draft-03/schema#", @@ -433,7 +434,7 @@ TEST(Foundation_frame_draft3, subschema_absolute_identifier) { "https://www.sourcemeta.com/foo"); } -TEST(Foundation_frame_draft3, id_override) { +TEST(Frame_draft3, id_override) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "id": "https://www.sourcemeta.com/schema", "$schema": "http://json-schema.org/draft-03/schema#", @@ -447,7 +448,7 @@ TEST(Foundation_frame_draft3, id_override) { sourcemeta::blaze::SchemaFrameError); } -TEST(Foundation_frame_draft3, explicit_argument_id_same) { +TEST(Frame_draft3, explicit_argument_id_same) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "id": "https://www.sourcemeta.com/schema", "$schema": "http://json-schema.org/draft-03/schema#" @@ -492,7 +493,7 @@ TEST(Foundation_frame_draft3, explicit_argument_id_same) { frame, Static, "https://www.sourcemeta.com/schema", frame.root()); } -TEST(Foundation_frame_draft3, explicit_argument_id_different) { +TEST(Frame_draft3, explicit_argument_id_different) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "id": "https://www.sourcemeta.com/schema", "$schema": "http://json-schema.org/draft-03/schema#", @@ -627,7 +628,7 @@ TEST(Foundation_frame_draft3, explicit_argument_id_different) { "https://www.test.com"); } -TEST(Foundation_frame_draft3, ref_metaschema) { +TEST(Frame_draft3, ref_metaschema) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "http://json-schema.org/draft-03/schema#", "$ref": "http://json-schema.org/draft-03/schema#" @@ -668,7 +669,7 @@ TEST(Foundation_frame_draft3, ref_metaschema) { EXPECT_FRAME_LOCATION_REACHABLE(frame, Static, "", frame.root()); } -TEST(Foundation_frame_draft3, ref_with_id) { +TEST(Frame_draft3, ref_with_id) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "id": "https://www.sourcemeta.com/schema", "$schema": "http://json-schema.org/draft-03/schema#", @@ -718,7 +719,7 @@ TEST(Foundation_frame_draft3, ref_with_id) { EXPECT_FRAME_LOCATION_REACHABLE(frame, Static, "", frame.root()); } -TEST(Foundation_frame_draft3, top_level_relative_ref_with_id) { +TEST(Frame_draft3, top_level_relative_ref_with_id) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "http://json-schema.org/draft-03/schema#", "id": "https://example.com/foo", @@ -759,7 +760,7 @@ TEST(Foundation_frame_draft3, top_level_relative_ref_with_id) { EXPECT_FRAME_LOCATION_REACHABLE(frame, Static, "", frame.root()); } -TEST(Foundation_frame_draft3, nested_relative_ref_with_id) { +TEST(Frame_draft3, nested_relative_ref_with_id) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "http://json-schema.org/draft-03/schema#", "id": "https://example.com", @@ -824,7 +825,7 @@ TEST(Foundation_frame_draft3, nested_relative_ref_with_id) { "https://example.com#/additionalProperties"); } -TEST(Foundation_frame_draft3, top_level_id_empty_fragment_only) { +TEST(Frame_draft3, top_level_id_empty_fragment_only) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "id": "#", "$schema": "http://json-schema.org/draft-03/schema#" @@ -863,7 +864,7 @@ TEST(Foundation_frame_draft3, top_level_id_empty_fragment_only) { EXPECT_FRAME_LOCATION_REACHABLE(frame, Static, "", frame.root()); } -TEST(Foundation_frame_draft3, top_level_id_empty_string) { +TEST(Frame_draft3, top_level_id_empty_string) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "id": "", "$schema": "http://json-schema.org/draft-03/schema#" @@ -902,7 +903,7 @@ TEST(Foundation_frame_draft3, top_level_id_empty_string) { EXPECT_FRAME_LOCATION_REACHABLE(frame, Static, "", frame.root()); } -TEST(Foundation_frame_draft3, id_fragment_rejected) { +TEST(Frame_draft3, id_fragment_rejected) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "id": "#foo", "$schema": "http://json-schema.org/draft-03/schema#" @@ -922,7 +923,7 @@ TEST(Foundation_frame_draft3, id_fragment_rejected) { } } -TEST(Foundation_frame_draft3, id_fragment_invalid_whitespace) { +TEST(Frame_draft3, id_fragment_invalid_whitespace) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "id": "#foo bar", "$schema": "http://json-schema.org/draft-03/schema#" @@ -943,7 +944,7 @@ TEST(Foundation_frame_draft3, id_fragment_invalid_whitespace) { } } -TEST(Foundation_frame_draft3, definitions_subschemas) { +TEST(Frame_draft3, definitions_subschemas) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "http://json-schema.org/draft-03/schema#", "definitions": { @@ -991,7 +992,7 @@ TEST(Foundation_frame_draft3, definitions_subschemas) { "#/definitions/string"); } -TEST(Foundation_frame_draft3, ref_into_definitions) { +TEST(Frame_draft3, ref_into_definitions) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "http://json-schema.org/draft-03/schema#", "properties": { diff --git a/test/foundation/foundation_frame_draft4_test.cc b/test/frame/frame_draft4_test.cc similarity index 97% rename from test/foundation/foundation_frame_draft4_test.cc rename to test/frame/frame_draft4_test.cc index 9c6d1e94d..9f600311e 100644 --- a/test/foundation/foundation_frame_draft4_test.cc +++ b/test/frame/frame_draft4_test.cc @@ -1,10 +1,11 @@ #include #include +#include #include #include -#include "foundation_test_utils.h" +#include "frame_test_utils.h" #define EXPECT_FRAME_STATIC_DRAFT4_POINTER( \ frame, reference, root_id, expected_pointer, expected_base, \ @@ -46,7 +47,7 @@ expected_relative_pointer, expected_parent, \ expected_property_name, expected_orphan); -TEST(Foundation_frame_draft4, anonymous_with_nested_schema_resource) { +TEST(Frame_draft4, anonymous_with_nested_schema_resource) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "http://json-schema.org/draft-04/schema#", "additionalProperties": { "id": "https://example.com" } @@ -109,7 +110,7 @@ TEST(Foundation_frame_draft4, anonymous_with_nested_schema_resource) { "https://example.com"); } -TEST(Foundation_frame_draft4, empty_schema) { +TEST(Frame_draft4, empty_schema) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "id": "https://www.sourcemeta.com/schema", "$schema": "http://json-schema.org/draft-04/schema#" @@ -152,7 +153,7 @@ TEST(Foundation_frame_draft4, empty_schema) { frame, Static, "https://www.sourcemeta.com/schema", frame.root()); } -TEST(Foundation_frame_draft4, empty_schema_trailing_hash) { +TEST(Frame_draft4, empty_schema_trailing_hash) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "id": "https://www.sourcemeta.com/schema#", "$schema": "http://json-schema.org/draft-04/schema#" @@ -195,7 +196,7 @@ TEST(Foundation_frame_draft4, empty_schema_trailing_hash) { frame, Static, "https://www.sourcemeta.com/schema", frame.root()); } -TEST(Foundation_frame_draft4, one_level_applicators_without_identifiers) { +TEST(Frame_draft4, one_level_applicators_without_identifiers) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "id": "https://www.sourcemeta.com/schema", "$schema": "http://json-schema.org/draft-04/schema#", @@ -283,7 +284,7 @@ TEST(Foundation_frame_draft4, one_level_applicators_without_identifiers) { "https://www.sourcemeta.com/schema#/properties/foo"); } -TEST(Foundation_frame_draft4, one_level_applicators_with_identifiers) { +TEST(Frame_draft4, one_level_applicators_with_identifiers) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "id": "https://www.sourcemeta.com/test/qux", "$schema": "http://json-schema.org/draft-04/schema#", @@ -363,7 +364,7 @@ TEST(Foundation_frame_draft4, one_level_applicators_with_identifiers) { "https://www.sourcemeta.com/foo"); } -TEST(Foundation_frame_draft4, subschema_absolute_identifier) { +TEST(Frame_draft4, subschema_absolute_identifier) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "id": "https://www.sourcemeta.com/schema", "$schema": "http://json-schema.org/draft-04/schema#", @@ -448,7 +449,7 @@ TEST(Foundation_frame_draft4, subschema_absolute_identifier) { "https://www.sourcemeta.com/foo"); } -TEST(Foundation_frame_draft4, id_override) { +TEST(Frame_draft4, id_override) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "id": "https://www.sourcemeta.com/schema", "$schema": "http://json-schema.org/draft-04/schema#", @@ -462,7 +463,7 @@ TEST(Foundation_frame_draft4, id_override) { sourcemeta::blaze::SchemaFrameError); } -TEST(Foundation_frame_draft4, explicit_argument_id_same) { +TEST(Frame_draft4, explicit_argument_id_same) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "id": "https://www.sourcemeta.com/schema", "$schema": "http://json-schema.org/draft-04/schema#" @@ -507,7 +508,7 @@ TEST(Foundation_frame_draft4, explicit_argument_id_same) { frame, Static, "https://www.sourcemeta.com/schema", frame.root()); } -TEST(Foundation_frame_draft4, explicit_argument_id_different) { +TEST(Frame_draft4, explicit_argument_id_different) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "id": "https://www.sourcemeta.com/schema", "$schema": "http://json-schema.org/draft-04/schema#", @@ -642,7 +643,7 @@ TEST(Foundation_frame_draft4, explicit_argument_id_different) { "https://www.test.com"); } -TEST(Foundation_frame_draft4, ref_metaschema) { +TEST(Frame_draft4, ref_metaschema) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "http://json-schema.org/draft-04/schema#", "$ref": "http://json-schema.org/draft-04/schema#" @@ -683,7 +684,7 @@ TEST(Foundation_frame_draft4, ref_metaschema) { EXPECT_FRAME_LOCATION_REACHABLE(frame, Static, "", frame.root()); } -TEST(Foundation_frame_draft4, location_independent_identifier_anonymous) { +TEST(Frame_draft4, location_independent_identifier_anonymous) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "http://json-schema.org/draft-04/schema#", "definitions": { @@ -775,7 +776,7 @@ TEST(Foundation_frame_draft4, location_independent_identifier_anonymous) { EXPECT_FRAME_LOCATION_REACHABLE(frame, Static, "#foo", "#/definitions/bar"); } -TEST(Foundation_frame_draft4, ref_with_id) { +TEST(Frame_draft4, ref_with_id) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "id": "https://www.sourcemeta.com/schema", "$schema": "http://json-schema.org/draft-04/schema#", @@ -840,8 +841,7 @@ TEST(Foundation_frame_draft4, ref_with_id) { EXPECT_FRAME_LOCATION_REACHABLE(frame, Static, "", frame.root()); } -TEST(Foundation_frame_draft4, - id_with_trailing_hash_and_ref_and_same_default_id) { +TEST(Frame_draft4, id_with_trailing_hash_and_ref_and_same_default_id) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "id": "https://www.sourcemeta.com/schema#", "$schema": "http://json-schema.org/draft-04/schema#", @@ -935,7 +935,7 @@ TEST(Foundation_frame_draft4, "https://www.sourcemeta.com/schema#/properties/bar"); } -TEST(Foundation_frame_draft4, relative_base_uri_without_ref) { +TEST(Frame_draft4, relative_base_uri_without_ref) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "http://json-schema.org/draft-04/schema#", "id": "common" @@ -973,7 +973,7 @@ TEST(Foundation_frame_draft4, relative_base_uri_without_ref) { EXPECT_FRAME_LOCATION_REACHABLE(frame, Static, "common", frame.root()); } -TEST(Foundation_frame_draft4, relative_base_uri_with_ref) { +TEST(Frame_draft4, relative_base_uri_with_ref) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "http://json-schema.org/draft-04/schema#", "id": "common", @@ -1064,7 +1064,7 @@ TEST(Foundation_frame_draft4, relative_base_uri_with_ref) { "common#/definitions/foo"); } -TEST(Foundation_frame_draft4, ref_with_invalid_type) { +TEST(Frame_draft4, ref_with_invalid_type) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "http://json-schema.org/draft-04/schema#", "$ref": 123 @@ -1085,7 +1085,7 @@ TEST(Foundation_frame_draft4, ref_with_invalid_type) { } } -TEST(Foundation_frame_draft4, ref_invalidates_sibling_subschemas_and_refs) { +TEST(Frame_draft4, ref_invalidates_sibling_subschemas_and_refs) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "http://json-schema.org/draft-04/schema#", "properties": { @@ -1174,7 +1174,7 @@ TEST(Foundation_frame_draft4, ref_invalidates_sibling_subschemas_and_refs) { "#/properties/foo"); } -TEST(Foundation_frame_draft4, top_level_relative_ref_with_id) { +TEST(Frame_draft4, top_level_relative_ref_with_id) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "http://json-schema.org/draft-04/schema#", "id": "https://example.com/foo", @@ -1215,7 +1215,7 @@ TEST(Foundation_frame_draft4, top_level_relative_ref_with_id) { EXPECT_FRAME_LOCATION_REACHABLE(frame, Static, "", frame.root()); } -TEST(Foundation_frame_draft4, nested_relative_ref_with_id) { +TEST(Frame_draft4, nested_relative_ref_with_id) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "http://json-schema.org/draft-04/schema#", "id": "https://example.com", @@ -1280,7 +1280,7 @@ TEST(Foundation_frame_draft4, nested_relative_ref_with_id) { "https://example.com#/additionalProperties"); } -TEST(Foundation_frame_draft4, invalid_id_not_string) { +TEST(Frame_draft4, invalid_id_not_string) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "http://json-schema.org/draft-04/schema", "id": 123 @@ -1301,7 +1301,7 @@ TEST(Foundation_frame_draft4, invalid_id_not_string) { } } -TEST(Foundation_frame_draft4, top_level_id_empty_fragment_only) { +TEST(Frame_draft4, top_level_id_empty_fragment_only) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "id": "#", "$schema": "http://json-schema.org/draft-04/schema#" @@ -1340,7 +1340,7 @@ TEST(Foundation_frame_draft4, top_level_id_empty_fragment_only) { EXPECT_FRAME_LOCATION_REACHABLE(frame, Static, "", frame.root()); } -TEST(Foundation_frame_draft4, top_level_id_empty_string) { +TEST(Frame_draft4, top_level_id_empty_string) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "id": "", "$schema": "http://json-schema.org/draft-04/schema#" @@ -1379,7 +1379,7 @@ TEST(Foundation_frame_draft4, top_level_id_empty_string) { EXPECT_FRAME_LOCATION_REACHABLE(frame, Static, "", frame.root()); } -TEST(Foundation_frame_draft4, id_fragment_invalid_whitespace) { +TEST(Frame_draft4, id_fragment_invalid_whitespace) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "http://json-schema.org/draft-04/schema#", "definitions": { @@ -1404,7 +1404,7 @@ TEST(Foundation_frame_draft4, id_fragment_invalid_whitespace) { } } -TEST(Foundation_frame_draft4, id_fragment_invalid_angle_bracket) { +TEST(Frame_draft4, id_fragment_invalid_angle_bracket) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "http://json-schema.org/draft-04/schema#", "definitions": { diff --git a/test/foundation/foundation_frame_draft6_test.cc b/test/frame/frame_draft6_test.cc similarity index 97% rename from test/foundation/foundation_frame_draft6_test.cc rename to test/frame/frame_draft6_test.cc index 950825cf8..3d95ee00d 100644 --- a/test/foundation/foundation_frame_draft6_test.cc +++ b/test/frame/frame_draft6_test.cc @@ -1,10 +1,11 @@ #include #include +#include #include #include -#include "foundation_test_utils.h" +#include "frame_test_utils.h" #define EXPECT_FRAME_STATIC_DRAFT6_POINTER( \ frame, reference, root_id, expected_pointer, expected_base, \ @@ -46,7 +47,7 @@ expected_relative_pointer, expected_parent, \ expected_property_name, expected_orphan); -TEST(Foundation_frame_draft6, anonymous_with_nested_schema_resource) { +TEST(Frame_draft6, anonymous_with_nested_schema_resource) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "http://json-schema.org/draft-06/schema#", "additionalProperties": { "$id": "https://example.com" } @@ -109,7 +110,7 @@ TEST(Foundation_frame_draft6, anonymous_with_nested_schema_resource) { "https://example.com"); } -TEST(Foundation_frame_draft6, empty_schema) { +TEST(Frame_draft6, empty_schema) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://www.sourcemeta.com/schema", "$schema": "http://json-schema.org/draft-06/schema#" @@ -152,7 +153,7 @@ TEST(Foundation_frame_draft6, empty_schema) { frame, Static, "https://www.sourcemeta.com/schema", frame.root()); } -TEST(Foundation_frame_draft6, empty_schema_trailing_hash) { +TEST(Frame_draft6, empty_schema_trailing_hash) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://www.sourcemeta.com/schema#", "$schema": "http://json-schema.org/draft-06/schema#" @@ -195,7 +196,7 @@ TEST(Foundation_frame_draft6, empty_schema_trailing_hash) { frame, Static, "https://www.sourcemeta.com/schema", frame.root()); } -TEST(Foundation_frame_draft6, one_level_applicators_without_identifiers) { +TEST(Frame_draft6, one_level_applicators_without_identifiers) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://www.sourcemeta.com/schema", "$schema": "http://json-schema.org/draft-06/schema#", @@ -283,7 +284,7 @@ TEST(Foundation_frame_draft6, one_level_applicators_without_identifiers) { "https://www.sourcemeta.com/schema#/properties/foo"); } -TEST(Foundation_frame_draft6, one_level_applicators_with_identifiers) { +TEST(Frame_draft6, one_level_applicators_with_identifiers) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://www.sourcemeta.com/test/qux", "$schema": "http://json-schema.org/draft-06/schema#", @@ -366,7 +367,7 @@ TEST(Foundation_frame_draft6, one_level_applicators_with_identifiers) { "https://www.sourcemeta.com/foo"); } -TEST(Foundation_frame_draft6, subschema_absolute_identifier) { +TEST(Frame_draft6, subschema_absolute_identifier) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://www.sourcemeta.com/schema", "$schema": "http://json-schema.org/draft-06/schema#", @@ -451,7 +452,7 @@ TEST(Foundation_frame_draft6, subschema_absolute_identifier) { "https://www.sourcemeta.com/foo"); } -TEST(Foundation_frame_draft6, id_override) { +TEST(Frame_draft6, id_override) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://www.sourcemeta.com/schema", "$schema": "http://json-schema.org/draft-06/schema#", @@ -465,7 +466,7 @@ TEST(Foundation_frame_draft6, id_override) { sourcemeta::blaze::SchemaFrameError); } -TEST(Foundation_frame_draft6, explicit_argument_id_same) { +TEST(Frame_draft6, explicit_argument_id_same) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://www.sourcemeta.com/schema", "$schema": "http://json-schema.org/draft-06/schema#" @@ -510,7 +511,7 @@ TEST(Foundation_frame_draft6, explicit_argument_id_same) { frame, Static, "https://www.sourcemeta.com/schema", frame.root()); } -TEST(Foundation_frame_draft6, explicit_argument_id_different) { +TEST(Frame_draft6, explicit_argument_id_different) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://www.sourcemeta.com/schema", "$schema": "http://json-schema.org/draft-06/schema#", @@ -643,7 +644,7 @@ TEST(Foundation_frame_draft6, explicit_argument_id_different) { "https://www.test.com"); } -TEST(Foundation_frame_draft6, ref_metaschema) { +TEST(Frame_draft6, ref_metaschema) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "http://json-schema.org/draft-06/schema#", "$ref": "http://json-schema.org/draft-06/schema#" @@ -684,7 +685,7 @@ TEST(Foundation_frame_draft6, ref_metaschema) { EXPECT_FRAME_LOCATION_REACHABLE(frame, Static, "", frame.root()); } -TEST(Foundation_frame_draft6, location_independent_identifier_anonymous) { +TEST(Frame_draft6, location_independent_identifier_anonymous) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "http://json-schema.org/draft-06/schema#", "definitions": { @@ -777,7 +778,7 @@ TEST(Foundation_frame_draft6, location_independent_identifier_anonymous) { EXPECT_FRAME_LOCATION_REACHABLE(frame, Static, "#foo", "#/definitions/bar"); } -TEST(Foundation_frame_draft6, ref_with_id) { +TEST(Frame_draft6, ref_with_id) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://www.sourcemeta.com/schema", "$schema": "http://json-schema.org/draft-06/schema#", @@ -842,7 +843,7 @@ TEST(Foundation_frame_draft6, ref_with_id) { EXPECT_FRAME_LOCATION_REACHABLE(frame, Static, "", frame.root()); } -TEST(Foundation_frame_draft6, relative_base_uri_without_ref) { +TEST(Frame_draft6, relative_base_uri_without_ref) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "http://json-schema.org/draft-06/schema#", "$id": "common" @@ -880,7 +881,7 @@ TEST(Foundation_frame_draft6, relative_base_uri_without_ref) { EXPECT_FRAME_LOCATION_REACHABLE(frame, Static, "common", frame.root()); } -TEST(Foundation_frame_draft6, relative_base_uri_with_ref) { +TEST(Frame_draft6, relative_base_uri_with_ref) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "http://json-schema.org/draft-06/schema#", "$id": "common", @@ -953,7 +954,7 @@ TEST(Foundation_frame_draft6, relative_base_uri_with_ref) { frame.root()); } -TEST(Foundation_frame_draft6, ref_invalidates_sibling_subschemas_and_refs) { +TEST(Frame_draft6, ref_invalidates_sibling_subschemas_and_refs) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "http://json-schema.org/draft-06/schema#", "properties": { @@ -1042,7 +1043,7 @@ TEST(Foundation_frame_draft6, ref_invalidates_sibling_subschemas_and_refs) { "#/properties/foo"); } -TEST(Foundation_frame_draft6, top_level_relative_ref_with_id) { +TEST(Frame_draft6, top_level_relative_ref_with_id) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "http://json-schema.org/draft-06/schema#", "$id": "https://example.com/foo", @@ -1083,7 +1084,7 @@ TEST(Foundation_frame_draft6, top_level_relative_ref_with_id) { EXPECT_FRAME_LOCATION_REACHABLE(frame, Static, "", frame.root()); } -TEST(Foundation_frame_draft6, nested_relative_ref_with_id) { +TEST(Frame_draft6, nested_relative_ref_with_id) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "http://json-schema.org/draft-06/schema#", "$id": "https://example.com", @@ -1141,7 +1142,7 @@ TEST(Foundation_frame_draft6, nested_relative_ref_with_id) { frame, Static, "https://example.com#/additionalProperties", frame.root()); } -TEST(Foundation_frame_draft6, propertyNames_with_nested_applicators) { +TEST(Frame_draft6, propertyNames_with_nested_applicators) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "http://json-schema.org/draft-06/schema#", "propertyNames": { @@ -1251,7 +1252,7 @@ TEST(Foundation_frame_draft6, propertyNames_with_nested_applicators) { frame, Static, "#/propertyNames/definitions/test", frame.root()); } -TEST(Foundation_frame_draft6, top_level_id_empty_fragment_only) { +TEST(Frame_draft6, top_level_id_empty_fragment_only) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "#", "$schema": "http://json-schema.org/draft-06/schema#" @@ -1290,7 +1291,7 @@ TEST(Foundation_frame_draft6, top_level_id_empty_fragment_only) { EXPECT_FRAME_LOCATION_REACHABLE(frame, Static, "", frame.root()); } -TEST(Foundation_frame_draft6, top_level_id_empty_string) { +TEST(Frame_draft6, top_level_id_empty_string) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "", "$schema": "http://json-schema.org/draft-06/schema#" @@ -1329,7 +1330,7 @@ TEST(Foundation_frame_draft6, top_level_id_empty_string) { EXPECT_FRAME_LOCATION_REACHABLE(frame, Static, "", frame.root()); } -TEST(Foundation_frame_draft6, id_fragment_invalid_leading_digit) { +TEST(Frame_draft6, id_fragment_invalid_leading_digit) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "http://json-schema.org/draft-06/schema#", "definitions": { @@ -1354,7 +1355,7 @@ TEST(Foundation_frame_draft6, id_fragment_invalid_leading_digit) { } } -TEST(Foundation_frame_draft6, id_fragment_invalid_punctuation) { +TEST(Frame_draft6, id_fragment_invalid_punctuation) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "http://json-schema.org/draft-06/schema#", "definitions": { @@ -1379,7 +1380,7 @@ TEST(Foundation_frame_draft6, id_fragment_invalid_punctuation) { } } -TEST(Foundation_frame_draft6, id_fragment_invalid_leading_underscore) { +TEST(Frame_draft6, id_fragment_invalid_leading_underscore) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "http://json-schema.org/draft-06/schema#", "definitions": { diff --git a/test/foundation/foundation_frame_draft7_test.cc b/test/frame/frame_draft7_test.cc similarity index 97% rename from test/foundation/foundation_frame_draft7_test.cc rename to test/frame/frame_draft7_test.cc index c019fda4c..3736e0c90 100644 --- a/test/foundation/foundation_frame_draft7_test.cc +++ b/test/frame/frame_draft7_test.cc @@ -1,10 +1,11 @@ #include #include +#include #include #include -#include "foundation_test_utils.h" +#include "frame_test_utils.h" #define EXPECT_FRAME_STATIC_DRAFT7_POINTER( \ frame, reference, root_id, expected_pointer, expected_base, \ @@ -46,7 +47,7 @@ expected_relative_pointer, expected_parent, \ expected_property_name, expected_orphan); -TEST(Foundation_frame_draft7, anonymous_with_nested_schema_resource) { +TEST(Frame_draft7, anonymous_with_nested_schema_resource) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": { "$id": "https://example.com" } @@ -109,7 +110,7 @@ TEST(Foundation_frame_draft7, anonymous_with_nested_schema_resource) { "https://example.com"); } -TEST(Foundation_frame_draft7, empty_schema) { +TEST(Frame_draft7, empty_schema) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://www.sourcemeta.com/schema", "$schema": "http://json-schema.org/draft-07/schema#" @@ -152,7 +153,7 @@ TEST(Foundation_frame_draft7, empty_schema) { frame, Static, "https://www.sourcemeta.com/schema", frame.root()); } -TEST(Foundation_frame_draft7, empty_schema_trailing_hash) { +TEST(Frame_draft7, empty_schema_trailing_hash) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://www.sourcemeta.com/schema#", "$schema": "http://json-schema.org/draft-07/schema#" @@ -195,7 +196,7 @@ TEST(Foundation_frame_draft7, empty_schema_trailing_hash) { frame, Static, "https://www.sourcemeta.com/schema", frame.root()); } -TEST(Foundation_frame_draft7, one_level_applicators_without_identifiers) { +TEST(Frame_draft7, one_level_applicators_without_identifiers) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://www.sourcemeta.com/schema", "$schema": "http://json-schema.org/draft-07/schema#", @@ -289,7 +290,7 @@ TEST(Foundation_frame_draft7, one_level_applicators_without_identifiers) { "https://www.sourcemeta.com/schema#/properties/foo"); } -TEST(Foundation_frame_draft7, one_level_applicators_with_identifiers) { +TEST(Frame_draft7, one_level_applicators_with_identifiers) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://www.sourcemeta.com/test/qux", "$schema": "http://json-schema.org/draft-07/schema#", @@ -372,7 +373,7 @@ TEST(Foundation_frame_draft7, one_level_applicators_with_identifiers) { "https://www.sourcemeta.com/foo"); } -TEST(Foundation_frame_draft7, subschema_absolute_identifier) { +TEST(Frame_draft7, subschema_absolute_identifier) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://www.sourcemeta.com/schema", "$schema": "http://json-schema.org/draft-07/schema#", @@ -457,7 +458,7 @@ TEST(Foundation_frame_draft7, subschema_absolute_identifier) { "https://www.sourcemeta.com/foo"); } -TEST(Foundation_frame_draft7, id_override) { +TEST(Frame_draft7, id_override) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://www.sourcemeta.com/schema", "$schema": "http://json-schema.org/draft-07/schema#", @@ -471,7 +472,7 @@ TEST(Foundation_frame_draft7, id_override) { sourcemeta::blaze::SchemaFrameError); } -TEST(Foundation_frame_draft7, explicit_argument_id_same) { +TEST(Frame_draft7, explicit_argument_id_same) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://www.sourcemeta.com/schema", "$schema": "http://json-schema.org/draft-07/schema#" @@ -516,7 +517,7 @@ TEST(Foundation_frame_draft7, explicit_argument_id_same) { frame, Static, "https://www.sourcemeta.com/schema", frame.root()); } -TEST(Foundation_frame_draft7, explicit_argument_id_different) { +TEST(Frame_draft7, explicit_argument_id_different) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://www.sourcemeta.com/schema", "$schema": "http://json-schema.org/draft-07/schema#", @@ -632,7 +633,7 @@ TEST(Foundation_frame_draft7, explicit_argument_id_different) { frame, Static, "https://www.example.com#/properties/two", frame.root()); } -TEST(Foundation_frame_draft7, ref_metaschema) { +TEST(Frame_draft7, ref_metaschema) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "http://json-schema.org/draft-07/schema#", "$ref": "http://json-schema.org/draft-07/schema#" @@ -673,7 +674,7 @@ TEST(Foundation_frame_draft7, ref_metaschema) { EXPECT_FRAME_LOCATION_REACHABLE(frame, Static, "", frame.root()); } -TEST(Foundation_frame_draft7, location_independent_identifier_anonymous) { +TEST(Frame_draft7, location_independent_identifier_anonymous) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "http://json-schema.org/draft-07/schema#", "definitions": { @@ -766,7 +767,7 @@ TEST(Foundation_frame_draft7, location_independent_identifier_anonymous) { EXPECT_FRAME_LOCATION_REACHABLE(frame, Static, "#foo", "#/definitions/bar"); } -TEST(Foundation_frame_draft7, ref_with_id) { +TEST(Frame_draft7, ref_with_id) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://www.sourcemeta.com/schema", "$schema": "http://json-schema.org/draft-07/schema#", @@ -831,7 +832,7 @@ TEST(Foundation_frame_draft7, ref_with_id) { EXPECT_FRAME_LOCATION_REACHABLE(frame, Static, "", frame.root()); } -TEST(Foundation_frame_draft7, ref_with_definitions) { +TEST(Frame_draft7, ref_with_definitions) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "http://json-schema.org/draft-07/schema#", "$ref": "#/definitions/string", @@ -890,7 +891,7 @@ TEST(Foundation_frame_draft7, ref_with_definitions) { EXPECT_FRAME_LOCATION_REACHABLE(frame, Static, "", frame.root()); } -TEST(Foundation_frame_draft7, ref_with_properties) { +TEST(Frame_draft7, ref_with_properties) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "http://json-schema.org/draft-07/schema#", "$ref": "#/properties/string", @@ -946,7 +947,7 @@ TEST(Foundation_frame_draft7, ref_with_properties) { EXPECT_FRAME_LOCATION_REACHABLE(frame, Static, "", frame.root()); } -TEST(Foundation_frame_draft7, relative_base_uri_without_ref) { +TEST(Frame_draft7, relative_base_uri_without_ref) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "http://json-schema.org/draft-07/schema#", "$id": "common" @@ -984,7 +985,7 @@ TEST(Foundation_frame_draft7, relative_base_uri_without_ref) { EXPECT_FRAME_LOCATION_REACHABLE(frame, Static, "common", frame.root()); } -TEST(Foundation_frame_draft7, relative_base_uri_with_ref) { +TEST(Frame_draft7, relative_base_uri_with_ref) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "http://json-schema.org/draft-07/schema#", "$id": "common", @@ -1057,7 +1058,7 @@ TEST(Foundation_frame_draft7, relative_base_uri_with_ref) { frame.root()); } -TEST(Foundation_frame_draft7, ref_invalidates_sibling_subschemas_and_refs) { +TEST(Frame_draft7, ref_invalidates_sibling_subschemas_and_refs) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "http://json-schema.org/draft-07/schema#", "properties": { @@ -1146,7 +1147,7 @@ TEST(Foundation_frame_draft7, ref_invalidates_sibling_subschemas_and_refs) { "#/properties/foo"); } -TEST(Foundation_frame_draft7, top_level_relative_ref_with_id) { +TEST(Frame_draft7, top_level_relative_ref_with_id) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "http://json-schema.org/draft-07/schema#", "$id": "https://example.com/foo", @@ -1187,7 +1188,7 @@ TEST(Foundation_frame_draft7, top_level_relative_ref_with_id) { EXPECT_FRAME_LOCATION_REACHABLE(frame, Static, "", frame.root()); } -TEST(Foundation_frame_draft7, nested_relative_ref_with_id) { +TEST(Frame_draft7, nested_relative_ref_with_id) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "http://json-schema.org/draft-07/schema#", "$id": "https://example.com", @@ -1245,7 +1246,7 @@ TEST(Foundation_frame_draft7, nested_relative_ref_with_id) { frame, Static, "https://example.com#/additionalProperties", frame.root()); } -TEST(Foundation_frame_draft7, top_level_id_empty_fragment_only) { +TEST(Frame_draft7, top_level_id_empty_fragment_only) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "#", "$schema": "http://json-schema.org/draft-07/schema#" @@ -1284,7 +1285,7 @@ TEST(Foundation_frame_draft7, top_level_id_empty_fragment_only) { EXPECT_FRAME_LOCATION_REACHABLE(frame, Static, "", frame.root()); } -TEST(Foundation_frame_draft7, top_level_id_empty_string) { +TEST(Frame_draft7, top_level_id_empty_string) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "", "$schema": "http://json-schema.org/draft-07/schema#" @@ -1323,7 +1324,7 @@ TEST(Foundation_frame_draft7, top_level_id_empty_string) { EXPECT_FRAME_LOCATION_REACHABLE(frame, Static, "", frame.root()); } -TEST(Foundation_frame_draft7, id_fragment_invalid_leading_digit) { +TEST(Frame_draft7, id_fragment_invalid_leading_digit) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "http://json-schema.org/draft-07/schema#", "definitions": { @@ -1348,7 +1349,7 @@ TEST(Foundation_frame_draft7, id_fragment_invalid_leading_digit) { } } -TEST(Foundation_frame_draft7, id_fragment_invalid_punctuation) { +TEST(Frame_draft7, id_fragment_invalid_punctuation) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "http://json-schema.org/draft-07/schema#", "definitions": { @@ -1373,7 +1374,7 @@ TEST(Foundation_frame_draft7, id_fragment_invalid_punctuation) { } } -TEST(Foundation_frame_draft7, id_fragment_invalid_at_sign) { +TEST(Frame_draft7, id_fragment_invalid_at_sign) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "http://json-schema.org/draft-07/schema#", "definitions": { @@ -1398,7 +1399,7 @@ TEST(Foundation_frame_draft7, id_fragment_invalid_at_sign) { } } -TEST(Foundation_frame_draft7, id_fragment_invalid_leading_underscore) { +TEST(Frame_draft7, id_fragment_invalid_leading_underscore) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "http://json-schema.org/draft-07/schema#", "definitions": { diff --git a/test/foundation/foundation_frame_test.cc b/test/frame/frame_test.cc similarity index 98% rename from test/foundation/foundation_frame_test.cc rename to test/frame/frame_test.cc index 5d30ef68f..ef7eda8fa 100644 --- a/test/foundation/foundation_frame_test.cc +++ b/test/frame/frame_test.cc @@ -1,15 +1,16 @@ #include #include +#include #include #include #include #include -#include "foundation_test_utils.h" +#include "frame_test_utils.h" -TEST(Foundation_frame, nested_schemas_mixing_dialects) { +TEST(Frame, nested_schemas_mixing_dialects) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://www.sourcemeta.com/test", "$schema": "https://json-schema.org/draft/2020-12/schema", @@ -165,7 +166,7 @@ TEST(Foundation_frame, nested_schemas_mixing_dialects) { "http://json-schema.org/draft-04/schema#"); } -TEST(Foundation_frame, nested_schemas_sibling_ref_nested_2020_12_draft7) { +TEST(Frame, nested_schemas_sibling_ref_nested_2020_12_draft7) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "https://example.com/main", @@ -330,8 +331,7 @@ TEST(Foundation_frame, nested_schemas_sibling_ref_nested_2020_12_draft7) { "#/definitions/foo"); } -TEST(Foundation_frame, - nested_schemas_sibling_ref_nested_2020_12_draft7_with_allof) { +TEST(Frame, nested_schemas_sibling_ref_nested_2020_12_draft7_with_allof) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "https://example.com/main", @@ -512,7 +512,7 @@ TEST(Foundation_frame, "#/definitions/foo"); } -TEST(Foundation_frame, nested_schemas_sibling_ref_nested_2020_12_draft4) { +TEST(Frame, nested_schemas_sibling_ref_nested_2020_12_draft4) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "https://example.com/main", @@ -635,7 +635,7 @@ TEST(Foundation_frame, nested_schemas_sibling_ref_nested_2020_12_draft4) { "#/definitions/foo"); } -TEST(Foundation_frame, no_id) { +TEST(Frame, no_id) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2020-12/schema", "properties": { @@ -732,7 +732,7 @@ TEST(Foundation_frame, no_id) { "https://json-schema.org/draft/2020-12/schema"); } -TEST(Foundation_frame, no_id_with_default) { +TEST(Frame, no_id_with_default) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2020-12/schema", "items": { "type": "string" } @@ -778,7 +778,7 @@ TEST(Foundation_frame, no_id_with_default) { "https://json-schema.org/draft/2020-12/schema"); } -TEST(Foundation_frame, id_with_default_id) { +TEST(Frame, id_with_default_id) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://example.com", "$schema": "https://json-schema.org/draft/2020-12/schema", @@ -852,7 +852,7 @@ TEST(Foundation_frame, id_with_default_id) { "https://json-schema.org/draft/2020-12/schema"); } -TEST(Foundation_frame, cross_2020_12_to_2019_09_without_id) { +TEST(Frame, cross_2020_12_to_2019_09_without_id) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2020-12/schema", "$defs": { @@ -895,7 +895,7 @@ TEST(Foundation_frame, cross_2020_12_to_2019_09_without_id) { "/$defs/schema", false, true); } -TEST(Foundation_frame, cross_2020_12_to_draft7_without_id) { +TEST(Frame, cross_2020_12_to_draft7_without_id) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2020-12/schema", "$defs": { @@ -937,7 +937,7 @@ TEST(Foundation_frame, cross_2020_12_to_draft7_without_id) { "/$defs/schema", false, true); } -TEST(Foundation_frame, cross_2020_12_to_draft6_without_id) { +TEST(Frame, cross_2020_12_to_draft6_without_id) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2020-12/schema", "$defs": { @@ -979,7 +979,7 @@ TEST(Foundation_frame, cross_2020_12_to_draft6_without_id) { "/$defs/schema", false, true); } -TEST(Foundation_frame, cross_2020_12_to_draft4_without_id) { +TEST(Frame, cross_2020_12_to_draft4_without_id) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2020-12/schema", "$defs": { @@ -1021,7 +1021,7 @@ TEST(Foundation_frame, cross_2020_12_to_draft4_without_id) { "/$defs/schema", false, true); } -TEST(Foundation_frame, cross_draft7_to_draft4_without_id) { +TEST(Frame, cross_draft7_to_draft4_without_id) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "http://json-schema.org/draft-07/schema#", "definitions": { @@ -1062,7 +1062,7 @@ TEST(Foundation_frame, cross_draft7_to_draft4_without_id) { "/definitions/schema", false, true); } -TEST(Foundation_frame, cross_draft7_to_2020_12_without_id) { +TEST(Frame, cross_draft7_to_2020_12_without_id) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "http://json-schema.org/draft-07/schema#", "definitions": { @@ -1105,7 +1105,7 @@ TEST(Foundation_frame, cross_draft7_to_2020_12_without_id) { "/definitions/schema", false, true); } -TEST(Foundation_frame, anchor_on_absolute_subid) { +TEST(Frame, anchor_on_absolute_subid) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://www.example.com", "$schema": "https://json-schema.org/draft/2020-12/schema", @@ -1194,7 +1194,7 @@ TEST(Foundation_frame, anchor_on_absolute_subid) { "https://json-schema.org/draft/2020-12/schema"); } -TEST(Foundation_frame, uri_iterators) { +TEST(Frame, uri_iterators) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://www.sourcemeta.com/schema", "$schema": "https://json-schema.org/draft/2020-12/schema", @@ -1242,7 +1242,7 @@ TEST(Foundation_frame, uri_iterators) { "https://json-schema.org/draft/2020-12/schema"); } -TEST(Foundation_frame, no_refs) { +TEST(Frame, no_refs) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://www.sourcemeta.com/schema", "$schema": "https://json-schema.org/draft/2020-12/schema", @@ -1266,7 +1266,7 @@ TEST(Foundation_frame, no_refs) { "https://json-schema.org/draft/2020-12/schema"); } -TEST(Foundation_frame, refs_with_id) { +TEST(Frame, refs_with_id) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://www.sourcemeta.com/schema", "$schema": "https://json-schema.org/draft/2020-12/schema", @@ -1312,7 +1312,7 @@ TEST(Foundation_frame, refs_with_id) { "https://www.sourcemeta.com/schema", "baz", "#baz"); } -TEST(Foundation_frame, refs_with_no_id) { +TEST(Frame, refs_with_no_id) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2020-12/schema", "properties": { @@ -1353,7 +1353,7 @@ TEST(Foundation_frame, refs_with_no_id) { "#baz"); } -TEST(Foundation_frame, no_dynamic_ref_on_old_drafts) { +TEST(Frame, no_dynamic_ref_on_old_drafts) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://www.sourcemeta.com/schema", "$schema": "https://json-schema.org/draft/2019-09/schema", @@ -1375,7 +1375,7 @@ TEST(Foundation_frame, no_dynamic_ref_on_old_drafts) { "https://json-schema.org/draft/2019-09/schema"); } -TEST(Foundation_frame, remote_refs) { +TEST(Frame, remote_refs) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2020-12/schema", "properties": { @@ -1408,7 +1408,7 @@ TEST(Foundation_frame, remote_refs) { "https://www.example.com/x/y#/foo/bar"); } -TEST(Foundation_frame, standalone_with_external_refs) { +TEST(Frame, standalone_with_external_refs) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2020-12/schema", "properties": { @@ -1425,7 +1425,7 @@ TEST(Foundation_frame, standalone_with_external_refs) { EXPECT_FALSE(frame.standalone()); } -TEST(Foundation_frame, standalone_with_embedded_external_refs) { +TEST(Frame, standalone_with_embedded_external_refs) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2020-12/schema", "properties": { @@ -1447,7 +1447,7 @@ TEST(Foundation_frame, standalone_with_embedded_external_refs) { EXPECT_TRUE(frame.standalone()); } -TEST(Foundation_frame, standalone_with_internal_refs) { +TEST(Frame, standalone_with_internal_refs) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2020-12/schema", "properties": { @@ -1464,7 +1464,7 @@ TEST(Foundation_frame, standalone_with_internal_refs) { EXPECT_TRUE(frame.standalone()); } -TEST(Foundation_frame, standalone_without_refs) { +TEST(Frame, standalone_without_refs) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2020-12/schema", "properties": { @@ -1480,7 +1480,7 @@ TEST(Foundation_frame, standalone_without_refs) { EXPECT_TRUE(frame.standalone()); } -TEST(Foundation_frame, standalone_with_draft3_external_ref) { +TEST(Frame, standalone_with_draft3_external_ref) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "id": "https://example.com", "$schema": "http://json-schema.org/draft-03/schema#", @@ -1497,7 +1497,7 @@ TEST(Foundation_frame, standalone_with_draft3_external_ref) { EXPECT_FALSE(frame.standalone()); } -TEST(Foundation_frame, no_dialect) { +TEST(Frame, no_dialect) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "type": "string" })JSON"); @@ -1509,7 +1509,7 @@ TEST(Foundation_frame, no_dialect) { sourcemeta::blaze::SchemaUnknownBaseDialectError); } -TEST(Foundation_frame, mode_references) { +TEST(Frame, mode_references) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://www.example.com", "$schema": "https://json-schema.org/draft/2020-12/schema", @@ -1593,7 +1593,7 @@ TEST(Foundation_frame, mode_references) { "https://www.example.com", "/$defs/helper", "#/$defs/helper"); } -TEST(Foundation_frame, mode_locations) { +TEST(Frame, mode_locations) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://www.example.com", "$schema": "https://json-schema.org/draft/2020-12/schema", @@ -1668,7 +1668,7 @@ TEST(Foundation_frame, mode_locations) { EXPECT_EQ(frame.references().size(), 0); } -TEST(Foundation_frame, has_references_to_2020_12) { +TEST(Frame, has_references_to_2020_12) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://example.com", "$schema": "https://json-schema.org/draft/2020-12/schema", @@ -1732,7 +1732,7 @@ TEST(Foundation_frame, has_references_to_2020_12) { sourcemeta::core::to_weak_pointer(defs_dynamic_non_anchor))); } -TEST(Foundation_frame, has_references_to_2019_09) { +TEST(Frame, has_references_to_2019_09) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://example.com", "$schema": "https://json-schema.org/draft/2019-09/schema", @@ -1790,7 +1790,7 @@ TEST(Foundation_frame, has_references_to_2019_09) { sourcemeta::core::to_weak_pointer(defs_bookending))); } -TEST(Foundation_frame, has_references_through) { +TEST(Frame, has_references_through) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://example.com", "$schema": "https://json-schema.org/draft/2020-12/schema", @@ -1829,7 +1829,7 @@ TEST(Foundation_frame, has_references_through) { frame.has_references_through(sourcemeta::core::to_weak_pointer(defs))); } -TEST(Foundation_frame, has_references_through_without_id) { +TEST(Frame, has_references_through_without_id) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2020-12/schema", "contentSchema": true, @@ -1851,7 +1851,7 @@ TEST(Foundation_frame, has_references_through_without_id) { sourcemeta::core::to_weak_pointer(content_schema))); } -TEST(Foundation_frame, to_json_empty) { +TEST(Frame, to_json_empty) { sourcemeta::blaze::SchemaFrame frame{ sourcemeta::blaze::SchemaFrame::Mode::References}; const auto result{frame.to_json()}; @@ -1866,7 +1866,7 @@ TEST(Foundation_frame, to_json_empty) { EXPECT_EQ(result, expected); } -TEST(Foundation_frame, to_json_mode_references) { +TEST(Frame, to_json_mode_references) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://www.sourcemeta.com/test", "$schema": "https://json-schema.org/draft/2020-12/schema", @@ -2108,7 +2108,7 @@ TEST(Foundation_frame, to_json_mode_references) { EXPECT_EQ(result, expected); } -TEST(Foundation_frame, to_json_mode_locations) { +TEST(Frame, to_json_mode_locations) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$id": "https://www.sourcemeta.com/test", "$schema": "https://json-schema.org/draft/2020-12/schema", @@ -2325,7 +2325,7 @@ TEST(Foundation_frame, to_json_mode_locations) { EXPECT_EQ(result, expected); } -TEST(Foundation_frame, to_json_mode_references_with_tracking) { +TEST(Frame, to_json_mode_references_with_tracking) { sourcemeta::core::PointerPositionTracker tracker; sourcemeta::core::JSON document{nullptr}; sourcemeta::core::parse_json(R"JSON({ @@ -2570,7 +2570,7 @@ TEST(Foundation_frame, to_json_mode_references_with_tracking) { EXPECT_EQ(result, expected); } -TEST(Foundation_frame, to_json_mode_references_with_tracking_empty) { +TEST(Frame, to_json_mode_references_with_tracking_empty) { sourcemeta::core::PointerPositionTracker tracker; // Note we purposely don't pass the tracker to the document @@ -2815,7 +2815,7 @@ TEST(Foundation_frame, to_json_mode_references_with_tracking_empty) { EXPECT_EQ(result, expected); } -TEST(Foundation_frame, invalid_schema_not_string) { +TEST(Frame, invalid_schema_not_string) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": 123 })JSON"); @@ -2835,7 +2835,7 @@ TEST(Foundation_frame, invalid_schema_not_string) { } } -TEST(Foundation_frame, invalid_schema_not_uri) { +TEST(Frame, invalid_schema_not_uri) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "not a valid uri" })JSON"); @@ -2855,7 +2855,7 @@ TEST(Foundation_frame, invalid_schema_not_uri) { } } -TEST(Foundation_frame, override_induces_resource_boundary) { +TEST(Frame, override_induces_resource_boundary) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "http://json-schema.org/draft-04/schema#", "id": "http://example.com/parent", @@ -2949,7 +2949,7 @@ TEST(Foundation_frame, override_induces_resource_boundary) { "http://json-schema.org/draft-04/schema#"); } -TEST(Foundation_frame, override_destroys_resource_boundary_id_discarded) { +TEST(Frame, override_destroys_resource_boundary_id_discarded) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "https://example.com/parent", @@ -3028,7 +3028,7 @@ TEST(Foundation_frame, override_destroys_resource_boundary_id_discarded) { "https://json-schema.org/draft/2020-12/schema"); } -TEST(Foundation_frame, override_unresolvable_throws) { +TEST(Frame, override_unresolvable_throws) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2020-12/schema", "x-sourcemeta-dialect-override-subschema": @@ -3042,7 +3042,7 @@ TEST(Foundation_frame, override_unresolvable_throws) { sourcemeta::blaze::SchemaResolutionError); } -TEST(Foundation_frame, override_inert_under_draft7_ref_siblings) { +TEST(Frame, override_inert_under_draft7_ref_siblings) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "http://json-schema.org/draft-07/schema#", "definitions": { @@ -3117,7 +3117,7 @@ TEST(Foundation_frame, override_inert_under_draft7_ref_siblings) { "", "/definitions/bar", "#/definitions/bar"); } -TEST(Foundation_frame, override_surfaces_after_2019_09_upgrade) { +TEST(Frame, override_surfaces_after_2019_09_upgrade) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2019-09/schema", "$defs": { @@ -3139,7 +3139,7 @@ TEST(Foundation_frame, override_surfaces_after_2019_09_upgrade) { sourcemeta::blaze::SchemaResolutionError); } -TEST(Foundation_frame, override_picks_dollarid_under_draft6) { +TEST(Frame, override_picks_dollarid_under_draft6) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "http://json-schema.org/draft-04/schema#", "id": "http://example.com/parent", @@ -3251,7 +3251,7 @@ TEST(Foundation_frame, override_picks_dollarid_under_draft6) { "http://json-schema.org/draft-04/schema#"); } -TEST(Foundation_frame, override_hides_anchor_under_draft7) { +TEST(Frame, override_hides_anchor_under_draft7) { const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2019-09/schema", "$id": "https://example.com/parent", diff --git a/test/frame/frame_test_utils.h b/test/frame/frame_test_utils.h new file mode 100644 index 000000000..e9d5264f5 --- /dev/null +++ b/test/frame/frame_test_utils.h @@ -0,0 +1,518 @@ +#ifndef SOURCEMETA_BLAZE_FRAME_TEST_UTILS_H_ +#define SOURCEMETA_BLAZE_FRAME_TEST_UTILS_H_ + +#include +#include +#include +#include +#include + +#define EXPECT_VOCABULARY_KNOWN(vocabulary_value, expected_known) \ + EXPECT_TRUE(std::holds_alternative( \ + (vocabulary_value))); \ + EXPECT_EQ( \ + std::get((vocabulary_value)), \ + sourcemeta::blaze::Vocabularies::Known::expected_known) + +#define EXPECT_VOCABULARY_REQUIRED(vocabularies, expected_known) \ + EXPECT_TRUE( \ + (vocabularies) \ + .contains(sourcemeta::blaze::Vocabularies::Known::expected_known)); \ + EXPECT_TRUE((vocabularies) \ + .get(sourcemeta::blaze::Vocabularies::Known::expected_known) \ + .value()) + +#define EXPECT_VOCABULARY_OPTIONAL(vocabularies, expected_known) \ + EXPECT_TRUE( \ + (vocabularies) \ + .contains(sourcemeta::blaze::Vocabularies::Known::expected_known)); \ + EXPECT_FALSE( \ + (vocabularies) \ + .get(sourcemeta::blaze::Vocabularies::Known::expected_known) \ + .value()) + +#define EXPECT_OPTIONAL_POINTER(optional_value, expected_optional) \ + if (std::optional{expected_optional}.has_value()) { \ + EXPECT_TRUE((optional_value).has_value()); \ + EXPECT_EQ(sourcemeta::core::to_string((optional_value).value()), \ + std::optional{expected_optional}.value()); \ + } else { \ + EXPECT_FALSE((optional_value).has_value()); \ + } + +#define EXPECT_POINTER_TEMPLATE(pointer, expected) \ + { \ + std::ostringstream stream; \ + sourcemeta::core::stringify((pointer), stream); \ + EXPECT_EQ(stream.str(), (expected)); \ + } + +#define TO_POINTER(pointer_string) \ + sourcemeta::core::to_pointer((pointer_string)) + +#define EXPECT_FRAME(frame, expected_type, reference, root_id, \ + expected_pointer, expected_dialect, \ + expected_base_dialect, expected_base, \ + expected_relative_pointer, expected_parent, \ + expected_property_name, expected_orphan) \ + EXPECT_TRUE((frame).locations().contains({(expected_type), (reference)})); \ + EXPECT_EQ((frame).root(), (root_id)); \ + EXPECT_EQ( \ + sourcemeta::core::to_string( \ + (frame).locations().at({(expected_type), (reference)}).pointer), \ + (expected_pointer)); \ + EXPECT_EQ((frame).locations().at({(expected_type), (reference)}).dialect, \ + (expected_dialect)); \ + EXPECT_EQ((frame).locations().at({(expected_type), (reference)}).base, \ + (expected_base)); \ + EXPECT_TRUE( \ + (frame) \ + .traverse( \ + (frame).locations().at({(expected_type), (reference)}).base) \ + .has_value()); \ + EXPECT_EQ( \ + (frame).locations().at({(expected_type), (reference)}).base_dialect, \ + sourcemeta::blaze::SchemaBaseDialect::expected_base_dialect); \ + EXPECT_EQ(sourcemeta::core::to_string((frame).relative_instance_location( \ + (frame).locations().at({(expected_type), (reference)}))), \ + (expected_relative_pointer)); \ + EXPECT_OPTIONAL_POINTER( \ + (frame).locations().at({(expected_type), (reference)}).parent, \ + expected_parent); \ + EXPECT_EQ( \ + (frame).locations().at({(expected_type), (reference)}).property_name, \ + (expected_property_name)); \ + EXPECT_EQ((frame).locations().at({(expected_type), (reference)}).orphan, \ + (expected_orphan)); + +#define EXPECT_FRAME_STATIC( \ + frame, reference, root_id, expected_pointer, expected_dialect, \ + expected_base_dialect, expected_base, expected_relative_pointer, \ + expected_parent, expected_property_name, expected_orphan) \ + EXPECT_FRAME(frame, sourcemeta::blaze::SchemaReferenceType::Static, \ + reference, root_id, expected_pointer, expected_dialect, \ + expected_base_dialect, expected_base, \ + expected_relative_pointer, expected_parent, \ + expected_property_name, expected_orphan) + +#define EXPECT_FRAME_STATIC_RESOURCE( \ + frame, reference, root_id, expected_pointer, expected_dialect, \ + expected_base_dialect, expected_base, expected_relative_pointer, \ + expected_parent, expected_property_name, expected_orphan) \ + EXPECT_FRAME_STATIC(frame, reference, root_id, expected_pointer, \ + expected_dialect, expected_base_dialect, expected_base, \ + expected_relative_pointer, expected_parent, \ + expected_property_name, expected_orphan) \ + EXPECT_EQ( \ + (frame) \ + .locations() \ + .at({sourcemeta::blaze::SchemaReferenceType::Static, (reference)}) \ + .type, \ + sourcemeta::blaze::SchemaFrame::LocationType::Resource); + +#define EXPECT_FRAME_STATIC_POINTER( \ + frame, reference, root_id, expected_pointer, expected_dialect, \ + expected_base_dialect, expected_base, expected_relative_pointer, \ + expected_parent, expected_property_name, expected_orphan) \ + EXPECT_FRAME_STATIC(frame, reference, root_id, expected_pointer, \ + expected_dialect, expected_base_dialect, expected_base, \ + expected_relative_pointer, expected_parent, \ + expected_property_name, expected_orphan) \ + EXPECT_EQ( \ + (frame) \ + .locations() \ + .at({sourcemeta::blaze::SchemaReferenceType::Static, (reference)}) \ + .type, \ + sourcemeta::blaze::SchemaFrame::LocationType::Pointer); + +#define EXPECT_FRAME_STATIC_SUBSCHEMA( \ + frame, reference, root_id, expected_pointer, expected_dialect, \ + expected_base_dialect, expected_base, expected_relative_pointer, \ + expected_parent, expected_property_name, expected_orphan) \ + EXPECT_FRAME_STATIC(frame, reference, root_id, expected_pointer, \ + expected_dialect, expected_base_dialect, expected_base, \ + expected_relative_pointer, expected_parent, \ + expected_property_name, expected_orphan) \ + EXPECT_EQ( \ + (frame) \ + .locations() \ + .at({sourcemeta::blaze::SchemaReferenceType::Static, (reference)}) \ + .type, \ + sourcemeta::blaze::SchemaFrame::LocationType::Subschema); + +#define EXPECT_FRAME_STATIC_ANCHOR( \ + frame, reference, root_id, expected_pointer, expected_dialect, \ + expected_base_dialect, expected_base, expected_relative_pointer, \ + expected_parent, expected_property_name, expected_orphan) \ + EXPECT_FRAME_STATIC(frame, reference, root_id, expected_pointer, \ + expected_dialect, expected_base_dialect, expected_base, \ + expected_relative_pointer, expected_parent, \ + expected_property_name, expected_orphan) \ + EXPECT_EQ( \ + (frame) \ + .locations() \ + .at({sourcemeta::blaze::SchemaReferenceType::Static, (reference)}) \ + .type, \ + sourcemeta::blaze::SchemaFrame::LocationType::Anchor); + +#define EXPECT_FRAME_DYNAMIC_ANCHOR( \ + frame, reference, root_id, expected_pointer, expected_dialect, \ + expected_base_dialect, expected_base, expected_relative_pointer, \ + expected_parent, expected_property_name, expected_orphan) \ + EXPECT_FRAME_DYNAMIC(frame, reference, root_id, expected_pointer, \ + expected_dialect, expected_base_dialect, expected_base, \ + expected_relative_pointer, expected_parent, \ + expected_property_name, expected_orphan) \ + EXPECT_EQ( \ + (frame) \ + .locations() \ + .at({sourcemeta::blaze::SchemaReferenceType::Dynamic, (reference)}) \ + .type, \ + sourcemeta::blaze::SchemaFrame::LocationType::Anchor); + +#define EXPECT_FRAME_DYNAMIC( \ + frame, reference, root_id, expected_pointer, expected_dialect, \ + expected_base_dialect, expected_base, expected_relative_pointer, \ + expected_parent, expected_property_name, expected_orphan) \ + EXPECT_FRAME(frame, sourcemeta::blaze::SchemaReferenceType::Dynamic, \ + reference, root_id, expected_pointer, expected_dialect, \ + expected_base_dialect, expected_base, \ + expected_relative_pointer, expected_parent, \ + expected_property_name, expected_orphan) + +#define __EXPECT_ANONYMOUS_FRAME(frame, expected_type, reference, \ + expected_pointer, expected_dialect, \ + expected_base_dialect, expected_parent, \ + expected_property_name, expected_orphan) \ + EXPECT_TRUE((frame).locations().contains({(expected_type), (reference)})); \ + EXPECT_TRUE((frame).root().empty()); \ + EXPECT_EQ( \ + sourcemeta::core::to_string( \ + (frame).locations().at({(expected_type), (reference)}).pointer), \ + (expected_pointer)); \ + EXPECT_EQ((frame).locations().at({(expected_type), (reference)}).dialect, \ + (expected_dialect)); \ + EXPECT_EQ( \ + (frame).locations().at({(expected_type), (reference)}).base_dialect, \ + sourcemeta::blaze::SchemaBaseDialect::expected_base_dialect); \ + EXPECT_OPTIONAL_POINTER( \ + (frame).locations().at({(expected_type), (reference)}).parent, \ + expected_parent); \ + EXPECT_EQ( \ + (frame).locations().at({(expected_type), (reference)}).property_name, \ + (expected_property_name)); \ + EXPECT_EQ((frame).locations().at({(expected_type), (reference)}).orphan, \ + (expected_orphan)); + +#define EXPECT_ANONYMOUS_FRAME_STATIC(frame, reference, expected_pointer, \ + expected_dialect, expected_base_dialect, \ + expected_parent, expected_property_name, \ + expected_orphan) \ + __EXPECT_ANONYMOUS_FRAME( \ + frame, sourcemeta::blaze::SchemaReferenceType::Static, reference, \ + expected_pointer, expected_dialect, expected_base_dialect, \ + expected_parent, expected_property_name, expected_orphan) + +#define EXPECT_ANONYMOUS_FRAME_STATIC_RESOURCE( \ + frame, reference, expected_pointer, expected_dialect, \ + expected_base_dialect, expected_parent, expected_property_name, \ + expected_orphan) \ + __EXPECT_ANONYMOUS_FRAME( \ + frame, sourcemeta::blaze::SchemaReferenceType::Static, reference, \ + expected_pointer, expected_dialect, expected_base_dialect, \ + expected_parent, expected_property_name, expected_orphan) \ + EXPECT_EQ( \ + (frame) \ + .locations() \ + .at({sourcemeta::blaze::SchemaReferenceType::Static, (reference)}) \ + .type, \ + sourcemeta::blaze::SchemaFrame::LocationType::Resource); + +#define EXPECT_ANONYMOUS_FRAME_STATIC_POINTER( \ + frame, reference, expected_pointer, expected_dialect, \ + expected_base_dialect, expected_parent, expected_property_name, \ + expected_orphan) \ + __EXPECT_ANONYMOUS_FRAME( \ + frame, sourcemeta::blaze::SchemaReferenceType::Static, reference, \ + expected_pointer, expected_dialect, expected_base_dialect, \ + expected_parent, expected_property_name, expected_orphan) \ + EXPECT_EQ( \ + (frame) \ + .locations() \ + .at({sourcemeta::blaze::SchemaReferenceType::Static, (reference)}) \ + .type, \ + sourcemeta::blaze::SchemaFrame::LocationType::Pointer); + +#define EXPECT_ANONYMOUS_FRAME_STATIC_SUBSCHEMA( \ + frame, reference, expected_pointer, expected_dialect, \ + expected_base_dialect, expected_parent, expected_property_name, \ + expected_orphan) \ + __EXPECT_ANONYMOUS_FRAME( \ + frame, sourcemeta::blaze::SchemaReferenceType::Static, reference, \ + expected_pointer, expected_dialect, expected_base_dialect, \ + expected_parent, expected_property_name, expected_orphan) \ + EXPECT_EQ( \ + (frame) \ + .locations() \ + .at({sourcemeta::blaze::SchemaReferenceType::Static, (reference)}) \ + .type, \ + sourcemeta::blaze::SchemaFrame::LocationType::Subschema); + +#define EXPECT_ANONYMOUS_FRAME_STATIC_ANCHOR( \ + frame, reference, expected_pointer, expected_dialect, \ + expected_base_dialect, expected_parent, expected_property_name, \ + expected_orphan) \ + __EXPECT_ANONYMOUS_FRAME( \ + frame, sourcemeta::blaze::SchemaReferenceType::Static, reference, \ + expected_pointer, expected_dialect, expected_base_dialect, \ + expected_parent, expected_property_name, expected_orphan) \ + EXPECT_EQ( \ + (frame) \ + .locations() \ + .at({sourcemeta::blaze::SchemaReferenceType::Static, (reference)}) \ + .type, \ + sourcemeta::blaze::SchemaFrame::LocationType::Anchor); + +#define EXPECT_ANONYMOUS_FRAME_DYNAMIC_ANCHOR( \ + frame, reference, expected_pointer, expected_dialect, \ + expected_base_dialect, expected_parent, expected_property_name, \ + expected_orphan) \ + __EXPECT_ANONYMOUS_FRAME( \ + frame, sourcemeta::blaze::SchemaReferenceType::Dynamic, reference, \ + expected_pointer, expected_dialect, expected_base_dialect, \ + expected_parent, expected_property_name, expected_orphan) \ + EXPECT_EQ( \ + (frame) \ + .locations() \ + .at({sourcemeta::blaze::SchemaReferenceType::Dynamic, (reference)}) \ + .type, \ + sourcemeta::blaze::SchemaFrame::LocationType::Anchor); + +#define EXPECT_REFERENCE(frame, expected_type, expected_pointer, expected_uri, \ + expected_base, expected_fragment, expected_original) \ + { \ + const auto __ref_pointer{TO_POINTER(expected_pointer)}; \ + const auto __ref_entry{(frame).reference( \ + expected_type, sourcemeta::core::to_weak_pointer(__ref_pointer))}; \ + EXPECT_TRUE(__ref_entry.has_value()); \ + EXPECT_EQ(__ref_entry->get().destination, (expected_uri)); \ + EXPECT_EQ(__ref_entry->get().base, (expected_base)); \ + EXPECT_EQ(__ref_entry->get().fragment, (expected_fragment)); \ + EXPECT_EQ(__ref_entry->get().original, (expected_original)); \ + } + +#define EXPECT_STATIC_REFERENCE(frame, expected_pointer, expected_uri, \ + expected_base, expected_fragment, \ + expected_original) \ + EXPECT_REFERENCE(frame, sourcemeta::blaze::SchemaReferenceType::Static, \ + expected_pointer, expected_uri, expected_base, \ + expected_fragment, expected_original) + +#define EXPECT_DYNAMIC_REFERENCE(frame, expected_pointer, expected_uri, \ + expected_base, expected_fragment, \ + expected_original) \ + EXPECT_REFERENCE(frame, sourcemeta::blaze::SchemaReferenceType::Dynamic, \ + expected_pointer, expected_uri, expected_base, \ + expected_fragment, expected_original) + +#define __EXPECT_WALKER_ENTRY(entries, index, expected_schema_location, \ + expected_parent_location, expected_dialect, \ + expected_base_dialect) \ + EXPECT_EQ(sourcemeta::core::to_string(entries.at(index).pointer), \ + expected_schema_location); \ + EXPECT_OPTIONAL_POINTER(entries.at(index).parent, expected_parent_location); \ + EXPECT_FALSE(entries.at(index).dialect.empty()); \ + EXPECT_TRUE(entries.at(index).base_dialect.has_value()); \ + EXPECT_EQ(entries.at(index).dialect, expected_dialect); \ + EXPECT_EQ( \ + sourcemeta::blaze::to_string(entries.at(index).base_dialect.value()), \ + expected_base_dialect); \ + EXPECT_FALSE(entries.at(index).vocabularies.empty()); + +#define EXPECT_WALKER_ENTRY_2020_12(entries, index, expected_schema_location, \ + expected_parent_location) \ + __EXPECT_WALKER_ENTRY(entries, index, expected_schema_location, \ + expected_parent_location, \ + "https://json-schema.org/draft/2020-12/schema", \ + "https://json-schema.org/draft/2020-12/schema"); \ + EXPECT_FALSE(entries.at(index).orphan); + +#define EXPECT_WALKER_ENTRY_2020_12_ORPHAN( \ + entries, index, expected_schema_location, expected_parent_location) \ + __EXPECT_WALKER_ENTRY(entries, index, expected_schema_location, \ + expected_parent_location, \ + "https://json-schema.org/draft/2020-12/schema", \ + "https://json-schema.org/draft/2020-12/schema"); \ + EXPECT_TRUE(entries.at(index).orphan); + +#define EXPECT_WALKER_ENTRY_2019_09(entries, index, expected_schema_location, \ + expected_parent_location) \ + __EXPECT_WALKER_ENTRY(entries, index, expected_schema_location, \ + expected_parent_location, \ + "https://json-schema.org/draft/2019-09/schema", \ + "https://json-schema.org/draft/2019-09/schema"); \ + EXPECT_FALSE(entries.at(index).orphan); + +#define EXPECT_WALKER_ENTRY_2019_09_ORPHAN( \ + entries, index, expected_schema_location, expected_parent_location) \ + __EXPECT_WALKER_ENTRY(entries, index, expected_schema_location, \ + expected_parent_location, \ + "https://json-schema.org/draft/2019-09/schema", \ + "https://json-schema.org/draft/2019-09/schema"); \ + EXPECT_TRUE(entries.at(index).orphan); + +#define EXPECT_WALKER_ENTRY_DRAFT7(entries, index, expected_schema_location, \ + expected_parent_location) \ + __EXPECT_WALKER_ENTRY(entries, index, expected_schema_location, \ + expected_parent_location, \ + "http://json-schema.org/draft-07/schema#", \ + "http://json-schema.org/draft-07/schema#"); \ + EXPECT_FALSE(entries.at(index).orphan); + +#define EXPECT_WALKER_ENTRY_DRAFT7_ORPHAN( \ + entries, index, expected_schema_location, expected_parent_location) \ + __EXPECT_WALKER_ENTRY(entries, index, expected_schema_location, \ + expected_parent_location, \ + "http://json-schema.org/draft-07/schema#", \ + "http://json-schema.org/draft-07/schema#"); \ + EXPECT_TRUE(entries.at(index).orphan); + +#define EXPECT_WALKER_ENTRY_DRAFT6(entries, index, expected_schema_location, \ + expected_parent_location) \ + __EXPECT_WALKER_ENTRY(entries, index, expected_schema_location, \ + expected_parent_location, \ + "http://json-schema.org/draft-06/schema#", \ + "http://json-schema.org/draft-06/schema#"); \ + EXPECT_FALSE(entries.at(index).orphan); \ + EXPECT_FALSE(entries.at(index).property_name); + +#define EXPECT_WALKER_ENTRY_DRAFT6_ORPHAN( \ + entries, index, expected_schema_location, expected_parent_location) \ + __EXPECT_WALKER_ENTRY(entries, index, expected_schema_location, \ + expected_parent_location, \ + "http://json-schema.org/draft-06/schema#", \ + "http://json-schema.org/draft-06/schema#"); \ + EXPECT_TRUE(entries.at(index).orphan); \ + EXPECT_FALSE(entries.at(index).property_name); + +#define EXPECT_WALKER_ENTRY_DRAFT6_PROPERTY_NAME( \ + entries, index, expected_schema_location, expected_parent_location) \ + __EXPECT_WALKER_ENTRY(entries, index, expected_schema_location, \ + expected_parent_location, \ + "http://json-schema.org/draft-06/schema#", \ + "http://json-schema.org/draft-06/schema#"); \ + EXPECT_FALSE(entries.at(index).orphan); \ + EXPECT_TRUE(entries.at(index).property_name); + +#define EXPECT_WALKER_ENTRY_DRAFT4(entries, index, expected_schema_location, \ + expected_parent_location) \ + __EXPECT_WALKER_ENTRY(entries, index, expected_schema_location, \ + expected_parent_location, \ + "http://json-schema.org/draft-04/schema#", \ + "http://json-schema.org/draft-04/schema#"); \ + EXPECT_FALSE(entries.at(index).orphan); + +#define EXPECT_WALKER_ENTRY_DRAFT4_ORPHAN( \ + entries, index, expected_schema_location, expected_parent_location) \ + __EXPECT_WALKER_ENTRY(entries, index, expected_schema_location, \ + expected_parent_location, \ + "http://json-schema.org/draft-04/schema#", \ + "http://json-schema.org/draft-04/schema#"); \ + EXPECT_TRUE(entries.at(index).orphan); + +#define EXPECT_WALKER_ENTRY_DRAFT3(entries, index, expected_schema_location, \ + expected_parent_location) \ + __EXPECT_WALKER_ENTRY(entries, index, expected_schema_location, \ + expected_parent_location, \ + "http://json-schema.org/draft-03/schema#", \ + "http://json-schema.org/draft-03/schema#"); \ + EXPECT_FALSE(entries.at(index).orphan); + +#define EXPECT_WALKER_ENTRY_DRAFT3_ORPHAN( \ + entries, index, expected_schema_location, expected_parent_location) \ + __EXPECT_WALKER_ENTRY(entries, index, expected_schema_location, \ + expected_parent_location, \ + "http://json-schema.org/draft-03/schema#", \ + "http://json-schema.org/draft-03/schema#"); \ + EXPECT_TRUE(entries.at(index).orphan); + +#define EXPECT_WALKER_ENTRY_DRAFT2(entries, index, expected_schema_location, \ + expected_parent_location) \ + __EXPECT_WALKER_ENTRY(entries, index, expected_schema_location, \ + expected_parent_location, \ + "http://json-schema.org/draft-02/schema#", \ + "http://json-schema.org/draft-02/hyper-schema#"); \ + EXPECT_FALSE(entries.at(index).orphan); + +#define EXPECT_WALKER_ENTRY_DRAFT2_ORPHAN( \ + entries, index, expected_schema_location, expected_parent_location) \ + __EXPECT_WALKER_ENTRY(entries, index, expected_schema_location, \ + expected_parent_location, \ + "http://json-schema.org/draft-02/schema#", \ + "http://json-schema.org/draft-02/hyper-schema#"); \ + EXPECT_TRUE(entries.at(index).orphan); + +#define EXPECT_WALKER_ENTRY_DRAFT1(entries, index, expected_schema_location, \ + expected_parent_location) \ + __EXPECT_WALKER_ENTRY(entries, index, expected_schema_location, \ + expected_parent_location, \ + "http://json-schema.org/draft-01/schema#", \ + "http://json-schema.org/draft-01/hyper-schema#"); \ + EXPECT_FALSE(entries.at(index).orphan); + +#define EXPECT_WALKER_ENTRY_DRAFT1_ORPHAN( \ + entries, index, expected_schema_location, expected_parent_location) \ + __EXPECT_WALKER_ENTRY(entries, index, expected_schema_location, \ + expected_parent_location, \ + "http://json-schema.org/draft-01/schema#", \ + "http://json-schema.org/draft-01/hyper-schema#"); \ + EXPECT_TRUE(entries.at(index).orphan); + +#define EXPECT_WALKER_ENTRY_DRAFT0(entries, index, expected_schema_location, \ + expected_parent_location) \ + __EXPECT_WALKER_ENTRY(entries, index, expected_schema_location, \ + expected_parent_location, \ + "http://json-schema.org/draft-00/schema#", \ + "http://json-schema.org/draft-00/hyper-schema#"); \ + EXPECT_FALSE(entries.at(index).orphan); + +#define EXPECT_WALKER_ENTRY_DRAFT0_ORPHAN( \ + entries, index, expected_schema_location, expected_parent_location) \ + __EXPECT_WALKER_ENTRY(entries, index, expected_schema_location, \ + expected_parent_location, \ + "http://json-schema.org/draft-00/schema#", \ + "http://json-schema.org/draft-00/hyper-schema#"); \ + EXPECT_TRUE(entries.at(index).orphan); + +#define EXPECT_REFERENCE_TO(result, index, type, origin) \ + EXPECT_EQ((result).at((index)).get().first.first, \ + sourcemeta::blaze::SchemaReferenceType::type); \ + EXPECT_EQ( \ + sourcemeta::core::to_string((result).at((index)).get().first.second), \ + (origin)); + +#define EXPECT_FRAME_LOCATION_REACHABLE(frame, reference_type, reference, \ + base) \ + EXPECT_TRUE((frame).locations().contains( \ + {sourcemeta::blaze::SchemaReferenceType::reference_type, (reference)})); \ + EXPECT_TRUE((frame).traverse((base)).has_value()); \ + EXPECT_TRUE((frame).is_reachable( \ + (frame).traverse((base))->get(), \ + (frame).locations().at( \ + {sourcemeta::blaze::SchemaReferenceType::reference_type, \ + (reference)}), \ + sourcemeta::blaze::schema_walker, sourcemeta::blaze::schema_resolver)) + +#define EXPECT_FRAME_LOCATION_NON_REACHABLE(frame, reference_type, reference, \ + base) \ + EXPECT_TRUE((frame).locations().contains( \ + {sourcemeta::blaze::SchemaReferenceType::reference_type, (reference)})); \ + EXPECT_TRUE((frame).traverse((base)).has_value()); \ + EXPECT_FALSE((frame).is_reachable( \ + (frame).traverse((base))->get(), \ + (frame).locations().at( \ + {sourcemeta::blaze::SchemaReferenceType::reference_type, \ + (reference)}), \ + sourcemeta::blaze::schema_walker, sourcemeta::blaze::schema_resolver)) + +#endif diff --git a/test/foundation/referencingsuite.cc b/test/frame/referencingsuite.cc similarity index 99% rename from test/foundation/referencingsuite.cc rename to test/frame/referencingsuite.cc index a042ebd76..19307d29a 100644 --- a/test/foundation/referencingsuite.cc +++ b/test/frame/referencingsuite.cc @@ -1,6 +1,7 @@ #include #include +#include #include #include #include diff --git a/test/output/CMakeLists.txt b/test/output/CMakeLists.txt index 39af43832..5d515c4a8 100644 --- a/test/output/CMakeLists.txt +++ b/test/output/CMakeLists.txt @@ -9,6 +9,8 @@ target_link_libraries(sourcemeta_blaze_output_unit PRIVATE sourcemeta::core::json) target_link_libraries(sourcemeta_blaze_output_unit PRIVATE sourcemeta::blaze::foundation) +target_link_libraries(sourcemeta_blaze_output_unit + PRIVATE sourcemeta::blaze::frame) target_link_libraries(sourcemeta_blaze_output_unit PRIVATE sourcemeta::blaze::output) target_link_libraries(sourcemeta_blaze_output_unit diff --git a/test/output/output_trace_test.cc b/test/output/output_trace_test.cc index a5daace7c..c59c2e584 100644 --- a/test/output/output_trace_test.cc +++ b/test/output/output_trace_test.cc @@ -2,6 +2,7 @@ #include #include +#include #include #include diff --git a/test/packaging/find_package/CMakeLists.txt b/test/packaging/find_package/CMakeLists.txt index 02520d135..c23e1f16d 100644 --- a/test/packaging/find_package/CMakeLists.txt +++ b/test/packaging/find_package/CMakeLists.txt @@ -16,5 +16,6 @@ target_link_libraries(blaze_hello PRIVATE sourcemeta::blaze::codegen) target_link_libraries(blaze_hello PRIVATE sourcemeta::blaze::documentation) target_link_libraries(blaze_hello PRIVATE sourcemeta::blaze::editor) target_link_libraries(blaze_hello PRIVATE sourcemeta::blaze::foundation) +target_link_libraries(blaze_hello PRIVATE sourcemeta::blaze::frame) target_link_libraries(blaze_hello PRIVATE sourcemeta::blaze::bundle) target_link_libraries(blaze_hello PRIVATE sourcemeta::blaze::format) diff --git a/test/packaging/find_package/hello.cc b/test/packaging/find_package/hello.cc index a7a24ff34..2c5060317 100644 --- a/test/packaging/find_package/hello.cc +++ b/test/packaging/find_package/hello.cc @@ -8,6 +8,7 @@ #include #include #include +#include #include #include