38 std::unique_ptr<SEXPR::SEXPR>
Parse(
const std::string& aIn )
40 return std::unique_ptr<SEXPR::SEXPR>(
m_parser.Parse( aIn ) );
68 const std::vector<TEST_SEXPR_CASE> cases = {
79 for(
const auto& c : cases )
83 const auto data = Parse( c.m_sexpr_data );
94 const std::string content{
"this is just writing" };
95 const auto sexp = Parse( content );
97 BOOST_REQUIRE_NE( sexp.get(),
nullptr );
106 const std::vector<TEST_SEXPR_CASE> cases = {
133 for(
const auto& c : cases )
147 const std::string content{
"()" };
148 const auto sexp = Parse( content );
150 BOOST_REQUIRE_NE( sexp.get(),
nullptr );
159 const std::string content{
"(symbol)" };
160 const auto sexp = Parse( content );
162 BOOST_REQUIRE_NE( sexp.get(),
nullptr );
174 const std::string content{
"(symbol \"string\" 42 3.14 (nested 4 ()))" };
175 const auto sexp = Parse( content );
177 BOOST_REQUIRE_NE( sexp.get(),
nullptr );
208 const std::vector<TEST_SEXPR_ROUNDTRIPPING> cases = {
215 "(42 3.14 \"string\")",
223 for(
const auto& c : cases )
227 const auto sexp = Parse( c.m_input );
229 const std::string as_str = sexp->AsString();
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_CASE(HorizontalAlignment)
BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_CASE(Empty)
Declare the test suite.
BOOST_CHECK_PREDICATE(ArePolylineEndPointsNearCircle,(chain)(c.m_geom.m_center_point)(radius)(accuracy+epsilon))
BOOST_TEST_CONTEXT("Test Clearance")
BOOST_CHECK_EQUAL(result, "25.4")