Implement decimal integer reading
This commit is contained in:
30
tests/reader_tests.c
Normal file
30
tests/reader_tests.c
Normal file
@@ -0,0 +1,30 @@
|
||||
#include "reader.h"
|
||||
#include "testing.h"
|
||||
|
||||
static memory_pool_t pool;
|
||||
|
||||
static void input_1234_is_read_as_number_with_expected_value(void)
|
||||
{
|
||||
init_memory_pool(&pool);
|
||||
const expression_t *result = read_expression(&pool, "1234", 4);
|
||||
ASSERT_NOT_NULL(result);
|
||||
ASSERT_TRUE(result->is_number);
|
||||
ASSERT_EQUAL(1234, result->number);
|
||||
}
|
||||
|
||||
static void input_4321_is_read_as_number_with_expected_value(void)
|
||||
{
|
||||
init_memory_pool(&pool);
|
||||
const expression_t *result = read_expression(&pool, "4321", 4);
|
||||
ASSERT_NOT_NULL(result);
|
||||
ASSERT_TRUE(result->is_number);
|
||||
ASSERT_EQUAL(4321, result->number);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
TESTING_BEGIN();
|
||||
RUN_TEST(input_1234_is_read_as_number_with_expected_value);
|
||||
RUN_TEST(input_4321_is_read_as_number_with_expected_value);
|
||||
TESTING_END();
|
||||
}
|
||||
Reference in New Issue
Block a user