aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/testing/TestScript.cpp
diff options
context:
space:
mode:
author CptAlanSmith <123112708+CptAlanSmith@users.noreply.github.com>2023-09-23 20:25:15 +0200
committer GitHub <noreply@github.com>2023-09-23 20:25:15 +0200
commit005a8026bb424779a146e00cc48621ff1d72b807 (patch)
treedde15211e31d861b61711bf6aebdeb8713393d53 /src/openvic-simulation/testing/TestScript.cpp
parentebea2e473eefa3945508b0bf622a472b62d70d3b (diff)
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 <hop3114@gmail.com>
Diffstat (limited to 'src/openvic-simulation/testing/TestScript.cpp')
-rw-r--r--src/openvic-simulation/testing/TestScript.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/openvic-simulation/testing/TestScript.cpp b/src/openvic-simulation/testing/TestScript.cpp
new file mode 100644
index 0000000..7652fa5
--- /dev/null
+++ b/src/openvic-simulation/testing/TestScript.cpp
@@ -0,0 +1,31 @@
+#include <testing/TestScript.hpp>
+
+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];
+ }
+ return Requirement("NULL", "NULL", "NULL");
+}
+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]);
+ }
+ 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]);
+ }
+ return failed_requirements;
+}
+
+// Setters
+void TestScript::set_requirements(std::vector<Requirement> in_requirements) { requirements = in_requirements; }
+void TestScript::add_requirement(Requirement req) { requirements.push_back(req); }