polytreewm/tests/geom_position.c

46 lines
894 B
C
Raw Normal View History

2021-12-04 13:54:02 -05:00
#include <assert.h>
#include "../src/geom.h"
static void test_create();
2021-12-04 14:11:44 -05:00
static void test_init();
static void test_create_from_args();
static void test_init_from_args();
2021-12-04 13:54:02 -05:00
void test() {
test_create();
2021-12-04 14:11:44 -05:00
test_init();
test_create_from_args();
test_init_from_args();
2021-12-04 13:54:02 -05:00
}
void test_create()
{
const struct Position position = position_create();
assert(position.x == 0);
assert(position.y == 0);
2021-12-04 13:42:03 -05:00
}
2021-12-04 14:11:44 -05:00
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);
}