Add more tests

This commit is contained in:
Alex Kotov 2021-12-05 00:11:44 +05:00
parent 6fc3a8a42a
commit f094e5f5e2
Signed by: kotovalexarian
GPG Key ID: 553C0EBBEB5D5F08
2 changed files with 58 additions and 0 deletions

View File

@ -3,9 +3,15 @@
#include "../src/geom.h"
static void test_create();
static void test_init();
static void test_create_from_args();
static void test_init_from_args();
void test() {
test_create();
test_init();
test_create_from_args();
test_init_from_args();
}
void test_create()
@ -14,3 +20,26 @@ void test_create()
assert(position.x == 0);
assert(position.y == 0);
}
void test_init()
{
struct Position position = { .x = 123, .y = 456 };
position_init(&position);
assert(position.x == 0);
assert(position.y == 0);
}
void test_create_from_args()
{
const struct Position position = position_create_from_args(123, 456);
assert(position.x == 123);
assert(position.y == 456);
}
void test_init_from_args()
{
struct Position position = { .x = 0, .y = 0 };
position_init_from_args(&position, 123, 456);
assert(position.x == 123);
assert(position.y == 456);
}

View File

@ -3,9 +3,15 @@
#include "../src/geom.h"
static void test_create();
static void test_init();
static void test_create_from_args();
static void test_init_from_args();
void test() {
test_create();
test_init();
test_create_from_args();
test_init_from_args();
}
void test_create()
@ -14,3 +20,26 @@ void test_create()
assert(sizes.w == 0);
assert(sizes.h == 0);
}
void test_init()
{
struct Sizes sizes = { .w = 123, .h = 456 };
sizes_init(&sizes);
assert(sizes.w == 0);
assert(sizes.h == 0);
}
void test_create_from_args()
{
const struct Sizes sizes = sizes_create_from_args(123, 456);
assert(sizes.w == 123);
assert(sizes.h == 456);
}
void test_init_from_args()
{
struct Sizes sizes = { .w = 0, .h = 0 };
sizes_init_from_args(&sizes, 123, 456);
assert(sizes.w == 123);
assert(sizes.h == 456);
}