From 5d02964f1d50ca224e9a8f65b17d6c01a00d1a0b Mon Sep 17 00:00:00 2001 From: Ian Bell <ian.bell@nist.gov> Date: Tue, 2 Nov 2021 13:53:48 -0400 Subject: [PATCH] Update the tests to actually call alphar for pures --- src/tests/catch_test_multifluid.cxx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/tests/catch_test_multifluid.cxx b/src/tests/catch_test_multifluid.cxx index 8b7a718..bd3bbea 100644 --- a/src/tests/catch_test_multifluid.cxx +++ b/src/tests/catch_test_multifluid.cxx @@ -8,12 +8,13 @@ TEST_CASE("Confirm failure for missing files","[multifluid]") { CHECK_THROWS(build_multifluid_model({ "BADFLUID" }, "IMPOSSIBLE PATH", "IMPOSSIBLE PATH.json")); CHECK_THROWS(build_multifluid_model({ "BADFLUID" }, "IMPOSSIBLE PATH", "../mycp/dev/mixtures/mixture_binary_pairs.json")); + CHECK_THROWS(build_multifluid_model({ "Ethane" }, "IMPOSSIBLE PATH")); } TEST_CASE("Trace critical locus for nitrogen + ethane", "[crit],[multifluid]") { std::string root = "../mycp"; - const auto model = build_multifluid_model({ "Nitrogen", "Ethane" }, root, root+"/dev/mixtures/mixture_binary_pairs.json"); + const auto model = build_multifluid_model({ "Nitrogen", "Ethane" }, root); for (auto ifluid = 0; ifluid < 2; ++ifluid) { double T0 = model.redfunc.Tc[ifluid]; @@ -45,18 +46,25 @@ TEST_CASE("Trace critical locus for nitrogen + ethane", "[crit],[multifluid]") TEST_CASE("Check that all pure fluid models can be instantiated", "[multifluid],[all]"){ std::string root = "../mycp"; SECTION("With absolute paths to json file") { + int counter = 0; for (auto path : get_files_in_folder(root + "/dev/fluids", ".json")) { if (path.filename().stem() == "Methanol") { continue; } CAPTURE(path.string()); auto abspath = std::filesystem::absolute(path).string(); auto model = build_multifluid_model({ abspath }, root, root + "/dev/mixtures/mixture_binary_pairs.json"); + std::valarray<double> z(0.0, 1); + model.alphar(300, 1.0, z); + counter += 1; } + CHECK(counter > 100); } SECTION("With filename stems") { for (auto path : get_files_in_folder(root + "/dev/fluids", ".json")) { auto stem = path.filename().stem().string(); // filename without the .json if (stem == "Methanol") { continue; } auto model = build_multifluid_model({ stem }, root, root + "/dev/mixtures/mixture_binary_pairs.json"); + std::valarray<double> z(0.0, 1); + model.alphar(300, 1.0, z); } } } @@ -70,5 +78,6 @@ TEST_CASE("Check that mixtures can also do absolute paths", "[multifluid],[abspa abspaths.emplace_back(std::filesystem::absolute(p).string()); } auto model = build_multifluid_model(abspaths, root, root + "/dev/mixtures/mixture_binary_pairs.json"); + auto model2 = build_multifluid_model(abspaths, root); // default path for BIP } } \ No newline at end of file -- GitLab