polytreewm/tests/geom_sizes.c

46 lines
828 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 Sizes sizes = sizes_create();
assert(sizes.w == 0);
assert(sizes.h == 0);
2021-12-04 13:42:03 -05:00
}
2021-12-04 14:11:44 -05:00
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);
}