scl/test/token.c

20 lines
493 B
C
Raw Normal View History

#include "unity/unity.h"
2024-10-05 09:24:12 -04:00
#include <stdlib.h>
#include "../src/include/token.h"
2024-10-05 09:24:12 -04:00
#include "registry.h"
2024-10-05 09:24:12 -04:00
int test_token_init() {
UNITY_BEGIN();
char* s = malloc(sizeof("Hello, world!"));
s = "Hello, world!";
Token* t = token_init(TOKEN_TYPE_CALL, s);
2024-10-02 17:57:04 -04:00
TEST_ASSERT_EQUAL(TOKEN_TYPE_CALL, t->type);
TEST_ASSERT_EQUAL_STRING("Hello, world!", t->val);
2024-10-05 09:24:12 -04:00
return UNITY_END();
}
__attribute__((constructor)) void register_tests_token() {
2024-10-05 09:24:12 -04:00
register_test(test_token_init);
}