void CIfAst::Execute(CInterpreterContext &context) const { CValue result = m_condition->Evaluate(context); if (bool(result)) { ExecuteAll(m_thenBody, context); } else { ExecuteAll(m_elseBody, context); } }
void CWhileAst::Execute(CInterpreterContext &context) const { while (bool(m_condition->Evaluate(context))) { ExecuteAll(m_body, context); } }
void CRepeatAst::Execute(CInterpreterContext &context) const { do { ExecuteAll(m_body, context); } while (bool(m_condition->Evaluate(context))); }
int main() { // Executing all tests will run all test cases and check leftover // stack size afterwards. It is expected that the stack size // post-test is 0. return ExecuteAll(); // For debugging anything in particular, you can run an individual //test like so: //ExecuteTest("test_function_in_constructor"); }
int main() { // Executing all tests will run all test cases and check leftover // stack size afterwards. It is expected that the stack size // post-test is 0. bool e = ExecuteAll(); // For debugging anything in particular, you can run an individual //test like so: //ExecuteTest("test_function_should_run_once"); getchar(); return e; }