14#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
15#include <doctest/doctest.h>
19TEST_SUITE_BEGIN(
"CommandLineParser");
20TEST_CASE(
"Parse config file names")
23 ArgV argv1({
"nextsimdg",
"--config-file",
"config.cfg" });
25 CommandLineParser clp1(argv1.argc(), argv1());
26 std::vector<std::string> cfgs = clp1.getConfigFileNames();
28 REQUIRE(cfgs.size() == 1);
29 REQUIRE(cfgs[0] == std::string(argv1()[argv1.argc() - 1]));
32 std::string finalFileName =
"final.cfg";
33 ArgV argv2({
"nextsimdg",
"--config-file",
"config.cfg",
"--config-files",
"test.cfg",
34 "more.cfg", finalFileName });
36 CommandLineParser clp2(argv2.argc(), argv2());
37 cfgs = clp2.getConfigFileNames();
39 REQUIRE(cfgs.size() == 4);
40 REQUIRE(cfgs[cfgs.size() - 1] == finalFileName);