Example #1
0
void AllTests()
{
	UnitTest tests;
	ArrayTests(tests);
	DictionaryTests(tests);
	ListTests(tests);
	StringTests(tests);
	WriteLine(tests.Execute());
	ReadLine();
}
/**
*   @brief Entry point of the program
*
*   @param [in]  argc   argument count
*   @param [in]  argv   argument vector
*   @return             Indicates execution failure or success
*/
int main(int argc, char* argv[])
{
    try
    {
        cla::parser P;

        P - cla::ignore_mismatch
                << cla::named_parameter<rt::cstring>("test") - (cla::prefix = "--")
                << cla::named_parameter<rt::cstring>("list") - (cla::prefix = "--", cla::optional)
                << cla::named_parameter<rt::cstring>("list-debug") - (cla::prefix = "--", cla::optional)
                << cla::named_parameter<rt::cstring>("init") - (cla::prefix = "--", cla::optional);

        P.parse(argc, argv);

        assign_op(test_lib_name, P.get("test"), 0);

        if (P["init"])
        {
            assign_op(init_func_name, P.get("init"), 0);
        }

        int res = ::boost::exit_success;

        //if the list or the list-debug command line directives are present then just enumerate tests,
        //otherwise execute the tests according to the additional Boost UTF specific  command line options supplied
        if (P["list"] || P["list-debug"])
        {
            res = ListTests(P);
        }
        else
        {
            //run tests
            res = ::boost::unit_test::unit_test_main(&load_test_lib, argc, argv);
        }

        ::boost::unit_test::framework::clear();
        dyn_lib::close(test_lib_handle);    //unload the library

        return res;
    }
    catch (rt::logic_error const& ex)
    {
        std::cout << "Fail to parse command line arguments: " << ex.msg() << std::endl;
        return -1;
    }
}