24#ifndef TEST_SEXPR_TEST_UTILS__H
25#define TEST_SEXPR_TEST_UTILS__H
51 throw( std::invalid_argument(
"<Unknown S-Expression Type!>" ) );
73 return "<Unknown S-Expression Type!>";
83 if(
getType( aSexpr ) != aType )
85 BOOST_TEST_MESSAGE(
"Sexpr is not of type: " <<
getDebugType( aType ) );
97template <
typename VAL_T>
100 if( aGot != aExpected )
102 BOOST_TEST_MESSAGE(
"Sexpr value not equal: got " << aGot <<
", expected " << aExpected );
196 <<
", expected " << aExpectedLength );
211 const std::string converted = aSexpr.
AsString();
215 if( converted != aExpStr )
217 BOOST_TEST_INFO(
"Sexpr string conversion mismatch: got '" << converted <<
"', expected '"
std::string const & GetSymbol() const
std::string AsString(size_t aLevel=0) const
size_t GetNumberOfChildren() const
int64_t GetLongInteger() const
std::string const & GetString() const
bool SexprIsDouble(const SEXPR::SEXPR &aSexpr)
Test predicate: is the s-expression a double?
bool SexprIsList(const SEXPR::SEXPR &aSexpr)
Test predicate: is the s-expression a double?
bool SexprIsSymbolWithValue(const SEXPR::SEXPR &aSexpr, const std::string &aVal)
Test predicate: is the s-expression a symbol with the given value?
std::string getDebugType(SEXPR::SEXPR_TYPE aType)
Get a debug-friendly string for a given s-expr type.
bool IsSexprOfType(const SEXPR::SEXPR &aSexpr, SEXPR::SEXPR_TYPE aType)
bool SexprIsInteger(const SEXPR::SEXPR &aSexpr)
Test predicate: is the s-expression an integer?
bool SexprIsDoubleWithValue(const SEXPR::SEXPR &aSexpr, double aVal)
Test predicate: is the s-expression a double with the given value?
bool SexprIsListOfLength(const SEXPR::SEXPR &aSexpr, size_t aExpectedLength)
Test predicate: is the s-expression a list with the given length?
SEXPR::SEXPR_TYPE getType(const SEXPR::SEXPR &aSexpr)
Get the type of the s-expression.
std::string GetSexprDebugType(const SEXPR::SEXPR &aSexpr)
bool SexprIsIntegerWithValue(const SEXPR::SEXPR &aSexpr, std::int64_t aVal)
Test predicate: is the s-expression an integer with the given value?
bool SexprIsStringWithValue(const SEXPR::SEXPR &aSexpr, const std::string &aVal)
Test predicate: is the s-expression a string with the given value?
bool SexprIsSymbol(const SEXPR::SEXPR &aSexpr)
Test predicate: is the s-expression a symbol?
bool IsSexprValueEqual(const VAL_T &aGot, const VAL_T &aExpected)
Predicate to check two s-expr values (of the same type) are equal.
bool SexprConvertsToString(const SEXPR::SEXPR &aSexpr, const std::string &aExpStr)
Predicate to check an SEXPR object converts to the expected string.
bool SexprIsString(const SEXPR::SEXPR &aSexpr)
Test predicate: is the s-expression a string?
std::ostream & boost_test_print_type(std::ostream &os, const SEXPR &aSexpr)
Boost print helper for SEXPR objects.
@ SEXPR_TYPE_ATOM_INTEGER