diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2020-02-06 12:07:04 +0100 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2020-02-06 23:43:05 +0100 |
commit | 8237e39f5dfa5e6e43aca7d7b9107c666d40de7b (patch) | |
tree | dd490b65d6ba1567cede59822ee5f1e0cda9f1c8 /tests/auto/testlib/selftests/benchliboptions | |
parent | dbdb3cbc907fed4055adaa848dd5e36fb67b2263 (diff) |
testlib: Move subtest argument handling to individual tests
The test orchestrator shouldn't have to deal with the individual options
needed for each test.
Change-Id: I78bbf4850cc649e625bd08a7aedf02267ba1314d
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'tests/auto/testlib/selftests/benchliboptions')
-rw-r--r-- | tests/auto/testlib/selftests/benchliboptions/tst_benchliboptions.cpp | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/tests/auto/testlib/selftests/benchliboptions/tst_benchliboptions.cpp b/tests/auto/testlib/selftests/benchliboptions/tst_benchliboptions.cpp index c1acf5a6e8..b89ca28ff2 100644 --- a/tests/auto/testlib/selftests/benchliboptions/tst_benchliboptions.cpp +++ b/tests/auto/testlib/selftests/benchliboptions/tst_benchliboptions.cpp @@ -83,6 +83,9 @@ void tst_BenchlibOptions::threeEvents() int main(int argc, char** argv) { + std::vector<const char*> args(argv, argv + argc); + args.push_back("-eventcounter"); + int ret = 0; TestEventDispatcher dispatcher; @@ -91,29 +94,27 @@ int main(int argc, char** argv) /* Run with no special arguments. */ { tst_BenchlibOptions test; - ret += QTest::qExec(&test, argc, argv); + ret += QTest::qExec(&test, args.size(), const_cast<char**>(&args[0])); } /* Run with an exact number of iterations. */ { - QVector<char const*> args; - for (int i = 0; i < argc; ++i) args << argv[i]; - args << "-iterations"; - args << "15"; + auto extraArgs = args; + extraArgs.push_back("-iterations"); + extraArgs.push_back("15"); tst_BenchlibFifteenIterations test; - ret += QTest::qExec(&test, args.count(), const_cast<char**>(args.data())); + ret += QTest::qExec(&test, extraArgs.size(), const_cast<char**>(&extraArgs[0])); } /* Run until getting a value of at least 100. */ { - QVector<char const*> args; - for (int i = 0; i < argc; ++i) args << argv[i]; - args << "-minimumvalue"; - args << "100"; + auto extraArgs = args; + extraArgs.push_back("-minimumvalue"); + extraArgs.push_back("100"); tst_BenchlibOneHundredMinimum test; - ret += QTest::qExec(&test, args.count(), const_cast<char**>(args.data())); + ret += QTest::qExec(&test, extraArgs.size(), const_cast<char**>(&extraArgs[0])); } return ret; |