1 #define BOOST_TEST_DYN_LINK
2 #include <boost/test/unit_test.hpp>
18 BOOST_AUTO_TEST_SUITE(ConfigEnumTest)
25 fs::path test_cases_path(
"tests/unit/clex/ConfigEnumAllOccupations_test_cases.json");
28 fs::path test_proj_dir(
"tests/unit/clex/test_proj");
30 for(
auto test_it = tests.
begin(); test_it != tests.
end(); ++test_it) {
39 BOOST_CHECK_MESSAGE(j.
contains(
"title"),
"test case 'title' is required");
40 BOOST_CHECK_MESSAGE(j.
contains(
"prim"),
"test case 'prim' is required");
41 BOOST_CHECK_MESSAGE(j.
contains(
"min_vol"),
"test case 'min_vol' is required");
42 BOOST_CHECK_MESSAGE(j.
contains(
"max_vol"),
"test case 'max_vol' is required");
48 if(fs::exists(test_proj_dir /
".casm")) {
49 fs::remove_all(test_proj_dir);
52 fs::create_directory(test_proj_dir);
54 j[
"prim"].
write(test_proj_dir /
"prim.json");
57 ProjectBuilder builder(test_proj_dir, j[
"title"].get<std::string>(),
"formation_energy");
64 ScelEnumProps enum_props(j[
"min_vol"].get<int>(), j[
"max_vol"].get<int>() + 1);
70 check(
"Nscel", j, json_scel, test_cases_path, quiet);
80 check(
"Nconfigs", j, json, test_cases_path, quiet);
86 if(fs::exists(test_proj_dir /
".casm")) {
87 fs::remove_all(test_proj_dir);
92 BOOST_AUTO_TEST_SUITE_END()
Enumerate over all possible occupations in a particular Supercell.
boost::container::stable_vector< Supercell > & get_supercell_list()
Access entire supercell_list.
iterator end()
Returns iterator to end of JSON object or JSON array.
void write(const std::string &file_name, unsigned int indent=2, unsigned int prec=12) const
Write json to file.
Structure specifies the lattice and atomic basis of a crystal.
Data structure for holding supercell enumeration properties.
BOOST_AUTO_TEST_CASE(ConfigEnumAllOccupationsTest)
iterator begin()
Returns const_iterator to beginning of JSON object or JSON array.
void generate_supercells(const ScelEnumProps &enum_props)
Use the given CSPECS.
BasicStructure< Site > read_prim(fs::path filename)
Sets up directories and files for a new CASM project.
EigenIndex Index
For long integer indexing:
bool get_else(T &t, const std::string &key, const T &default_value, Args...args) const
PrimClex is the top-level data structure for a CASM project.
void build() const
Builds a new CASM project.
bool check(std::string test, const jsonParser &expected, const jsonParser &calculated, fs::path test_cases_path, bool quiet, double tol=0.0)
Check expected JSON vs calculated JSON using BOOST_CHECK_EQUAL.
jsonParser & push_back(const T &value)
Puts new valued element at end of array of any type T for which 'jsonParser& to_json( const T &value...
bool contains(const std::string &name) const
Return true if JSON object contains 'name'.
static jsonParser array()
Returns an empty json array.