Exemplo n.º 1
0
void CIfAst::Execute(CInterpreterContext &context) const
{
    CValue result = m_condition->Evaluate(context);
    if (bool(result))
    {
        ExecuteAll(m_thenBody, context);
    }
    else
    {
        ExecuteAll(m_elseBody, context);
    }
}
Exemplo n.º 2
0
void CWhileAst::Execute(CInterpreterContext &context) const
{
    while (bool(m_condition->Evaluate(context)))
    {
        ExecuteAll(m_body, context);
    }
}
Exemplo n.º 3
0
void CRepeatAst::Execute(CInterpreterContext &context) const
{
    do
    {
        ExecuteAll(m_body, context);
    }
    while (bool(m_condition->Evaluate(context)));
}
Exemplo n.º 4
0
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");
}
Exemplo n.º 5
0
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;
}