2012-12-18 19:55:45 +00:00
|
|
|
/*
|
|
|
|
* TestASTInspector.cpp
|
|
|
|
*
|
|
|
|
* Created on: Dec 18, 2012
|
|
|
|
* Author: att
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "TestASTInspector.h"
|
|
|
|
|
|
|
|
TestASTInspector::TestASTInspector() {
|
|
|
|
// TODO Auto-generated constructor stub
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
TestASTInspector::~TestASTInspector() {
|
|
|
|
// TODO Auto-generated destructor stub
|
|
|
|
}
|
|
|
|
|
2012-12-18 20:22:33 +00:00
|
|
|
std::string TestASTInspector::test_inspecting_basic_expression()
|
|
|
|
{
|
2012-12-18 20:51:57 +00:00
|
|
|
|
|
|
|
std::string test_report = "";
|
|
|
|
|
|
|
|
|
2012-12-18 20:22:33 +00:00
|
|
|
BasicExpression * be = build_basic_expression("+", SenchaObject(9), SenchaObject(122));
|
2012-12-18 20:51:57 +00:00
|
|
|
be->accept(&inspector);
|
|
|
|
std::string assert_report = "Report: " + inspector.inspection_report;
|
2012-12-18 21:41:39 +00:00
|
|
|
muu_assert("dd", inspector.inspection_report == "");
|
|
|
|
std::cout << assert_report << " reports..." << std::endl;
|
2012-12-18 20:51:57 +00:00
|
|
|
|
|
|
|
return test_report;
|
2012-12-18 20:22:33 +00:00
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2012-12-18 21:41:39 +00:00
|
|
|
std::string TestASTInspector::all_tests()
|
2012-12-18 20:22:33 +00:00
|
|
|
{
|
2012-12-18 20:51:57 +00:00
|
|
|
std::string test_report = "";
|
|
|
|
|
|
|
|
mu_run_test(test_inspecting_basic_expression);
|
2012-12-18 20:22:33 +00:00
|
|
|
|
2012-12-18 20:51:57 +00:00
|
|
|
return test_report;
|
2012-12-18 20:22:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
BasicExpression * TestASTInspector::build_basic_expression(std::string oper, SenchaObject arg1, SenchaObject arg2)
|
|
|
|
{
|
|
|
|
BasicExpression * be = new BasicExpression(NULL);
|
|
|
|
be->set_operator(oper);
|
|
|
|
be->set_left_operand(new ConstantExpression(be, arg1));
|
|
|
|
be->set_right_operand(new ConstantExpression(be, arg2));
|
|
|
|
return be;
|
|
|
|
}
|