28 if(!expected.
contains(test) && !quiet) {
29 std::cout <<
"Test case: " << expected[
"title"] <<
" has no \"" << test <<
"\" test data." << std::endl;
30 std::cout <<
"To use the current CASM results, add the following to the " << expected[
"title"]
31 <<
" test case in " << test_cases_path << std::endl;
34 std::cout << j << std::endl;
40 ok = (expected[test] == calculated);
42 diff_path =
find_diff(expected[test], calculated);
53 std::cout <<
"Difference at: " << diff_path << std::endl;
54 std::cout <<
"Expected: \n" << expected[test].
at(diff_path) <<
"\n"
55 <<
"Found: \n" << calculated.
at(diff_path) << std::endl;
66 fs::path result = fs::absolute(init);
68 std::string
dot =
".";
69 while(!fs::create_directories(result)) {
80 if(!fs::exists(
dir /
".casm")) {
83 json[
"description"] =
desc;
93 m_set = notstd::make_cloneable<ProjectSettings>(
dir);
98 BOOST_CHECK_EQUAL(json[
"character_table"].size(), N_class);
99 BOOST_CHECK_EQUAL(json[
"conjugacy_class"].size(), N_class);
101 BOOST_CHECK_EQUAL(json[
"symop"].size(), N_op);
102 BOOST_CHECK_EQUAL(json[
"symop"][0][
"type"].get<std::string>(),
"identity");
104 BOOST_CHECK_EQUAL(json[
"inverse"].size(), N_op);
105 BOOST_CHECK_EQUAL(json[
"multiplication_table"].size(), N_op);
106 for(
auto i = 0; i < json[
"multiplication_table"].
size(); ++i) {
107 BOOST_CHECK_EQUAL(json[
"multiplication_table"][i].size(), N_op);
126 BOOST_CHECK_EQUAL(
true, fs::exists(
dir));
129 BOOST_CHECK_EQUAL(
true, fs::exists(
m_dirs.
prim()));
149 int xtal_pg_op,
int xtal_pg_class,
150 int fg_op,
int fg_class,
151 std::string lat_pg_name, std::string xtal_pg_name) {
160 BOOST_CHECK_EQUAL(boost::regex_search(
m_p.
gets(),
m_match, boost::regex(R
"(Lattice point group is:\s+)" + lat_pg_name)), true);
161 BOOST_CHECK_EQUAL(boost::regex_search(
m_p.
gets(),
m_match, boost::regex(R
"(Crystal point group is:\s+)" + xtal_pg_name)), true);
176 m_p.
popen(
cd_and() +
"ccasm enum --method ConfigEnumAllOccupations --all");
size_type size() const
Returns array size if *this is a JSON array, object size if *this is a JSON object, 1 otherwise.
void commit() const
Save settings to project settings file.
boost::filesystem::path find_diff(const jsonParser &A, const jsonParser &B, boost::filesystem::path diff=boost::filesystem::path())
Return the location at which jsonParser 'A' != 'B' as a boost::filesystem::path.
bool set_casm_prefix(fs::path dir)
Set casm prefix (empty string to use default)
fs::path composition_axes() const
Return composition axes file path.
void write(const std::string &file_name, unsigned int indent=2, unsigned int prec=12) const
Write json to file.
std::string gets() const
Returns the stdout resulting from the last popen call.
void write_prim(const BasicStructure< Site > &prim, fs::path filename, COORD_TYPE mode)
Write prim.json to file.
void _check_symmetry(int lat_pg_op, int lat_pg_class, int xtal_pg_op, int xtal_pg_class, int fg_op, int fg_class, std::string lat_pg_name, std::string xtal_pg_name)
jsonParser & at(const fs::path &path)
void popen(std::string _command)
Execute popen for a given command.
std::string to_string(ENUM val)
Return string representation of enum class.
DirectoryStructure m_dirs
fs::path prim() const
Return prim.json path.
void make()
Build a CASM project at 'proj_dir' using the prim.
fs::path proj_dir(fs::path init)
Create a new project directory, appending ".(#)" to ensure it is a new project.
virtual void check_enum()
Check "casm enum".
fs::path crystal_point_group() const
Return crystal_point_group.json path.
void check_symgroup(const jsonParser &json, int N_op, int N_class)
Check some aspects of a SymGroup json, including the expected number of conjugacy classes and operati...
fs::path project_settings() const
Return project_settings.json path.
Sets up directories and files for a new CASM project.
virtual void check_symmetry()
Check symmetry.
std::pair< fs::path, std::string > casm_libdir() const
Get casm libdir.
std::string cd_and() const
bool set_casm_libdir(fs::path dir)
Set casm libdir (empty string to use default)
virtual void check_query()
Check "casm query".
T dot(const Tensor< T > &LHS, const Tensor< T > &RHS)
BasicStructure< Site > prim
fs::path lattice_point_group() const
Return lattice_point_group.json path.
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.
int exit_code() const
Returns pclose(fp)/256.
virtual void check_composition()
Check "casm composition".
bool almost_equal(const jsonParser &B, double tol) const
bool contains(const std::string &name) const
Return true if JSON object contains 'name'.
virtual void check_select()
Check "casm select".
notstd::cloneable_ptr< ProjectSettings > m_set
fs::path factor_group() const
Return factor_group.json path.
virtual void check_init()
Check project initialization.