Matt Oswald avatar Matt Oswald committed 4b4aab8

adding UNTIMED macros

Comments (0)

Files changed (2)

Tests/UnitTests/TestRunner.cpp

     tests.push_back(TestFactory(test, testCheck));
     RunTests(output, &Filter::AllTests, tests, duration, 0);
 
-    auto min = Time::ToDuration(test.duration) - Time::ToDuration(Time::ToMilliseconds(5));
-    auto max = Time::ToDuration(test.duration) + Time::ToDuration(Time::ToMilliseconds(5));
+    auto min = test.duration - Time::ToMilliseconds(10);
+    auto max = test.duration + Time::ToMilliseconds(10);
 
-    Assert.InRange(std::get<1>(output.finishedTests[0]).count(), min.count(), max.count());
+    Assert.InRange(Time::ToMilliseconds(std::get<1>(output.finishedTests[0])).count(), min.count(), max.count());
 }
 
 FACT_FIXTURE(NoTestsAreFailuresWhenNoTestsRun, TestRunnerFixture)
 
 FACT_FIXTURE(FailuresAreReported, TestRunnerFixture)
 {
-    tests.push_back(TestFactory(FailingTest(), testCheck));
     tests.push_back(TestFactory([=]() { testCheck->Fail(); testCheck->Fail(); }, testCheck));
     RunTests(output, &Filter::AllTests, tests, duration, 0);
 
-    Assert.Equal(3U, output.failures.size());
+    Assert.Equal(2U, output.failures.size());
 }
 
 FACT_FIXTURE(SkippedTestsAreReported, TestRunnerFixture)
     Assert.Equal(1U, output.summarySkipped);
 }
 
-TIMED_FACT_FIXTURE(SlowTestsPassHighTimeThreshold, TestRunnerFixture, 0)
+UNTIMED_FACT_FIXTURE(SlowTestsPassHighTimeThreshold, TestRunnerFixture)
 {
     tests.push_back(TestFactory(SleepyTest(), testCheck));
     RunTests(output, &Filter::AllTests, tests, Time::ToDuration(Time::ToMilliseconds(200)), 0);
     Assert.Equal(0U, output.summaryFailed);
 }
 
-TIMED_FACT_FIXTURE(SlowTestsFailLowTimeThreshold, TestRunnerFixture, 0)
+UNTIMED_FACT_FIXTURE(SlowTestsFailLowTimeThreshold, TestRunnerFixture)
 {
     SleepyTest sleepyTest;
     tests.push_back(TestFactory(sleepyTest, testCheck));
     Assert.Equal(1U, output.summaryFailed);
 }
 
-TIMED_FACT_FIXTURE(SlowTestFailsBecauseOfTimeLimitReportsReason, TestRunnerFixture, 0)
+UNTIMED_FACT_FIXTURE(SlowTestFailsBecauseOfTimeLimitReportsReason, TestRunnerFixture)
 {
     tests.push_back(TestFactory(SleepyTest(), testCheck));
     RunTests(output, &Filter::AllTests, tests, Time::ToDuration(Time::ToMilliseconds(1)), 0);
     Assert.Contains(std::get<1>(output.failures[0]), "1 milliseconds.");
 }
 
-TIMED_FACT_FIXTURE(SlowTestWithTimeExemptionPasses, TestRunnerFixture, 0)
+UNTIMED_FACT_FIXTURE(SlowTestWithTimeExemptionPasses, TestRunnerFixture)
 {
     tests.push_back(TestFactory(SleepyTest(), testCheck).Duration(Time::ToDuration(Time::ToMilliseconds(0))));
 
 }
 
 ATTRIBUTES(TestOrderIsRandomized, ("Skip", "Threading issues preventing me from tracking down why this *doesn't* fail right now."))
-TIMED_FACT_FIXTURE(TestOrderIsRandomized, TestRunnerFixture, 0)
+UNTIMED_FACT_FIXTURE(TestOrderIsRandomized, TestRunnerFixture)
 {
     // the best I can do here is have 10 tests run, and hope that I don't run into the same 10
     // values back-to-back

xUnit++/xUnit++/xUnitMacros.h

     } \
     void FactName ## _ns::FactName ## _Fixture::FactName()
 
+#define UNTIMED_FACT_FIXTURE(FactName, FixtureType) TIMED_FACT_FIXTURE(FactName, FixtureType, 0)
+
 #define FACT_FIXTURE(FactName, FixtureType) TIMED_FACT_FIXTURE(FactName, FixtureType, -1)
 
 #define TIMED_FACT(FactName, timeout) TIMED_FACT_FIXTURE(FactName, xUnitpp::NoFixture, timeout)
 
+#define UNTIMED_FACT(FactName) TIMED_FACT_FIXTURE(FactName, xUnitpp::NoFixture, 0)
+
 #define FACT(FactName) TIMED_FACT_FIXTURE(FactName, xUnitpp::NoFixture, -1)
 
 #define TIMED_DATA_THEORY(TheoryName, params, DataProvider, timeout) \
     } \
     void TheoryName ## _ns::TheoryName params
 
+#define UNTIMED_DATA_THEORY(TheoryName, params, DataProvider, timeout) TIMED_DATA_THEORY(TheoryName, params, DataProvider, 0)
+
 #define DATA_THEORY(TheoryName, params, DataProvider) TIMED_DATA_THEORY(TheoryName, params, DataProvider, -1)
 
 #define TIMED_THEORY(TheoryName, params, timeout, ...) \
     } \
     void TheoryName ## _ns::TheoryName params
 
+#define UNTIMED_THEORY(TheoryName, params, ...) TIMED_THEORY(TheoryName, params, 0, __VA_ARGS__)
+
 #define THEORY(TheoryName, params, ...) TIMED_THEORY(TheoryName, params, -1, __VA_ARGS__)
 
 #define LI xUnitpp::LineInfo(__FILE__, __LINE__)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.