mirror of
https://github.com/johndoe6345789/SDL3CPlusPlus.git
synced 2026-04-24 13:44:58 +00:00
ROADMAP.md
This commit is contained in:
@@ -3,10 +3,12 @@
|
||||
#include "services/impl/json_config_service.hpp"
|
||||
#include "services/interfaces/i_logger.hpp"
|
||||
|
||||
#include <array>
|
||||
#include <chrono>
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -67,15 +69,22 @@ void WriteFile(const std::filesystem::path& path, const std::string& contents) {
|
||||
output << contents;
|
||||
}
|
||||
|
||||
void CopySchema(const std::filesystem::path& targetDir) {
|
||||
auto schemaSource = GetRepoRoot() / "config" / "schema" / "runtime_config_v2.schema.json";
|
||||
auto schemaTarget = targetDir / "schema" / "runtime_config_v2.schema.json";
|
||||
std::filesystem::create_directories(schemaTarget.parent_path());
|
||||
std::ifstream input(schemaSource);
|
||||
ASSERT_TRUE(input.is_open()) << "Missing schema source: " << schemaSource;
|
||||
std::ofstream output(schemaTarget);
|
||||
ASSERT_TRUE(output.is_open()) << "Failed to write schema target: " << schemaTarget;
|
||||
output << input.rdbuf();
|
||||
void CopyConfigAssets(const std::filesystem::path& targetDir) {
|
||||
const auto repoRoot = GetRepoRoot();
|
||||
const std::array<std::pair<std::filesystem::path, std::filesystem::path>, 2> assets = {
|
||||
std::make_pair(repoRoot / "config" / "schema" / "runtime_config_v2.schema.json",
|
||||
targetDir / "schema" / "runtime_config_v2.schema.json"),
|
||||
std::make_pair(repoRoot / "config" / "workflows" / "templates" / "boot_default.json",
|
||||
targetDir / "workflows" / "templates" / "boot_default.json")
|
||||
};
|
||||
for (const auto& asset : assets) {
|
||||
std::filesystem::create_directories(asset.second.parent_path());
|
||||
std::ifstream input(asset.first);
|
||||
ASSERT_TRUE(input.is_open()) << "Missing config asset: " << asset.first;
|
||||
std::ofstream output(asset.second);
|
||||
ASSERT_TRUE(output.is_open()) << "Failed to write config asset: " << asset.second;
|
||||
output << input.rdbuf();
|
||||
}
|
||||
}
|
||||
|
||||
std::filesystem::path WriteLuaScript(const std::filesystem::path& rootDir) {
|
||||
@@ -86,7 +95,7 @@ std::filesystem::path WriteLuaScript(const std::filesystem::path& rootDir) {
|
||||
|
||||
TEST(JsonConfigMergeTest, OverlayOverridesBaseFields) {
|
||||
ScopedTempDir tempDir;
|
||||
CopySchema(tempDir.Path());
|
||||
CopyConfigAssets(tempDir.Path());
|
||||
WriteLuaScript(tempDir.Path());
|
||||
auto logger = std::make_shared<NullLogger>();
|
||||
|
||||
@@ -117,7 +126,7 @@ TEST(JsonConfigMergeTest, OverlayOverridesBaseFields) {
|
||||
|
||||
TEST(JsonConfigMergeTest, DeleteDirectiveRemovesObject) {
|
||||
ScopedTempDir tempDir;
|
||||
CopySchema(tempDir.Path());
|
||||
CopyConfigAssets(tempDir.Path());
|
||||
WriteLuaScript(tempDir.Path());
|
||||
auto logger = std::make_shared<NullLogger>();
|
||||
|
||||
@@ -154,7 +163,7 @@ TEST(JsonConfigMergeTest, DeleteDirectiveRemovesObject) {
|
||||
|
||||
TEST(JsonConfigMergeTest, ExtendsArrayAppliesInOrder) {
|
||||
ScopedTempDir tempDir;
|
||||
CopySchema(tempDir.Path());
|
||||
CopyConfigAssets(tempDir.Path());
|
||||
WriteLuaScript(tempDir.Path());
|
||||
auto logger = std::make_shared<NullLogger>();
|
||||
|
||||
@@ -190,7 +199,7 @@ TEST(JsonConfigMergeTest, ExtendsArrayAppliesInOrder) {
|
||||
|
||||
TEST(JsonConfigMergeTest, ExtendsCycleThrows) {
|
||||
ScopedTempDir tempDir;
|
||||
CopySchema(tempDir.Path());
|
||||
CopyConfigAssets(tempDir.Path());
|
||||
WriteLuaScript(tempDir.Path());
|
||||
auto logger = std::make_shared<NullLogger>();
|
||||
|
||||
|
||||
@@ -3,10 +3,12 @@
|
||||
#include "services/impl/json_config_service.hpp"
|
||||
#include "services/interfaces/i_logger.hpp"
|
||||
|
||||
#include <array>
|
||||
#include <chrono>
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -67,15 +69,22 @@ void WriteFile(const std::filesystem::path& path, const std::string& contents) {
|
||||
output << contents;
|
||||
}
|
||||
|
||||
void CopySchema(const std::filesystem::path& targetDir) {
|
||||
auto schemaSource = GetRepoRoot() / "config" / "schema" / "runtime_config_v2.schema.json";
|
||||
auto schemaTarget = targetDir / "schema" / "runtime_config_v2.schema.json";
|
||||
std::filesystem::create_directories(schemaTarget.parent_path());
|
||||
std::ifstream input(schemaSource);
|
||||
ASSERT_TRUE(input.is_open()) << "Missing schema source: " << schemaSource;
|
||||
std::ofstream output(schemaTarget);
|
||||
ASSERT_TRUE(output.is_open()) << "Failed to write schema target: " << schemaTarget;
|
||||
output << input.rdbuf();
|
||||
void CopyConfigAssets(const std::filesystem::path& targetDir) {
|
||||
const auto repoRoot = GetRepoRoot();
|
||||
const std::array<std::pair<std::filesystem::path, std::filesystem::path>, 2> assets = {
|
||||
std::make_pair(repoRoot / "config" / "schema" / "runtime_config_v2.schema.json",
|
||||
targetDir / "schema" / "runtime_config_v2.schema.json"),
|
||||
std::make_pair(repoRoot / "config" / "workflows" / "templates" / "boot_default.json",
|
||||
targetDir / "workflows" / "templates" / "boot_default.json")
|
||||
};
|
||||
for (const auto& asset : assets) {
|
||||
std::filesystem::create_directories(asset.second.parent_path());
|
||||
std::ifstream input(asset.first);
|
||||
ASSERT_TRUE(input.is_open()) << "Missing config asset: " << asset.first;
|
||||
std::ofstream output(asset.second);
|
||||
ASSERT_TRUE(output.is_open()) << "Failed to write config asset: " << asset.second;
|
||||
output << input.rdbuf();
|
||||
}
|
||||
}
|
||||
|
||||
void WriteLuaScript(const std::filesystem::path& rootDir) {
|
||||
@@ -84,7 +93,7 @@ void WriteLuaScript(const std::filesystem::path& rootDir) {
|
||||
|
||||
TEST(JsonConfigSchemaValidationTest, RejectsInvalidWindowWidthType) {
|
||||
ScopedTempDir tempDir;
|
||||
CopySchema(tempDir.Path());
|
||||
CopyConfigAssets(tempDir.Path());
|
||||
WriteLuaScript(tempDir.Path());
|
||||
auto logger = std::make_shared<NullLogger>();
|
||||
|
||||
@@ -104,7 +113,7 @@ TEST(JsonConfigSchemaValidationTest, RejectsInvalidWindowWidthType) {
|
||||
|
||||
TEST(JsonConfigSchemaValidationTest, RejectsInvalidSceneSourceEnum) {
|
||||
ScopedTempDir tempDir;
|
||||
CopySchema(tempDir.Path());
|
||||
CopyConfigAssets(tempDir.Path());
|
||||
WriteLuaScript(tempDir.Path());
|
||||
auto logger = std::make_shared<NullLogger>();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user