aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/testing/TestScript.cpp
diff options
context:
space:
mode:
author CptAlanSmith <123112708+CptAlanSmith@users.noreply.github.com>2023-09-25 21:51:49 +0200
committer GitHub <noreply@github.com>2023-09-25 21:51:49 +0200
commit127ca294056817bc5814ef5516b29a67ff3fa3bb (patch)
tree2e5c5676a43793678dfd75f83a862eb3f9f4a780 /src/openvic-simulation/testing/TestScript.cpp
parent05b6db7305398e12363f727a50315972cc9a5a54 (diff)
Testing (#28)
* Dataloader stubs + default compat path + bits+bobs * Followup big dataloader commit * Fixes for building scons * Initial proof of concept auto-testing Shows how we can pull loaded data and display it back * data-loader include * 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 * Update of file tests * Test scripting updates - elimnination of issues with data variables hanging over from big merges Routed gamemanager down to scripts on execute * Update StringUtils.hpp * Initial pipeline building * Pipe fabrication * Continued work on goods testing, removal of pragma once lines * Finish of economy tests, initial results outputting * Output of results * Removal of direct.h for cross compatibility --------- Co-authored-by: Hop311 <hop3114@gmail.com>
Diffstat (limited to 'src/openvic-simulation/testing/TestScript.cpp')
-rw-r--r--src/openvic-simulation/testing/TestScript.cpp43
1 files changed, 27 insertions, 16 deletions
diff --git a/src/openvic-simulation/testing/TestScript.cpp b/src/openvic-simulation/testing/TestScript.cpp
index 7652fa5..d9affae 100644
--- a/src/openvic-simulation/testing/TestScript.cpp
+++ b/src/openvic-simulation/testing/TestScript.cpp
@@ -3,29 +3,40 @@
using namespace OpenVic;
// Getters
-std::vector<Requirement> TestScript::get_requirements() { return requirements; }
-Requirement TestScript::get_requirement_at_index(int index) { return requirements[index]; }
-Requirement TestScript::get_requirement_by_id(std::string id) {
- for (int i = 0; i < requirements.size(); i++) {
- if (requirements[i].get_id() == id) return requirements[i];
+std::vector<Requirement*> TestScript::get_requirements() { return requirements; }
+Requirement* TestScript::get_requirement_at_index(int index) { return requirements[index]; }
+Requirement* TestScript::get_requirement_by_id(std::string id) {
+ for (auto req : requirements) {
+ if (req->get_id() == id) return req;
}
- return Requirement("NULL", "NULL", "NULL");
+ return new Requirement("NULL", "NULL", "NULL"); // edge case of failing to find
}
-std::vector<Requirement> TestScript::get_passed_requirements() {
- std::vector<Requirement> passed_requirements = std::vector<Requirement>();
- for (int i = 0; i < requirements.size(); i++) {
- if (requirements[i].get_pass()) passed_requirements.push_back(requirements[i]);
+std::vector<Requirement*> TestScript::get_passed_requirements() {
+ std::vector<Requirement*> passed_requirements = std::vector<Requirement*>();
+ for (auto req : requirements) {
+ if (req->get_pass()) passed_requirements.push_back(req);
}
return passed_requirements;
}
-std::vector<Requirement> TestScript::get_failed_requirements() {
- std::vector<Requirement> failed_requirements = std::vector<Requirement>();
- for (int i = 0; i < requirements.size(); i++) {
- if (!requirements[i].get_pass()) failed_requirements.push_back(requirements[i]);
+std::vector<Requirement*> TestScript::get_failed_requirements() {
+ std::vector<Requirement*> failed_requirements = std::vector<Requirement*>();
+ for (auto req : requirements) {
+ if (!req->get_pass() && req->get_tested()) failed_requirements.push_back(req);
}
return failed_requirements;
}
+std::vector<Requirement*> TestScript::get_untested_requirements() {
+ std::vector<Requirement*> untested_requirements = std::vector<Requirement*>();
+ for (auto req : requirements) {
+ if (!req->get_tested()) untested_requirements.push_back(req);
+ }
+ return untested_requirements;
+}
+GameManager* TestScript::get_game_manager() { return game_manager; }
+std::string TestScript::get_script_name() { return script_name; }
// Setters
-void TestScript::set_requirements(std::vector<Requirement> in_requirements) { requirements = in_requirements; }
-void TestScript::add_requirement(Requirement req) { requirements.push_back(req); }
+void TestScript::set_requirements(std::vector<Requirement*> in_requirements) { requirements = in_requirements; }
+void TestScript::add_requirement(Requirement* req) { requirements.push_back(req); }
+void TestScript::set_game_manager(GameManager* in_game_manager) { game_manager = in_game_manager; }
+void TestScript::set_script_name(std::string in_script_name) { script_name = in_script_name; }