aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/testing/TestScript.cpp
blob: 7652fa5464c7fb272f15524816f1671cb176deef (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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); }