aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/testing/test_scripts/A_002_economy_tests.cpp
diff options
context:
space:
mode:
author CptAlanSmith <CptAlanSmith@gmail.com>2023-09-27 01:34:31 +0200
committer CptAlanSmith <CptAlanSmith@gmail.com>2023-09-28 21:06:12 +0200
commitdbace1d971b604063455200b277fb2bc21cd5978 (patch)
treef1773cb4eef1ef21c5fe8aade732d250c0dd701d /src/openvic-simulation/testing/test_scripts/A_002_economy_tests.cpp
parentbc1a8c3e9a9209d0f2c2b843be4a11f317d0b479 (diff)
Abstracted out a general test method to TestScript
Diffstat (limited to 'src/openvic-simulation/testing/test_scripts/A_002_economy_tests.cpp')
-rw-r--r--src/openvic-simulation/testing/test_scripts/A_002_economy_tests.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/openvic-simulation/testing/test_scripts/A_002_economy_tests.cpp b/src/openvic-simulation/testing/test_scripts/A_002_economy_tests.cpp
index 9f0ddbd..c74c5e9 100644
--- a/src/openvic-simulation/testing/test_scripts/A_002_economy_tests.cpp
+++ b/src/openvic-simulation/testing/test_scripts/A_002_economy_tests.cpp
@@ -503,16 +503,15 @@ namespace OpenVic {
check_base_price("wool", "0.7", "ECON_261");
}
- void check_base_price(std::string identifier, std::string value, std::string req_name) {
+ void check_base_price(std::string identifier, std::string target_value, std::string req_name) {
+ // Get string of base_price from goods manager
fixed_point_t base_price_fp = get_game_manager()->get_good_manager().get_good_by_identifier(identifier)->get_base_price();
std::stringstream ss;
- ss << std::fixed << std::setprecision(1) << base_price_fp.to_double();
+ ss << std::fixed << std::setprecision(1) << base_price_fp.to_double(); // Use a single digit floating point of the value
std::string base_price = ss.str();
- Requirement* req = get_requirement_by_id(req_name);
- req->set_target_value(value);
- req->set_actual_value(base_price);
- if (base_price == value) req->set_pass(true);
- else req->set_pass(false);
+
+ // Perform req checks
+ pass_or_fail_req_with_actual_and_target_values(req_name, target_value, base_price);
}
};
}