Commits

Matt Oswald committed 39c5425

fixing theories still taking identifiers

  • Participants
  • Parent commits 0441834
  • Tags 1.0.1

Comments (0)

Files changed (4)

File Tests/UnitTests/Assert.InRange.cpp

     return data;
 }
 
-DATA_THEORY(InRangeSuccess, (float actual, int min, int max), InRangeSuccessData)
+DATA_THEORY("InRangeSuccess", (float actual, int min, int max), InRangeSuccessData)
 {
     Assert.InRange(actual, min, max);
 }
     return data;
 }
 
-DATA_THEORY(InRangeAssertsOnFailure, (int actual, int min, int max), InRangeAssertsOnFailureData)
+DATA_THEORY("InRangeAssertsOnFailure", (int actual, int min, int max), InRangeAssertsOnFailureData)
 {
     Assert.Throws<xUnitAssert>([=]() { Assert.InRange(actual, min, max); });
 }

File Tests/UnitTests/Assert.NotInRange.cpp

     return data;
 }
 
-DATA_THEORY(NotInRangeSuccess, (int actual, int min, int max), NotInRangeSuccessData)
+DATA_THEORY("NotInRangeSuccess", (int actual, int min, int max), NotInRangeSuccessData)
 {
     Assert.NotInRange(actual, min, max);
 }
     return data;
 }
 
-DATA_THEORY(NotInRangeAssertsOnFailure, (int actual, int min, int max), NotInRangeAssertsOnFailureData)
+DATA_THEORY("NotInRangeAssertsOnFailure", (int actual, int min, int max), NotInRangeAssertsOnFailureData)
 {
     Assert.Throws<xUnitAssert>([=]() { Assert.NotInRange(actual, min, max); });
 }

File Tests/UnitTests/Theory.cpp

 
 ATTRIBUTES(("Cats", "Meow"))
 {
-DATA_THEORY(TheoriesCanHaveAttributes, (int), RawFunctionProvider)
+DATA_THEORY("TheoriesCanHaveAttributes", (int), RawFunctionProvider)
 {
     for (const auto &test : xUnitpp::TestCollection::Instance().Tests())
     {
     return result;
 }
 
-DATA_THEORY(TheoriesCanAcceptComplexObjects, (const std::string &, const std::vector<std::tuple<int, std::string>> &), ComplexProvider)
+DATA_THEORY("TheoriesCanAcceptComplexObjects", (const std::string &, const std::vector<std::tuple<int, std::string>> &), ComplexProvider)
 {
     // just existing is good enough
 }
 
-DATA_THEORY(TheoriesCanAcceptLambdas, (int, int),
+DATA_THEORY("TheoriesCanAcceptLambdas", (int, int),
     ([]() -> std::vector<std::tuple<int, int>>
     {
         std::vector<std::tuple<int, int>> data;
     // just existing is good enough
 }
 
-THEORY(TestingSuccessfulInlineTheory, (int x, const std::string &str),
+THEORY("TestingSuccessfulInlineTheory", (int x, const std::string &str),
     std::make_tuple(0, ""),
     std::make_tuple(0, ""),
     std::make_tuple(0, ""),
     Assert.Empty(str);
 }
 
-THEORY(TestingFailingInlineTheory, (int, const std::string &str),
+THEORY("TestingFailingInlineTheory", (int, const std::string &str),
     std::make_tuple(1, "a"),
     std::make_tuple(1, "b"),
     std::make_tuple(1, "c"),
     Assert.Throws<xUnitpp::xUnitAssert>([&]() { Assert.Empty(str); });
 }
 
+// !!!g++ figure out why g++ barfs on this one
 #if defined(WIN32)
-DATA_THEORY(TestingLambdasAsData, (std::function<void()> fn),
+DATA_THEORY("TestingLambdasAsData", (std::function<void()> fn),
 ([]() -> std::vector<std::tuple<std::function<void()>>>
 {
     std::vector<std::tuple<std::function<void()>>> data;

File xUnit++/xUnit++/xUnitMacros.h

 
 #define FACT(FactDetails) TIMED_FACT_FIXTURE(FactDetails, xUnitpp::NoFixture, -1)
 
-#define TIMED_DATA_THEORY(TheoryName, params, DataProvider, timeout) \
-    namespace TheoryName ## _ns { \
+#define TIMED_DATA_THEORY(TheoryDetails, params, DataProvider, timeout) \
+    namespace XU_UNIQUE_NS { \
         using xUnitpp::Assert; \
         std::shared_ptr<xUnitpp::Check> pCheck = std::make_shared<xUnitpp::Check>(); \
         xUnitpp::Check &Check = *pCheck; \
-        void TheoryName params; \
+        void XU_UNIQUE_TEST params; \
         xUnitpp::TestCollection::Register reg(xUnitpp::TestCollection::Instance(), \
-            TheoryName, DataProvider, #TheoryName, xUnitSuite::Name(), \
+            XU_UNIQUE_TEST, DataProvider, TheoryDetails, xUnitSuite::Name(), \
             xUnitAttributes::Attributes(), timeout, __FILE__, __LINE__, pCheck); \
     } \
-    void TheoryName ## _ns::TheoryName params
+    void XU_UNIQUE_NS :: XU_UNIQUE_TEST params
 
-#define UNTIMED_DATA_THEORY(TheoryName, params, DataProvider, timeout) TIMED_DATA_THEORY(TheoryName, params, DataProvider, 0)
+#define UNTIMED_DATA_THEORY(TheoryDetails, params, DataProvider, timeout) TIMED_DATA_THEORY(TheoryDetails, params, DataProvider, 0)
 
-#define DATA_THEORY(TheoryName, params, DataProvider) TIMED_DATA_THEORY(TheoryName, params, DataProvider, -1)
+#define DATA_THEORY(TheoryDetails, params, DataProvider) TIMED_DATA_THEORY(TheoryDetails, params, DataProvider, -1)
 
-#define TIMED_THEORY(TheoryName, params, timeout, ...) \
-    namespace TheoryName ## _ns { \
+#define TIMED_THEORY(TheoryDetails, params, timeout, ...) \
+    namespace XU_UNIQUE_NS { \
         using xUnitpp::Assert; \
         std::shared_ptr<xUnitpp::Check> pCheck = std::make_shared<xUnitpp::Check>(); \
         xUnitpp::Check &Check = *pCheck; \
-        void TheoryName params; \
+        void XU_UNIQUE_TEST params; \
         decltype(FIRST_ARG(__VA_ARGS__)) args[] = { __VA_ARGS__ }; \
         xUnitpp::TestCollection::Register reg(xUnitpp::TestCollection::Instance(), \
-            TheoryName, xUnitpp::TheoryData(PP_NARGS(__VA_ARGS__), args), #TheoryName, \
+            XU_UNIQUE_TEST, xUnitpp::TheoryData(PP_NARGS(__VA_ARGS__), args), TheoryDetails, \
             xUnitSuite::Name(), xUnitAttributes::Attributes(), timeout, __FILE__, __LINE__, pCheck); \
     } \
-    void TheoryName ## _ns::TheoryName params
+    void XU_UNIQUE_NS :: XU_UNIQUE_TEST params
 
-#define UNTIMED_THEORY(TheoryName, params, ...) TIMED_THEORY(TheoryName, params, 0, __VA_ARGS__)
+#define UNTIMED_THEORY(TheoryDetails, params, ...) TIMED_THEORY(TheoryDetails, params, 0, __VA_ARGS__)
 
-#define THEORY(TheoryName, params, ...) TIMED_THEORY(TheoryName, params, -1, __VA_ARGS__)
+#define THEORY(TheoryDetails, params, ...) TIMED_THEORY(TheoryDetails, params, -1, __VA_ARGS__)
 
 #define LI xUnitpp::LineInfo(__FILE__, __LINE__)