CASM
AClustersApproachtoStatisticalMechanics
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules
Proj.hh
Go to the documentation of this file.
1 #ifndef CASM_UNIT_PROJ
2 #define CASM_UNIT_PROJ
3 
4 #define BOOST_TEST_DYN_LINK
5 #include <boost/test/unit_test.hpp>
6 
12 #include "casm/system/Popen.hh"
13 
14 using namespace CASM;
15 
16 namespace test {
17 
18  class Proj {
19 
20  public:
21 
22  Proj(fs::path _proj_dir,
23  const BasicStructure<Site> &_prim,
24  std::string _title,
25  std::string _desc) :
26  dir(_proj_dir),
27  prim(_prim),
28  title(_title),
29  desc(_desc),
30  m_dirs(dir) {}
31 
32  virtual ~Proj() {}
33 
36  std::string title;
37  std::string desc;
38 
39  std::string cd_and() const {
40  return "cd " + dir.string() + "&& ";
41  };
42 
44  virtual void check_init();
45 
47  virtual void check_symmetry();
48 
50  virtual void check_composition();
51 
53  virtual void check_bset() = 0;
54 
56  virtual void check_enum();
57 
59  virtual void check_select();
60 
62  virtual void check_query();
63 
67  void make();
68 
69  static std::vector<fs::path> &directory_list;
70 
71  protected:
72 
74  boost::smatch m_match;
77 
78  void _check_symmetry(int lat_pg_op, int lat_pg_class,
79  int xtal_pg_op, int xtal_pg_class,
80  int fg_op, int fg_class,
81  std::string lat_pg_name, std::string xtal_pg_name);
82 
83  template<typename Iterator>
84  void _check_composition_axes(Iterator begin, Iterator end);
85 
86  };
87 
91 
94  void check_symgroup(const jsonParser &json, int N_op, int N_class);
95 
96 }
97 
98 namespace test {
99 
100  template<typename Iterator>
101  void Proj::_check_composition_axes(Iterator begin, Iterator end) {
102 
103  m_p.popen(cd_and() + "ccasm composition --select 0");
104 
105  for(auto it = begin; it != end; ++it) {
106  BOOST_CHECK_MESSAGE(boost::regex_search(m_p.gets(), m_match, boost::regex(*it)) == true, m_p.gets());
107  }
108 
109  BOOST_CHECK_MESSAGE(
110  boost::regex_search(m_p.gets(), m_match, boost::regex(R"(Currently selected composition axes: 0)")) ==
111  true,
112  m_p.gets()
113  );
114  }
115 }
116 
117 #endif
ClexDescription & desc
Definition: settings.cc:104
fs::path dir
Definition: Proj.hh:34
Popen m_p
Definition: Proj.hh:73
Specification of CASM project directory structure.
virtual ~Proj()
Definition: Proj.hh:32
Definition: Common.hh:7
Main CASM namespace.
Definition: complete.cpp:8
DirectoryStructure m_dirs
Definition: Proj.hh:75
fs::path proj_dir(fs::path init)
Create a new project directory, appending ".(#)" to ensure it is a new project.
Remember how to use popen.
Definition: Popen.hh:12
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...
std::string cd_and() const
Definition: Proj.hh:39
BasicStructure< Site > prim
Definition: Proj.hh:35
boost::smatch m_match
Definition: Proj.hh:74
std::string title
Definition: Proj.hh:36
std::string desc
Definition: Proj.hh:37
DirectoryStructure & dir
Definition: settings.cc:102
static std::vector< fs::path > & directory_list
Definition: Proj.hh:69
Proj(fs::path _proj_dir, const BasicStructure< Site > &_prim, std::string _title, std::string _desc)
Definition: Proj.hh:22
notstd::cloneable_ptr< ProjectSettings > m_set
Definition: Proj.hh:76