Commits

Matt Oswald  committed 2a88bb1

Assert.False tests added

  • Participants
  • Parent commits 7a4f633

Comments (0)

Files changed (4)

File xUnit++/Tests/Assert.Fail.cpp

+#include "../xUnit++.h"
+
+using xUnitpp::xUnitAssert;
+using xUnitpp::Assert;
+
+SUITE(AssertFail)
+{
+
+FACT(FailAlwaysAsserts)
+{
+    Assert.Throws<xUnitAssert>([]() { Assert.Fail(); });
+}
+
+FACT(FailAppendsMessage)
+{
+    static const std::string msg = "xUnit++";
+
+    auto assert = Assert.Throws<xUnitAssert>([]() { Assert.Fail(msg); });
+
+    Assert.Contains(assert.what(), msg.c_str());
+}
+
+}

File xUnit++/Tests/Assert.False.cpp

+#include "../xUnit++.h"
+
+using xUnitpp::xUnitAssert;
+using xUnitpp::Assert;
+
+SUITE(AssertFalse)
+{
+
+FACT(FalseSuccess)
+{
+    Assert.False(false);
+}
+
+FACT(FailsAssertsOnTrue)
+{
+    Assert.Throws<xUnitAssert>([]() { Assert.False(true); });
+}
+
+FACT(FalseAppendsCustomMessage)
+{
+    static const std::string msg = "xUnit++";
+
+    auto assert = Assert.Throws<xUnitAssert>([]() { Assert.False(true, msg); });
+
+    Assert.Contains(assert.what(), msg.c_str());
+}
+
+}

File xUnit++/xUnit++.vcxproj

     <ClCompile Include="TestDetails.cpp" />
     <ClCompile Include="Tests\Assert.DoesNotThrow.cpp" />
     <ClCompile Include="Tests\Assert.Equal.cpp" />
+    <ClCompile Include="Tests\Assert.Fail.cpp" />
+    <ClCompile Include="Tests\Assert.False.cpp" />
     <ClCompile Include="Tests\Assert.NotEqual.cpp" />
     <ClCompile Include="Tests\Assert.Throws.cpp" />
     <ClCompile Include="Theory.cpp" />

File xUnit++/xUnit++.vcxproj.filters

     <ClCompile Include="Tests\Assert.Throws.cpp">
       <Filter>Tests</Filter>
     </ClCompile>
+    <ClCompile Include="Tests\Assert.Fail.cpp">
+      <Filter>Tests</Filter>
+    </ClCompile>
+    <ClCompile Include="Tests\Assert.False.cpp">
+      <Filter>Tests</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="Fact.h" />