Skip to content
Snippets Groups Projects
Commit 5d02964f authored by Ian Bell's avatar Ian Bell
Browse files

Update the tests to actually call alphar for pures

parent 94565dac
No related branches found
No related tags found
No related merge requests found
...@@ -8,12 +8,13 @@ ...@@ -8,12 +8,13 @@
TEST_CASE("Confirm failure for missing files","[multifluid]") { 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", "IMPOSSIBLE PATH.json"));
CHECK_THROWS(build_multifluid_model({ "BADFLUID" }, "IMPOSSIBLE PATH", "../mycp/dev/mixtures/mixture_binary_pairs.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]") TEST_CASE("Trace critical locus for nitrogen + ethane", "[crit],[multifluid]")
{ {
std::string root = "../mycp"; 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) { for (auto ifluid = 0; ifluid < 2; ++ifluid) {
double T0 = model.redfunc.Tc[ifluid]; double T0 = model.redfunc.Tc[ifluid];
...@@ -45,18 +46,25 @@ TEST_CASE("Trace critical locus for nitrogen + ethane", "[crit],[multifluid]") ...@@ -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]"){ TEST_CASE("Check that all pure fluid models can be instantiated", "[multifluid],[all]"){
std::string root = "../mycp"; std::string root = "../mycp";
SECTION("With absolute paths to json file") { SECTION("With absolute paths to json file") {
int counter = 0;
for (auto path : get_files_in_folder(root + "/dev/fluids", ".json")) { for (auto path : get_files_in_folder(root + "/dev/fluids", ".json")) {
if (path.filename().stem() == "Methanol") { continue; } if (path.filename().stem() == "Methanol") { continue; }
CAPTURE(path.string()); CAPTURE(path.string());
auto abspath = std::filesystem::absolute(path).string(); auto abspath = std::filesystem::absolute(path).string();
auto model = build_multifluid_model({ abspath }, root, root + "/dev/mixtures/mixture_binary_pairs.json"); 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") { SECTION("With filename stems") {
for (auto path : get_files_in_folder(root + "/dev/fluids", ".json")) { for (auto path : get_files_in_folder(root + "/dev/fluids", ".json")) {
auto stem = path.filename().stem().string(); // filename without the .json auto stem = path.filename().stem().string(); // filename without the .json
if (stem == "Methanol") { continue; } if (stem == "Methanol") { continue; }
auto model = build_multifluid_model({ stem }, root, root + "/dev/mixtures/mixture_binary_pairs.json"); 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 ...@@ -70,5 +78,6 @@ TEST_CASE("Check that mixtures can also do absolute paths", "[multifluid],[abspa
abspaths.emplace_back(std::filesystem::absolute(p).string()); abspaths.emplace_back(std::filesystem::absolute(p).string());
} }
auto model = build_multifluid_model(abspaths, root, root + "/dev/mixtures/mixture_binary_pairs.json"); 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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment