CASM
AClustersApproachtoStatisticalMechanics
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules
settings_test.cpp
Go to the documentation of this file.
1 #define BOOST_TEST_DYN_LINK
2 #include <boost/test/unit_test.hpp>
3 
6 
8 
9 //#include "casm/app/ProjectBuilder.hh"
10 #include "Common.hh"
11 #include "FCCTernaryProj.hh"
12 
13 using namespace CASM;
14 
15 
16 BOOST_AUTO_TEST_SUITE(settingsTest)
17 
19 
20  // create a project
22  proj.check_init();
23 
24  // in case you want to see what's happening
25  OStringStreamLog ss_log;
26  OStringStreamLog ss_debug_log;
27  OStringStreamLog ss_err_log;
28 
29  // construct PrimClex
30  PrimClex primclex(proj.dir, Logging(ss_log, ss_debug_log, ss_err_log));
31 
32  auto exec = [&](const std::string & args) {
33  CommandArgs cmdargs(args, &primclex, proj.dir, ss_log, ss_err_log);
34  return casm_api(cmdargs);
35  };
36 
37  BOOST_CHECK_EQUAL(exec("casm settings -l"), 0);
38  BOOST_CHECK_EQUAL(exec("casm settings --new-calctype test1"), 0);
39  BOOST_CHECK_EQUAL(exec("casm settings --new-ref test1"), 0);
40  BOOST_CHECK_EQUAL(exec("casm settings --new-bset test1"), 0);
41  BOOST_CHECK_EQUAL(exec("casm settings --new-eci test1"), 0);
42  BOOST_CHECK_EQUAL(exec("casm settings --set-calctype default"), 0);
43  BOOST_CHECK_EQUAL(exec("casm settings --set-calctype does_not_exist"), 1);
44  BOOST_CHECK_EQUAL(exec("casm settings --set-calctype test1"), 0);
45  BOOST_CHECK_EQUAL(exec("casm settings --set-bset test1"), 0);
46  BOOST_CHECK_EQUAL(exec("casm settings --set-bset default"), 0);
47 
48  //std::cout << ss_log.ss().str() << std::endl;
49  //std::cout << ss_err_log.ss().str() << std::endl;
50 
51 }
52 
53 BOOST_AUTO_TEST_SUITE_END()
Data structure holding basic CASM command info.
fs::path dir
Definition: Proj.hh:34
PrimClex * primclex
Definition: settings.cc:101
Main CASM namespace.
Definition: complete.cpp:8
BOOST_AUTO_TEST_CASE(Basics)
PrimClex is the top-level data structure for a CASM project.
Definition: PrimClex.hh:52
virtual void check_init()
Check project initialization.
int casm_api(const CommandArgs &args)
Executes CASM commands specified by args.