Skip to content

Commit

Permalink
Simplify tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jcmdln committed Sep 23, 2023
1 parent 3e6ede0 commit 0cd60ee
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 28 deletions.
2 changes: 1 addition & 1 deletion test/core/car.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ main(void)
assert(nil != NULL);
assert(nil->type == TYPE_ERROR);

Object const *car = Car(Read("42 \"wew\""));
Object const *car = Car(Cons(Number(42), Cons(String("wew"), &NIL)));
assert(car != NULL);
assert(car->type == TYPE_NUMBER);

Expand Down
2 changes: 1 addition & 1 deletion test/core/cdr.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ main(void)
assert(nil != NULL);
assert(nil->type == TYPE_ERROR);

Object const *cdr = Cdr(Read("42 \"wew\""));
Object const *cdr = Cdr(Cons(Number(42), Cons(String("wew"), &NIL)));
assert(cdr != NULL);
assert(cdr->type == TYPE_LIST);

Expand Down
2 changes: 1 addition & 1 deletion test/core/read.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ main(void)
assert(nil != NULL);
assert(nil->type == TYPE_NIL);

Object const *list = Read("42 \"wew\"");
Object const *list = Cons(Number(42), Cons(String("wew"), &NIL));
assert(list != NULL);
assert(list->type == TYPE_LIST);

Expand Down
2 changes: 1 addition & 1 deletion test/core/reverse.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ main(void)
assert(nil != NULL);
assert(nil->type == TYPE_NIL);

Object const *list = Reverse(Read("42 \"wew\""));
Object const *list = Reverse(Cons(Number(42), Cons(String("wew"), &NIL)));
assert(list != NULL);
assert(list->type == TYPE_LIST);

Expand Down
7 changes: 1 addition & 6 deletions test/math/add.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,10 @@ main(void)
assert(underflow != NULL);
assert(underflow->type == TYPE_ERROR);

Object const *add = Add(Read("30 10 2"));
Object const *add = Add(Cons(Number(30), Cons(Number(10), Cons(Number(2), &NIL))));
assert(add != NULL);
assert(add->type == TYPE_NUMBER);
assert(add->number == 42);

Object const *add_alt = Add(Cons(Number(30), Cons(Number(10), Cons(Number(2), &NIL))));
assert(add_alt != NULL);
assert(add_alt->type == TYPE_NUMBER);
assert(add->number == add_alt->number);

return EXIT_SUCCESS;
}
7 changes: 1 addition & 6 deletions test/math/divide.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,10 @@ main(void)
assert(nil != NULL);
assert(nil->type == TYPE_ERROR);

Object const *divide = Divide(Read("42 7 3"));
Object const *divide = Divide(Cons(Number(42), Cons(Number(7), Cons(Number(3), &NIL))));
assert(divide != NULL);
assert(divide->type == TYPE_NUMBER);
assert(divide->number == 2);

Object const *divide_alt = Divide(Cons(Number(42), Cons(Number(7), Cons(Number(3), &NIL))));
assert(divide_alt != NULL);
assert(divide_alt->type == TYPE_NUMBER);
assert(divide->number == divide_alt->number);

return EXIT_SUCCESS;
}
7 changes: 1 addition & 6 deletions test/math/multiply.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,10 @@ main(void)
assert(nil != NULL);
assert(nil->type == TYPE_ERROR);

Object const *multiply = Multiply(Read("2 3 7"));
Object const *multiply = Multiply(Cons(Number(2), Cons(Number(3), Cons(Number(7), &NIL))));
assert(multiply != NULL);
assert(multiply->type == TYPE_NUMBER);
assert(multiply->number == 42);

Object const *multiply_alt = Multiply(Cons(Number(2), Cons(Number(3), Cons(Number(7), &NIL))));
assert(multiply_alt != NULL);
assert(multiply_alt->type == TYPE_NUMBER);
assert(multiply->number == multiply_alt->number);

return EXIT_SUCCESS;
}
7 changes: 1 addition & 6 deletions test/math/subtract.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,10 @@ main(void)
assert(underflow != NULL);
assert(underflow->type == TYPE_ERROR);

Object const *subtract = Subtract(Read("100 58"));
Object const *subtract = Subtract(Cons(Number(100), Cons(Number(58), &NIL)));
assert(subtract != NULL);
assert(subtract->type == TYPE_NUMBER);
assert(subtract->number == 42);

Object const *subtract_alt = Subtract(Cons(Number(100), Cons(Number(58), &NIL)));
assert(subtract_alt != NULL);
assert(subtract_alt->type == TYPE_NUMBER);
assert(subtract->number == subtract_alt->number);

return EXIT_SUCCESS;
}

0 comments on commit 0cd60ee

Please sign in to comment.