Namespaces | |
namespace | JsonTest |
Classes | |
class | Failure |
struct | PredicateContext |
Context used to create the assertion callstack on failure. Must be a POD to allow inline initialisation without stepping into the debugger. More... | |
class | TestResult |
class | TestCase |
class | Runner |
Defines | |
#define | JSONTEST_ASSERT(expr) |
#define | JSONTEST_ASSERT_PRED(expr) |
#define | JSONTEST_ASSERT_EQUAL(expected, actual) |
#define | JSONTEST_ASSERT_STRING_EQUAL(expected, actual) |
#define | JSONTEST_ASSERT_THROWS(expr) |
#define | JSONTEST_FIXTURE(FixtureType, name) |
#define | JSONTEST_FIXTURE_FACTORY(FixtureType, name) &Test##FixtureType##name::factory |
#define | JSONTEST_REGISTER_FIXTURE(runner, FixtureType, name) (runner).add(JSONTEST_FIXTURE_FACTORY(FixtureType, name)) |
Typedefs | |
typedef TestCase *(* | TestCaseFactory )() |
Function pointer type for TestCase factory. | |
Functions | |
template<typename T, typename U> | |
TestResult & | checkEqual (TestResult &result, T expected, U actual, const char *file, unsigned int line, const char *expr) |
TestResult & | checkStringEqual (TestResult &result, const std::string &expected, const std::string &actual, const char *file, unsigned int line, const char *expr) |
#define JSONTEST_ASSERT | ( | expr | ) |
Value:
if (expr) { \ } else \ result_->addFailure(__FILE__, __LINE__, #expr)
#define JSONTEST_ASSERT_EQUAL | ( | expected, | |||
actual | ) |
Value:
JsonTest::checkEqual(*result_, \ expected, \ actual, \ __FILE__, \ __LINE__, \ #expected " == " #actual)
#define JSONTEST_ASSERT_PRED | ( | expr | ) |
Value:
{ \ JsonTest::PredicateContext _minitest_Context = { \ result_->predicateId_, __FILE__, __LINE__, #expr, NULL, NULL \ }; \ result_->predicateStackTail_->next_ = &_minitest_Context; \ result_->predicateId_ += 1; \ result_->predicateStackTail_ = &_minitest_Context; \ (expr); \ result_->popPredicateContext(); \ }
#define JSONTEST_ASSERT_STRING_EQUAL | ( | expected, | |||
actual | ) |
Value:
JsonTest::checkStringEqual(*result_, \ std::string(expected), \ std::string(actual), \ __FILE__, \ __LINE__, \ #expected " == " #actual)
#define JSONTEST_ASSERT_THROWS | ( | expr | ) |
Value:
{ \ bool _threw = false; \ try { \ expr; \ } \ catch (...) { \ _threw = true; \ } \ if (!_threw) \ result_->addFailure( \ __FILE__, __LINE__, "expected exception thrown: " #expr); \ }
#define JSONTEST_FIXTURE | ( | FixtureType, | |||
name | ) |
Value:
class Test##FixtureType##name : public FixtureType { \ public: \ static JsonTest::TestCase* factory() { \ return new Test##FixtureType##name(); \ } \ \ public: /* overidden from TestCase */ \ virtual const char* testName() const { return #FixtureType "/" #name; } \ virtual void runTestCase(); \ }; \ \ void Test##FixtureType##name::runTestCase()
#define JSONTEST_FIXTURE_FACTORY | ( | FixtureType, | |||
name | ) | &Test##FixtureType##name::factory |
#define JSONTEST_REGISTER_FIXTURE | ( | runner, | |||
FixtureType, | |||||
name | ) | (runner).add(JSONTEST_FIXTURE_FACTORY(FixtureType, name)) |