From 7081ed42434a414bf0efd889b736215c91a00fe7 Mon Sep 17 00:00:00 2001 From: Ian Bell <ian.bell@nist.gov> Date: Tue, 3 Aug 2021 11:07:55 -0400 Subject: [PATCH] Add test for mutant --- src/tests/catch_test_mutant.cxx | 41 +++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 src/tests/catch_test_mutant.cxx diff --git a/src/tests/catch_test_mutant.cxx b/src/tests/catch_test_mutant.cxx new file mode 100644 index 0000000..fe45cc3 --- /dev/null +++ b/src/tests/catch_test_mutant.cxx @@ -0,0 +1,41 @@ +#include "catch/catch.hpp" + +#include "teqp/models/multifluid.hpp" + +TEST_CASE("Test construction of mutant", "[mutant]") +{ + + std::string coolprop_root = "../mycp"; + auto BIPcollection = coolprop_root + "/dev/mixtures/mixture_binary_pairs.json"; + + auto model = build_multifluid_model({ "Nitrogen", "Ethane" }, coolprop_root, BIPcollection); + + std::string s0 = R"({"0": {} })"; + nlohmann::json j0 = nlohmann::json::parse(s0); + + std::string s = R"({ + "0": { + "1": { + "BIP": { + "betaT": 1.1, + "gammaT": 0.9, + "betaV": 1.05, + "gammaV": 1.3, + "Fij": 1.0 + }, + "departure":{ + "type": "none" + } + } + } + })"; + nlohmann::json j = nlohmann::json::parse(s); + auto mutant = build_multifluid_mutant(model, j); + + double T = 300, rho = 300; + Eigen::ArrayXd molefrac(2); molefrac = 0.5; + auto Ar02base = TDXDerivatives<decltype(model)>::get_Ar02(model, T, rho, molefrac); + auto Ar02mut = TDXDerivatives<decltype(mutant)>::get_Ar02(mutant, T, rho, molefrac); + CHECK(Ar02base != Ar02mut); + +} \ No newline at end of file -- GitLab