Commits

Matt Oswald committed d72ffe1

passing std::chrono::milliseconds up through the API where possible

  • Participants
  • Parent commits 1cced32

Comments (0)

Files changed (3)

File xUnit++/TestRunner.cpp

     std::mutex mFinishMtx;
 };
 
-size_t RunAllTests(const std::string &suite, size_t maxTestRunTime, size_t maxConcurrent)
+size_t RunAllTests(const std::string &suite)
+{
+    return RunAllTests(suite, std::chrono::milliseconds::zero());
+}
+
+size_t RunAllTests(std::chrono::milliseconds maxTestRunTime)
+{
+    return RunAllTests("", maxTestRunTime);
+}
+
+size_t RunAllTests(const std::string &suite, std::chrono::milliseconds maxTestRunTime, size_t maxConcurrent)
 {
     return
         TestRunner(&DefaultReporter::ReportStart,
 {
 }
 
-size_t TestRunner::RunTests(const std::vector<Fact> &facts, const std::vector<Theory> &theories, const std::string &suite, size_t maxTestRunTime, size_t maxConcurrent)
+size_t TestRunner::RunTests(const std::vector<Fact> &facts, const std::vector<Theory> &theories, const std::string &suite, std::chrono::milliseconds maxTestRunTime, size_t maxConcurrent)
 {
     auto timeStart = std::chrono::system_clock::now();
 
                 auto testTimeLimit = test.testDetails.TimeLimit;
                 if (testTimeLimit < std::chrono::milliseconds::zero())
                 {
-                    testTimeLimit = std::chrono::milliseconds(maxTestRunTime);
+                    testTimeLimit = maxTestRunTime;
                 }
 
                 if (testTimeLimit > std::chrono::milliseconds::zero())

File xUnit++/TestRunner.h

 class Theory;
 struct TestDetails;
 
-size_t RunAllTests(const std::string &suite = "", size_t maxTestRunTime = 0, size_t maxConcurrent = 0);
+size_t RunAllTests(const std::string &suite);
+size_t RunAllTests(std::chrono::milliseconds maxTestRunTime);
+size_t RunAllTests(const std::string &suite = "", std::chrono::milliseconds maxTestRunTime = std::chrono::milliseconds::zero(), size_t maxConcurrent = 0);
 
 class TestRunner
 {
                std::function<void(const TestDetails &, const std::string &)> onTestFailure,
                std::function<void(const TestDetails &, std::chrono::milliseconds)> onTestFinish,
                std::function<void(int, int, int, std::chrono::milliseconds)> onAllTestsComplete);
-    size_t RunTests(const std::vector<Fact> &facts, const std::vector<Theory> &theories, const std::string &suite, size_t maxTestRunTime = 0, size_t maxConcurrent = 0);
+    size_t RunTests(const std::vector<Fact> &facts, const std::vector<Theory> &theories, const std::string &suite,
+                    std::chrono::milliseconds maxTestRunTime = std::chrono::milliseconds::zero(), size_t maxConcurrent = 0);
 
 private:
     class Impl;

File xUnit++/main.cpp

 
 int main()
 {
-    return xUnitpp::RunAllTests("", 50);
+    return xUnitpp::RunAllTests(std::chrono::milliseconds(50));
 }