Improve tests

This commit is contained in:
Alex Kotov 2021-12-04 23:54:02 +05:00
parent 2a44f23de2
commit 1b22e91f25
Signed by: kotovalexarian
GPG key ID: 553C0EBBEB5D5F08
3 changed files with 35 additions and 14 deletions

View file

@ -1,3 +1,16 @@
int test() { #include <assert.h>
return 0;
#include "../src/geom.h"
static void test_create();
void test() {
test_create();
}
void test_create()
{
const struct Position position = position_create();
assert(position.x == 0);
assert(position.y == 0);
} }

View file

@ -1,3 +1,16 @@
int test() { #include <assert.h>
return 0;
#include "../src/geom.h"
static void test_create();
void test() {
test_create();
}
void test_create()
{
const struct Sizes sizes = sizes_create();
assert(sizes.w == 0);
assert(sizes.h == 0);
} }

View file

@ -1,19 +1,14 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
int test(); void test();
void restart() {} void restart() {}
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
test();
const char *const test_name = argv[0]; const char *const test_name = argv[0];
const int test_result = test();
if (test_result == 0) {
printf("[ OK ] %s\n", test_name); printf("[ OK ] %s\n", test_name);
} else { exit(EXIT_SUCCESS);
printf("[FAIL] %s\n", test_name);
}
return test_result;
} }