diff options
author | Hop311 <Hop3114@gmail.com> | 2023-09-28 21:22:39 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-28 21:22:39 +0200 |
commit | 5764126f4a3940320990a9bc3007ba22e89a514c (patch) | |
tree | f03e84f8499035a03e2329498e239fb43ad4b614 /src/openvic-simulation/testing/test_scripts | |
parent | ae0be2a8d2e1b717f6c4a4617096f17089ce8701 (diff) | |
parent | 5c633065db4f2fd1c511543cab997c075cc9c28e (diff) |
Merge pull request #34 from OpenVicProject/Testing
Testing
Diffstat (limited to 'src/openvic-simulation/testing/test_scripts')
-rw-r--r-- | src/openvic-simulation/testing/test_scripts/A_002_economy_tests.cpp | 16 |
1 files changed, 9 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 aa0e59f..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,13 +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) { - std::string base_price = get_game_manager()->get_good_manager().get_good_by_identifier(identifier)->get_base_price().to_string(); - 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); + 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(); // Use a single digit floating point of the value + std::string base_price = ss.str(); + + // Perform req checks + pass_or_fail_req_with_actual_and_target_values(req_name, target_value, base_price); } }; } |