From 8237e39f5dfa5e6e43aca7d7b9107c666d40de7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Thu, 6 Feb 2020 12:07:04 +0100 Subject: 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 --- .../benchliboptions/tst_benchliboptions.cpp | 23 +++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'tests/auto/testlib/selftests/benchliboptions/tst_benchliboptions.cpp') 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 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(&args[0])); } /* Run with an exact number of iterations. */ { - QVector 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(args.data())); + ret += QTest::qExec(&test, extraArgs.size(), const_cast(&extraArgs[0])); } /* Run until getting a value of at least 100. */ { - QVector 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(args.data())); + ret += QTest::qExec(&test, extraArgs.size(), const_cast(&extraArgs[0])); } return ret; -- cgit v1.2.3