$darkmode
gtest.hpp File Reference
#include <iostream>
#include <gtest/gtest.h>
#include <fable/fable_fwd.hpp>
#include <fable/conf.hpp>
#include <fable/confable.hpp>
#include <fable/schema.hpp>
#include <fable/error.hpp>
#include <fable/utility.hpp>
Include dependency graph for gtest.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void fable::assert_eq (const Json &j, const Json &k)
 
void fable::assert_eq (const Json &j, const char expect[])
 
void fable::assert_ne (const Json &j, const Json &k)
 
void fable::assert_ne (const Json &j, const char expect[])
 
void fable::assert_schema_eq (const Schema &s, const Json &expect)
 
void fable::assert_schema_eq (const Schema &s, const char expect[])
 
void fable::assert_schema_eq (const Confable &x, const Json &expect)
 
void fable::assert_schema_eq (const Confable &x, const char expect[])
 
void fable::assert_validate (const Schema &s, const Conf &input)
 
void fable::assert_validate (const Schema &s, const char json_input[])
 
void fable::assert_validate (const Confable &x, const Conf &input)
 
void fable::assert_validate (const Confable &x, const char json_input[])
 
void fable::assert_invalidate (const Schema &s, const Conf &input)
 
void fable::assert_invalidate (const Schema &s, const char json_input[])
 
void fable::assert_invalidate (const Confable &x, const Conf &input)
 
void fable::assert_invalidate (const Confable &x, const char json_input[])
 
template<typename T >
void fable::assert_to_json (const T &x, const Json &expect)
 
template<typename T >
void fable::assert_to_json (const T &x, const char json_expect[])
 
void fable::assert_from_conf_throw (Confable &x, const Conf &input)
 
void fable::assert_from_conf_throw (Confable &x, const char json_input[])
 
template<typename T >
void fable::assert_from_conf (T &x, const Conf &input)
 
template<typename T >
void fable::assert_from_conf (T &x, const char json_input[])
 
template<typename T >
void fable::assert_from_eq_to (T &x, const Json &identity)
 
template<typename T >
void fable::assert_from_eq_to (T &x, const char json_input[])
 

Function Documentation

◆ assert_eq() [1/2]

void fable::assert_eq ( const Json j,
const char  expect[] 
)
inline

Assert that both JSON values are identical.

The second parameter is parsed to JSON and then dumped.

This function dumps both JSON with indentation so that failing tests can nicely format the diff between strings.

Here is the call graph for this function:

◆ assert_eq() [2/2]

void fable::assert_eq ( const Json j,
const Json k 
)
inline

Assert that both JSON values are identical.

This function dumps both JSON with indentation so that failing tests can nicely format the diff between strings.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ assert_from_eq_to() [1/2]

template<typename T >
void fable::assert_from_eq_to ( T &  x,
const char  json_input[] 
)
inline

Assert that deserializing the input works and serializes to the same input.

This asserts that the type supports the identity function. This does not need to hold for any type, but you may want it to hold for your type.

Here is the call graph for this function:

◆ assert_from_eq_to() [2/2]

template<typename T >
void fable::assert_from_eq_to ( T &  x,
const Json identity 
)
inline

Assert that deserializing the input works and serializes to the same input.

This asserts that the type supports the identity function. This does not need to hold for any type, but you may want it to hold for your type.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ assert_ne() [1/2]

void fable::assert_ne ( const Json j,
const char  expect[] 
)
inline

Assert that both JSON values are NOT identical.

The second parameter is parsed to JSON and then dumped.

Here is the call graph for this function:

◆ assert_ne() [2/2]

void fable::assert_ne ( const Json j,
const Json k 
)
inline

Assert that both JSON values are NOT identical.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ assert_to_json() [1/2]

template<typename T >
void fable::assert_to_json ( const T &  x,
const char  json_expect[] 
)
inline

Assert that the serialization is equal to the expected JSON string.

The string is parsed to Json, so that field order is not important.

Here is the call graph for this function:

◆ assert_to_json() [2/2]

template<typename T >
void fable::assert_to_json ( const T &  x,
const Json expect 
)
inline

Assert that the serialization is equal to the expected JSON.

Here is the call graph for this function:
Here is the caller graph for this function: