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() {
return 0;
#include <assert.h>
#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() {
return 0;
#include <assert.h>
#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 <stdlib.h>
int test();
void test();
void restart() {}
int main(int argc, char **argv)
{
test();
const char *const test_name = argv[0];
const int test_result = test();
if (test_result == 0) {
printf("[ OK ] %s\n", test_name);
} else {
printf("[FAIL] %s\n", test_name);
}
return test_result;
printf("[ OK ] %s\n", test_name);
exit(EXIT_SUCCESS);
}