webkit  2cdf99a9e3038c7e01b3c37e8ad903ecbe5eecf1
https://github.com/WebKit/webkit
Classes | Namespaces | Macros | Typedefs | Functions
jsontest.h File Reference
#include <json/config.h>
#include <json/value.h>
#include <json/writer.h>
#include <stdio.h>
#include <deque>
#include <sstream>
#include <string>

Go to the source code of this file.

Classes

class  JsonTest::Failure
 
struct  JsonTest::PredicateContext
 
class  JsonTest::TestResult
 
class  JsonTest::TestCase
 
class  JsonTest::Runner
 

Namespaces

 JsonTest
 Unit testing framework.
 

Macros

#define JSONTEST_ASSERT(expr)
 Asserts that the given expression is true. JSONTEST_ASSERT( x == y ) << "x=" << x << ", y=" << y; JSONTEST_ASSERT( x == y );. More...
 
#define JSONTEST_ASSERT_PRED(expr)
 Asserts that the given predicate is true. The predicate may do other assertions and be a member function of the fixture. More...
 
#define JSONTEST_ASSERT_EQUAL(expected, actual)
 Asserts that two values are equals. More...
 
#define JSONTEST_ASSERT_STRING_EQUAL(expected, actual)
 Asserts that two values are equals. More...
 
#define JSONTEST_FIXTURE(FixtureType, name)
 Begin a fixture test case. More...
 
#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 *(* JsonTest::TestCaseFactory) ()
 Function pointer type for TestCase factory. More...
 

Functions

template<typename T , typename U >
TestResult & JsonTest::checkEqual (TestResult &result, const T &expected, const U &actual, const char *file, unsigned int line, const char *expr)
 
TestResult & JsonTest::checkStringEqual (TestResult &result, const std::string &expected, const std::string &actual, const char *file, unsigned int line, const char *expr)
 

Macro Definition Documentation

◆ JSONTEST_ASSERT

#define JSONTEST_ASSERT (   expr)
Value:
if ( expr ) \
{ \
} \
else \
result_->addFailure( __FILE__, __LINE__, #expr )

Asserts that the given expression is true. JSONTEST_ASSERT( x == y ) << "x=" << x << ", y=" << y; JSONTEST_ASSERT( x == y );.

◆ JSONTEST_ASSERT_EQUAL

#define JSONTEST_ASSERT_EQUAL (   expected,
  actual 
)
Value:
JsonTest::checkEqual( *result_, expected, actual, \
__FILE__, __LINE__, \
#expected " == " #actual )
string expected
Definition: buildtests.py:33
TestResult & checkEqual(TestResult &result, const T &expected, const U &actual, const char *file, unsigned int line, const char *expr)
Definition: jsontest.h:190

Asserts that two values are equals.

◆ JSONTEST_ASSERT_PRED

#define JSONTEST_ASSERT_PRED (   expr)
Value:
{ \
JsonTest::PredicateContext _minitest_Context = { \
result_->predicateId_, __FILE__, __LINE__, #expr }; \
result_->predicateStackTail_->next_ = &_minitest_Context; \
result_->predicateId_ += 1; \
result_->predicateStackTail_ = &_minitest_Context; \
(expr); \
result_->popPredicateContext(); \
} \
*result_

Asserts that the given predicate is true. The predicate may do other assertions and be a member function of the fixture.

◆ JSONTEST_ASSERT_STRING_EQUAL

#define JSONTEST_ASSERT_STRING_EQUAL (   expected,
  actual 
)
Value:
__FILE__, __LINE__, \
#expected " == " #actual )
TestResult & checkStringEqual(TestResult &result, const std::string &expected, const std::string &actual, const char *file, unsigned int line, const char *expr)
Definition: jsontest.cpp:561
string expected
Definition: buildtests.py:33
GLsizei const GLchar *const * string
Definition: gl2.h:479

Asserts that two values are equals.

◆ JSONTEST_FIXTURE

#define JSONTEST_FIXTURE (   FixtureType,
  name 
)
Value:
class Test##FixtureType##name : public FixtureType \
{ \
public: \
{ \
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()
const char * name
Definition: bn_test.cc:621
rtc::scoped_refptr< PeerConnectionFactoryInterface > factory(webrtc::CreatePeerConnectionFactory(network_thread.get(), worker_thread.get(), signaling_thread.get(), nullptr, encoder_factory, decoder_factory))
Definition: peerconnection_jni.cc:1838
EGLImageKHR EGLint * name
Definition: eglext.h:851
Definition: bn_test.cc:620
const
Definition: upload.py:398
Definition: jsontest.h:125
testName
Definition: plotTimingTest.m:13

Begin a fixture test case.

◆ JSONTEST_FIXTURE_FACTORY

#define JSONTEST_FIXTURE_FACTORY (   FixtureType,
  name 
)    &Test##FixtureType##name::factory

◆ JSONTEST_REGISTER_FIXTURE

#define JSONTEST_REGISTER_FIXTURE (   runner,
  FixtureType,
  name 
)    (runner).add( JSONTEST_FIXTURE_FACTORY( FixtureType, name ) )