mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-18 21:30:38 +01:00
Kandinsky: Add a test for KDRect intersections
Change-Id: I98c8ec0d6ed4117e93ec96a05905f5e1eab14d25
This commit is contained in:
@@ -10,6 +10,7 @@ objs += $(addprefix kandinsky/src/,\
|
||||
)
|
||||
tests += $(addprefix kandinsky/test/,\
|
||||
color.c\
|
||||
rect.c\
|
||||
set_pixel.c\
|
||||
)
|
||||
|
||||
|
||||
26
kandinsky/test/rect.c
Normal file
26
kandinsky/test/rect.c
Normal file
@@ -0,0 +1,26 @@
|
||||
#include <quiz.h>
|
||||
#include <kandinsky.h>
|
||||
#include <assert.h>
|
||||
|
||||
QUIZ_CASE(kandinsky_rect_intersect) {
|
||||
KDRect a = {
|
||||
.x = -5, .y = -5,
|
||||
.width = 10, .height = 10
|
||||
};
|
||||
KDRect b = {
|
||||
.x = 0, .y = 0,
|
||||
.width = 10, .height = 10
|
||||
};
|
||||
assert(KDRectIntersect(a,b));
|
||||
assert(KDRectIntersect(b,a));
|
||||
KDRect c = KDRectIntersection(a,b);
|
||||
assert(c.x == 0);
|
||||
assert(c.y == 0);
|
||||
assert(c.width == 5);
|
||||
assert(c.height == 5);
|
||||
c = KDRectIntersection(b,a);
|
||||
assert(c.x == 0);
|
||||
assert(c.y == 0);
|
||||
assert(c.width == 5);
|
||||
assert(c.height == 5);
|
||||
}
|
||||
Reference in New Issue
Block a user