CYCAMORE
Loading...
Searching...
No Matches
cycamore_unit_test_driver.cc
Go to the documentation of this file.
1#include <iostream>
2#include <string>
3
4#include <gtest/gtest.h>
5
6#include "env.h"
7#include "logger.h"
8
9int main(int argc, char* argv[]) {
10 // tell ENV the path between the cwd and the cyclus executable
11 std::string path = cyclus::Env::PathBase(argv[0]);
12 cyclus::Logger::ReportLevel() = cyclus::LEV_ERROR;
13
14 for (int i = 0; i < argc; i++) {
15 std::string arg = argv[i];
16 if (arg == "--help") {
17 std::cout << "GTest flags" << std::endl;
18 std::cout << "\t--gtest_list_tests List the tests" << std::endl;
19 std::cout << "\t--gtest_repeat Number of times to repeat each test" <<
20 std::endl;
21 std::cout << "\t--gtest_filter Glob filter of test name" << std::endl;
22 std::cout << "\t--gtest_print_time Time required to run" << std::endl;
23 std::cout <<
24 "\nBy default, a Google Test program runs all tests the user has defined. Sometimes, you want to run only a subset of the tests (e.g. for debugging or quickly verifying a change). If you set the GTEST_FILTER environment variable or the --gtest_filter flag to a filter string, Google Test will only run the tests whose full names (in the form of TestCaseName.TestName) match the filter.\n"
25 "The format of a filter is a ':'-separated list of wildcard patterns (called the positive patterns) optionally followed by a '-' and another ':'-separated pattern list (called the negative patterns). A test matches the filter if and only if it matches any of the positive patterns but does not match any of the negative patterns.\n"
26 "A pattern may contain '*' (matches any string) or '?' (matches any single character). For convenience, the filter '*-NegativePatterns' can be also written as '-NegativePatterns'.\n"
27 "For example:\n\n"
28 " * ./foo_test Has no flag, and thus runs all its tests.\n"
29 " * ./foo_test --gtest_filter=* Also runs everything, due to the single match-everything * value.\n"
30 " * ./foo_test --gtest_filter=FooTest.* Runs everything in test case FooTest.\n"
31 " * ./foo_test --gtest_filter=*Null*:*Constructor* Runs any test whose full name contains either \"Null\" or \"Constructor\".\n"
32 " * ./foo_test --gtest_filter=-*DeathTest.* Runs all non-death tests.\n"
33 " * ./foo_test --gtest_filter=FooTest.*-FooTest.Bar Runs everything in test case FooTest except FooTest.Bar. "
34 << std::endl;
35 return 0;
36 }
37 }
38 testing::InitGoogleTest(&argc, argv);
39 return RUN_ALL_TESTS();
40}
int main(int argc, char *argv[])