First version for string_to_number, just one test, is working fine, i'm considering swithching to handling only integers for in the future to manage in special struct that manages doubles as fractions, obviously this will mean changing nodes for general numbers to integers/fractions and shit

This commit is contained in:
2026-03-09 09:06:06 -06:00
parent 194f1dd80f
commit 771069455d
5 changed files with 95 additions and 2 deletions

View File

@@ -34,12 +34,15 @@ static void test_array_push(void **state) {
assert_int_equal(ASTNodeArray_push(&arr, node3), ARRAY_OK);
assert_int_equal(ASTNodeArray_len(&arr), 3);
ASTNodeArray_free(&arr);
}
static void test_array_pop(void **state) {
(void) state;
ASTNodeArray arr = ASTNodeArray_init(2);
// Set to force desize
ASTNodeArray arr = ASTNodeArray_init(16);
ASTNode node1 = {
.type = NODE_NUMBER,
.data = { .number = 90 }
@@ -68,8 +71,11 @@ static void test_array_pop(void **state) {
assert_int_equal(ASTNodeArray_pop(&arr, 1, &node4), ARRAY_OK);
assert_int_equal(node4.type, NODE_NUMBER);
assert_int_equal(node4.data.number, 80);
ASTNodeArray_free(&arr);
}
int main(void) {
const struct CMUnitTest tests[] = {
cmocka_unit_test(test_array_push),