Add line test, properly free memory in tests
This commit is contained in:
parent
238ce2c2d2
commit
8d942e846f
@ -121,6 +121,8 @@ void test_stack() {
|
|||||||
printf("Stack size: %lu\n", stack->size);
|
printf("Stack size: %lu\n", stack->size);
|
||||||
|
|
||||||
stack_destroy(stack);
|
stack_destroy(stack);
|
||||||
|
free(stack);
|
||||||
|
stack = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_bintree() {
|
void test_bintree() {
|
||||||
@ -144,7 +146,13 @@ void test_bintree() {
|
|||||||
|
|
||||||
bintree_debug_print(tree);
|
bintree_debug_print(tree);
|
||||||
|
|
||||||
|
printf("Changing r2\n");
|
||||||
|
r2 = 100;
|
||||||
|
bintree_debug_print(tree);
|
||||||
|
|
||||||
bintree_destroy(tree);
|
bintree_destroy(tree);
|
||||||
|
free(tree);
|
||||||
|
tree = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_math() {
|
void test_math() {
|
||||||
@ -156,6 +164,15 @@ void test_math() {
|
|||||||
char *s = "1010110";
|
char *s = "1010110";
|
||||||
printf("Binary: %s\n", s);
|
printf("Binary: %s\n", s);
|
||||||
printf("Decimal: %d\n", binstr_to_int(s));
|
printf("Decimal: %d\n", binstr_to_int(s));
|
||||||
|
|
||||||
|
printf("\nGenerate line from 0,0 to 2,5\n");
|
||||||
|
size_t sz = 0;
|
||||||
|
Point *line = bresenham(0, 0, 2, 5, &sz);
|
||||||
|
for (size_t idx = 0; idx < sz; idx++) {
|
||||||
|
printf("%d,%d ", line[idx].x, line[idx].y);
|
||||||
|
}
|
||||||
|
printf("\n");
|
||||||
|
free(line);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user