From b16ca14911ad5df44ae499eed2d90c3ca2da4eb0 Mon Sep 17 00:00:00 2001 From: bonmas14 Date: Mon, 4 Aug 2025 16:08:22 +0000 Subject: Vecs and tests --- tests/un/math.c | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) (limited to 'tests/un/math.c') diff --git a/tests/un/math.c b/tests/un/math.c index 6cc7cd8..eab0dcb 100644 --- a/tests/un/math.c +++ b/tests/un/math.c @@ -1,5 +1,37 @@ #include -int main(void) { +int main() { + // Lerping + { + f64 d; + real r; + f32 f; + + r = un_m_lerpr(1.0f, 2.0f, 0.5f); + assert(fabs(r - 1.5f) < EPSILON); + + f = un_m_lerpf(1.0f, 2.0f, 0.5f); + assert(fabsf(f - 1.5f) < EPSILON); + + d = un_m_lerpd(1.0, 2.0, 0.5); + assert(fabs(d - 1.5) < 0.000001); + } + // Test Bezier curve functions + { + f64 d; + real r; + f32 f; + + un_m_bezierf(&f, 0.0f, 1.0f, 2.0f, 3.0f, 0.5f); + assert(fabsf(f - 1.5f) < EPSILON); + + un_m_bezierd(&d, 0.0, 1.0, 2.0, 3.0, 0.5); + assert(fabs(d - 1.5) < EPSILON); + + un_m_bezierr(&r, 0.0, 1.0, 2.0, 3.0, 0.5); + assert(fabs(r - 1.5) < EPSILON); + } + + return 0; } -- cgit v1.2.3-70-g09d2