diff options
author | bonmas14 <bonmas14@gmail.com> | 2025-08-04 16:08:22 +0000 |
---|---|---|
committer | bonmas14 <bonmas14@gmail.com> | 2025-08-04 16:08:22 +0000 |
commit | b16ca14911ad5df44ae499eed2d90c3ca2da4eb0 (patch) | |
tree | 685d64ea40f66b72c994bcfd3de0c5015a9cf36a /tests/un/math.c | |
parent | ed1cab483e49e29396178a33dea51773aa770855 (diff) | |
download | ungrateful-b16ca14911ad5df44ae499eed2d90c3ca2da4eb0.tar.gz ungrateful-b16ca14911ad5df44ae499eed2d90c3ca2da4eb0.zip |
Vecs and tests
Diffstat (limited to 'tests/un/math.c')
-rw-r--r-- | tests/un/math.c | 34 |
1 files changed, 33 insertions, 1 deletions
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 <ungrateful.h> -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; } |