implemented simple evaluator for program,
statements and integer literals, together with tests
This commit is contained in:
20
test/evaluator/integer.cpp
Normal file
20
test/evaluator/integer.cpp
Normal file
@@ -0,0 +1,20 @@
|
||||
#include "doctest.h"
|
||||
#include "utils.hpp"
|
||||
|
||||
TEST_SUITE("Eval: integers") {
|
||||
TEST_CASE_FIXTURE(
|
||||
test::utils::EvalFixture,
|
||||
"Simple integer expression statements"
|
||||
) {
|
||||
struct test_struct {
|
||||
std::string input;
|
||||
int expected;
|
||||
};
|
||||
struct test_struct tests[]{{"5", 5}, {"10", 10}};
|
||||
|
||||
for (auto& t : tests) {
|
||||
setup(t.input);
|
||||
test::utils::test_integer_object(result.get(), t.expected);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user