Skip to content
Per Andersson edited this page Jan 6, 2014 · 7 revisions

Welcome to the playtest wiki!

Example unit test

#include <playtest/playtest.h>

TEST_SUITE(SuiteName)
{
   UNIT_TEST(UnitTestInsideSuite)
   {
      int value1 = 10;
      int value2 = 10;
      ASSERT_EQUALS(value1, value2);
   }
}

TEST_SUITE(SomeOtherSuite)
{
   class MockClass : public ISomeInterface
   {
   public:
       virtual bool Evaluate(const char* str);
   };
   // Always return true for the sake of this specific test
   bool MockClass::Evaluate(const char* str)
   {
      return true;
   }

   UNIT_TEST(TestSomeSpecificFunction)
   {
      SomeOtherClass unitToTest(new MockClass());
      ASSERT_TRUE(unitToTest->DoSomethingThatInvokesEvaluate());
   }
}

Clone this wiki locally