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

Check that all models can be instantiated

parent 61d066b3
No related branches found
No related tags found
No related merge requests found
#pragma once
#include <filesystem>
/** Find all files in a given folder that match the specified file extension
* The extension should be specified with the period, as in ".json"
*/
static auto get_files_in_folder(const std::string& folder, const std::string& extension)
{
std::vector<std::filesystem::path> files;
for (auto const& dir_entry : std::filesystem::directory_iterator{ folder }) {
auto path = dir_entry.path();
if (path.extension() == extension) {
files.push_back(path.filename());
}
}
return files;
}
\ No newline at end of file
......@@ -2,6 +2,8 @@
#include "teqp/models/multifluid.hpp"
#include "teqp/algorithms/critical_tracing.hpp"
#include "teqp/filesystem.hpp"
TEST_CASE("Confirm failure for missing files","[multifluid]") {
CHECK_THROWS(build_multifluid_model({ "BADFLUID" }, "IMPOSSIBLE PATH", "IMPOSSIBLE PATH.json"));
......@@ -38,4 +40,13 @@ TEST_CASE("Trace critical locus for nitrogen + ethane", "[crit],[multifluid]")
CHECK(j.size() > 3);
auto tic1 = std::chrono::steady_clock::now();
}
}
TEST_CASE("Check that all models can be instantiated", "[multifluid],[all]"){
std::string root = "../mycp";
for (auto filename : get_files_in_folder(root + "/dev/fluids", ".json")) {
auto stem = 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");
}
}
\ 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