Commits

Matt Oswald  committed 717326f

added [Not]InRange assert
left notes to myself on what is left to implement for 1.0

  • Participants
  • Parent commits d72ffe1

Comments (0)

Files changed (1)

File xUnit++/main.cpp

         throw xUnitAssert(std::string("Did not catch any exceptions."));
     }
 
-    void Fail()
+    void Fail(const std::string &msg)
     {
-        throw xUnitAssert("Fail.");
+        throw xUnitAssert(msg);
     }
 
     void False(bool b)
             throw xUnitAssert("Container does not contain item.");
         }
     }
+
+    template<typename TActual, typename TRange>
+    void InRange(TActual actual, TRange min, TRange max)
+    {
+        if (actual < min || actual >= max)
+        {
+            throw xUnitAssert("Value does not exist in range.");
+        }
+    }
+
+    template<typename TActual, typename TRange>
+    void NotInRange(TActual actual, TRange min, TRange max)
+    {
+        if (actual >= min && actual < max)
+        {
+            throw xUnitAssert("Value does not exist in range.");
+        }
+    }
 } Assert;
 
 FACT(SuccessfulFact)
 {
     return xUnitpp::RunAllTests(std::chrono::milliseconds(50));
 }
+
+
+
+/*
+things left to implement:
+ASSERT macros (I hate macros :( ) (see unittestpp check macros, as well as xunit.net)
+traits (arbitrary category data)
+SKIP = reason
+Assert extensibility (see http://xunit.codeplex.com/wikipage?title=WhyDidWeBuildXunit&referringTitle=Home#Extensibility)
+*/