1 #define BOOST_TEST_DYN_LINK
2 #include <boost/test/unit_test.hpp>
8 #include <boost/filesystem.hpp>
17 std::string _no_proj_command,
18 std::string _help_command) :
20 no_proj_command(_no_proj_command),
28 BOOST_AUTO_TEST_SUITE(AppTest)
36 std::vector<Checks> command = {
37 Checks(
"composition",
"-d",
"-h"),
41 Checks(
"select",
"",
"-h"),
46 p.
popen(
"ccasm init -h");
49 for(
auto it = command.begin(); it != command.end(); ++it) {
50 p.
popen(
"ccasm " + it->type +
" " + it->no_proj_command);
53 p.
popen(
"ccasm " + it->type +
" " + it->help_command);
58 std::vector<std::unique_ptr<test::Proj> > proj;
59 proj.push_back(notstd::make_unique<test::FCCTernaryProj>());
60 proj.push_back(notstd::make_unique<test::ZrOProj>());
62 for(
auto proj_it = proj.begin(); proj_it != proj.end(); ++proj_it) {
64 log <<
"root: " << (*proj_it)->dir << std::endl;
66 log <<
"testing 'ccasm init'" << std::endl;
67 (*proj_it)->check_init();
69 log <<
"testing 'ccasm sym'" << std::endl;
70 (*proj_it)->check_symmetry();
72 log <<
"testing 'ccasm composition'" << std::endl;
73 (*proj_it)->check_composition();
75 log <<
"testing 'ccasm bset'" << std::endl;
76 (*proj_it)->check_bset();
78 log <<
"testing 'ccasm enum'" << std::endl;
79 (*proj_it)->check_enum();
81 log <<
"testing 'ccasm select'" << std::endl;
82 (*proj_it)->check_select();
84 log <<
"testing 'ccasm query'" << std::endl;
85 (*proj_it)->check_query();
87 log <<
"done" << std::endl;
92 log <<
"delete test projects" << std::endl;
94 log <<
"delete proj[0]:" << std::endl;
96 log <<
" done" << std::endl;
98 log <<
"delete proj[1]:" << std::endl;
100 log <<
" done" << std::endl;
102 log <<
"leaving test cast ProjectCommands" << std::endl;
105 BOOST_AUTO_TEST_SUITE_END()
std::string gets() const
Returns the stdout resulting from the last popen call.
void popen(std::string _command)
Execute popen for a given command.
Remember how to use popen.
void custom(const std::string &what)
std::string no_proj_command
static const int standard
Checks(std::string _type, std::string _no_proj_command, std::string _help_command)
BOOST_AUTO_TEST_CASE(ProjectCommands)
void reset(std::ostream &_ostream=std::cout, int _verbosity=standard, bool _show_clock=false)
int help_command(const CommandArgs &args)
Print CASM help info to args.log.
int exit_code() const
Returns pclose(fp)/256.