Test utilities.
More...
#include <openvdb_ax/ast/AST.h>
#include <openvdb_ax/ast/Parse.h>
#include <openvdb_ax/ast/Tokens.h>
#include <openvdb_ax/compiler/Logger.h>
#include <openvdb/Types.h>
#include <memory>
#include <vector>
#include <utility>
#include <string>
#include <type_traits>
Go to the source code of this file.
|
using | CodeTests = std::vector< std::pair< std::string, openvdb::ax::ast::Node::Ptr >> |
|
|
void | replace (std::string &str, const std::string &oldStr, const std::string &newStr) |
|
bool | compareLinearTrees (const std::vector< const openvdb::ax::ast::Node * > &a, const std::vector< const openvdb::ax::ast::Node * > &b, const bool allowEmpty=false) |
|
std::vector< std::string > | nameSequence (const std::string &base, const size_t number) |
|
Test utilities.
- Author
- Nick Avramoussis
#define ERROR_MSG |
( |
|
Msg, |
|
|
|
Code |
|
) |
| Msg + std::string(": \"") + Code + std::string("\"") |
#define TEST_SYNTAX_FAILS |
( |
|
Tests | ) |
|
Value:{ \
openvdb::ax::Logger logger([](const std::string&) {});\
for (const auto& test : Tests) { \
logger.clear();\
const std::string& code = test.first; \
CPPUNIT_ASSERT_MESSAGE(
ERROR_MSG(
"Expected parsing error", code), logger.hasError()); \
} \
} \
openvdb::ax::ast::Tree::Ptr parse(const char *code)
Construct an abstract syntax tree from a code snippet. A runtime exception will be thrown with the fi...
#define ERROR_MSG(Msg, Code)
Definition: util.h:26
#define TEST_SYNTAX_PASSES |
( |
|
Tests | ) |
|
Value:{ \
openvdb::ax::Logger logger;\
for (const auto& test : Tests) { \
logger.clear();\
const std::string& code = test.first; \
std::stringstream str; \
CPPUNIT_ASSERT_MESSAGE(
ERROR_MSG(
"Unexpected parsing error(s)\n", str.str()), tree); \
} \
} \
openvdb::ax::ast::Tree::Ptr parse(const char *code)
Construct an abstract syntax tree from a code snippet. A runtime exception will be thrown with the fi...
#define ERROR_MSG(Msg, Code)
Definition: util.h:26