From 005a8026bb424779a146e00cc48621ff1d72b807 Mon Sep 17 00:00:00 2001 From: CptAlanSmith <123112708+CptAlanSmith@users.noreply.github.com> Date: Sat, 23 Sep 2023 19:25:15 +0100 Subject: Testing (#23) * Fixes for building scons * Initial proof of concept auto-testing Shows how we can pull loaded data and display it back * Re-did headless Because hubert insisted it be done like this ;) * Auto-Testing Framework Basics * Requirements Calculations * Fix for messy merge (teach me to use merge tools) * Fixing up misc merge issues to fully reconcile with master changes * Re-added missing getters * Move of testing files due to folder reorgs * Use new accessors + int reading fix --------- Co-authored-by: Hop311 --- src/openvic-simulation/politics/Ideology.hpp | 8 +++----- src/openvic-simulation/politics/Issue.cpp | 6 +++--- src/openvic-simulation/politics/Issue.hpp | 10 +++++----- 3 files changed, 11 insertions(+), 13 deletions(-) (limited to 'src/openvic-simulation/politics') diff --git a/src/openvic-simulation/politics/Ideology.hpp b/src/openvic-simulation/politics/Ideology.hpp index f5ed5f1..e9989c8 100644 --- a/src/openvic-simulation/politics/Ideology.hpp +++ b/src/openvic-simulation/politics/Ideology.hpp @@ -1,8 +1,6 @@ #pragma once -#include "types/Date.hpp" -#include "types/IdentifierRegistry.hpp" -#include "dataloader/NodeTools.hpp" +#include "openvic-simulation/types/IdentifierRegistry.hpp" namespace OpenVic { struct IdeologyManager; @@ -12,7 +10,7 @@ namespace OpenVic { private: IdeologyGroup(const std::string_view new_identifier); - + public: IdeologyGroup(IdeologyGroup&&) = default; }; @@ -45,7 +43,7 @@ namespace OpenVic { public: IdeologyManager(); - + bool add_ideology_group(const std::string_view identifier); IDENTIFIER_REGISTRY_ACCESSORS(IdeologyGroup, ideology_group) diff --git a/src/openvic-simulation/politics/Issue.cpp b/src/openvic-simulation/politics/Issue.cpp index 926eade..67b3783 100644 --- a/src/openvic-simulation/politics/Issue.cpp +++ b/src/openvic-simulation/politics/Issue.cpp @@ -12,10 +12,10 @@ IssueGroup const& Issue::get_group() const { return group; } -ReformType::ReformType(const std::string_view new_identifier, bool uncivilised) +ReformType::ReformType(const std::string_view new_identifier, bool uncivilised) : HasIdentifier { new_identifier }, uncivilised { uncivilised } {} -ReformGroup::ReformGroup(const std::string_view identifier, ReformType const& type, bool ordered, bool administrative) +ReformGroup::ReformGroup(const std::string_view identifier, ReformType const& type, bool ordered, bool administrative) : IssueGroup { identifier }, type { type }, ordered { ordered }, administrative { administrative } {} ReformType const& ReformGroup::get_type() const { @@ -151,7 +151,7 @@ bool IssueManager::_load_reform(size_t& ordinal, const std::string_view identifi bool IssueManager::load_issues_file(ast::NodeCPtr root) { size_t expected_issue_groups = 0; size_t expected_reform_groups = 0; - bool ret = expect_dictionary_reserve_length(reform_types, + bool ret = expect_dictionary_reserve_length(reform_types, [this, &expected_issue_groups, &expected_reform_groups](std::string_view key, ast::NodeCPtr value) -> bool { if (key == "party_issues") return expect_length(add_variable_callback(expected_issue_groups))(value); diff --git a/src/openvic-simulation/politics/Issue.hpp b/src/openvic-simulation/politics/Issue.hpp index 4b096ee..66e8d1a 100644 --- a/src/openvic-simulation/politics/Issue.hpp +++ b/src/openvic-simulation/politics/Issue.hpp @@ -15,7 +15,7 @@ namespace OpenVic { protected: IssueGroup(const std::string_view identifier); - + public: IssueGroup(IssueGroup&&) = default; }; @@ -46,7 +46,7 @@ namespace OpenVic { //in vanilla education, military and economic reforms are hardcoded to true and the rest to false ReformType(const std::string_view new_identifier, bool uncivilised); - + public: ReformType(ReformType&&) = default; }; @@ -61,7 +61,7 @@ namespace OpenVic { const bool administrative; ReformGroup(const std::string_view identifier, ReformType const& type, bool ordered, bool administrative); - + public: ReformGroup(ReformGroup&&) = default; ReformType const& get_type() const; @@ -87,7 +87,7 @@ namespace OpenVic { ReformType const& get_type() const; size_t get_ordinal() const; }; - + //Issue manager - holds the registries struct IssueManager { private: @@ -117,7 +117,7 @@ namespace OpenVic { bool add_reform_group(const std::string_view identifier, ReformType const* type, bool ordered, bool administrative); IDENTIFIER_REGISTRY_ACCESSORS(ReformGroup, reform_group) - + bool add_reform(const std::string_view identifier, ReformGroup const* group, size_t ordinal); IDENTIFIER_REGISTRY_ACCESSORS(Reform, reform) -- cgit v1.2.3-56-ga3b1