42 std::unique_ptr<SEXPR::SEXPR>
Parse(
const std::string& aIn )
44 return std::unique_ptr<SEXPR::SEXPR>(
m_parser.
Parse( aIn ) );
72 const std::vector<TEST_SEXPR_CASE> cases = {
83 for(
const auto& c : cases )
85 BOOST_TEST_CONTEXT( c.m_case_name )
87 const auto data = Parse( c.m_sexpr_data );
88 BOOST_CHECK_EQUAL( data.get(),
nullptr );
98 const std::string content{
"this is just writing" };
99 const auto sexp = Parse( content );
101 BOOST_REQUIRE_NE( sexp.get(),
nullptr );
110 const std::vector<TEST_SEXPR_CASE> cases = {
137 for(
const auto& c : cases )
139 BOOST_TEST_CONTEXT( c.m_case_name )
151 const std::string content{
"()" };
152 const auto sexp = Parse( content );
154 BOOST_REQUIRE_NE( sexp.get(),
nullptr );
163 const std::string content{
"(symbol)" };
164 const auto sexp = Parse( content );
166 BOOST_REQUIRE_NE( sexp.get(),
nullptr );
178 const std::string content{
"(symbol \"string\" 42 3.14 (nested 4 ()))" };
179 const auto sexp = Parse( content );
181 BOOST_REQUIRE_NE( sexp.get(),
nullptr );
192 BOOST_CHECK_PREDICATE(
212 const std::vector<TEST_SEXPR_ROUNDTRIPPING> cases = {
219 "(42 3.14 \"string\")",
227 for(
const auto& c : cases )
229 BOOST_TEST_CONTEXT( c.m_case_name )
231 const auto sexp = Parse( c.m_input );
233 const std::string as_str = sexp->AsString();
std::unique_ptr< SEXPR > Parse(const std::string &aString)
SEXPR * GetChild(size_t aIndex) const
std::unique_ptr< SEXPR::SEXPR > Parse(const std::string &aIn)
Wrap the parser function with a unique_ptr.
bool SexprIsSymbolWithValue(const SEXPR::SEXPR &aSexpr, const std::string &aVal)
Test predicate: is the s-expression a symbol with the given value?
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?
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 SexprConvertsToString(const SEXPR::SEXPR &aSexpr, const std::string &aExpStr)
Predicate to check an SEXPR object converts to the expected string.
Collection of test cases for use when multiple cases can be handled in the same test case.
Test for roundtripping (valid) s-expression back to strings.
BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_CASE(Empty)
Declare the test suite.