From 15d838868b6dd7993d3f04c0a22bd9addaf731af Mon Sep 17 00:00:00 2001 From: David Thompson Date: Wed, 6 Oct 2021 17:11:01 -0400 Subject: Collapse test hierarchy into a single directory. --- tests/math/vector.scm | 93 --------------------------------------------------- 1 file changed, 93 deletions(-) delete mode 100644 tests/math/vector.scm (limited to 'tests/math/vector.scm') diff --git a/tests/math/vector.scm b/tests/math/vector.scm deleted file mode 100644 index c3fc900..0000000 --- a/tests/math/vector.scm +++ /dev/null @@ -1,93 +0,0 @@ -;;; Chickadee Game Toolkit -;;; Copyright © 2021 David Thompson -;;; -;;; Chickadee is free software: you can redistribute it and/or modify -;;; it under the terms of the GNU General Public License as published -;;; by the Free Software Foundation, either version 3 of the License, -;;; or (at your option) any later version. -;;; -;;; Chickadee is distributed in the hope that it will be useful, but -;;; WITHOUT ANY WARRANTY; without even the implied warranty of -;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;;; General Public License for more details. -;;; -;;; You should have received a copy of the GNU General Public License -;;; along with this program. If not, see -;;; . - -(define-module (tests math vector) - #:use-module (tests utils) - #:use-module (srfi srfi-64) - #:use-module (chickadee math) - #:use-module (chickadee math vector)) - -(with-tests "vector" - (test-group "2D vectors" - (test-assert "vec2=" - (vec2= (vec2 1.0 2.0) (vec2 1.0 2.0))) - (test-group "vec2/polar" - (test-equal (vec2/polar (vec2 1.0 1.0) 2.0 0.0) (vec2 3.0 1.0)) - (test-equal (vec2/polar (vec2 1.0 1.0) 2.0 (/ pi 2)) (vec2 1.0 3.0)) - (test-equal (vec2/polar (vec2 1.0 1.0) 2.0 pi) (vec2 -1.0 1.0)) - (test-equal (vec2/polar (vec2 1.0 1.0) 2.0 (* pi 1.5)) (vec2 1.0 -1.0)) - (test-equal (vec2/polar (vec2 1.0 1.0) 2.0 tau) (vec2 3.0 1.0))) - (test-group "vec2-magnitude" - (test-equal "normal case" - (vec2-magnitude (vec2 -3.0 4.0)) 5.0) - (test-equal "division by zero edge case" - (vec2-magnitude (vec2 0.0 0.0)) 0.0)) - (test-equal "vec2-dot" - (vec2-dot (vec2 1.0 2.0) (vec2 3.0 4.0)) 11.0) - (test-group "vec2-cross" - (test-equal "same line" - (vec2-cross (vec2 1.0 2.0) (vec2 2.0 4.0)) 0.0) - (test-equal "clockwise" - (vec2-cross (vec2 1.0 2.0) (vec2 0.0 2.0)) 2.0) - (test-equal "counter-clockwise" - (vec2-cross (vec2 1.0 2.0) (vec2 2.0 0.0)) -4.0)) - (test-approximate "vec2-normalize" - (vec2-magnitude (vec2-normalize (vec2 3.7 4.9))) 1.0 0.001) - (test-group "vec2*" - (test-equal "vec2 * vec2" - (vec2* (vec2 2.0 3.0) (vec2 4.0 5.0)) (vec2 8.0 15.0)) - (test-equal "vec2 * scalar" - (vec2* (vec2 2.0 3.0) 4.0) (vec2 8.0 12.0))) - (test-group "vec2+" - (test-equal "vec2 + vec2" - (vec2+ (vec2 1.0 2.0) (vec2 3.0 4.0)) (vec2 4.0 6.0)) - (test-equal "vec2 + scalar" - (vec2+ (vec2 1.0 2.0) 3.0) (vec2 4.0 5.0))) - (test-group "vec2-" - (test-equal "vec2 - vec2" - (vec2- (vec2 1.0 2.0) (vec2 3.0 4.0)) (vec2 -2.0 -2.0)) - (test-equal "vec2 - scalar" - (vec2- (vec2 1.0 2.0) 3.0) (vec2 -2.0 -1.0)))) - (test-group "3D vectors" - (test-assert "vec3=" - (vec3= (vec3 1.0 2.0 3.0) (vec3 1.0 2.0 3.0))) - (test-group "vec3-magnitude" - (test-equal "normal case" - (vec3-magnitude (vec3 -2.0 3.0 -6.0)) 7.0) - (test-equal "division by zero edge case" - (vec3-magnitude (vec3 0.0 0.0 0.0)) 0.0)) - (test-equal "vec3-dot" - (vec3-dot (vec3 1.0 2.0 3.0) (vec3 4.0 5.0 6.0)) 32.0) - (test-equal "vec3-cross" - (vec3-cross (vec3 2.0 3.0 4.0) (vec3 5.0 6.0 7.0)) (vec3 -3.0 6.0 -3.0)) - (test-approximate "vec3-normalize" - (vec3-magnitude (vec3-normalize (vec3 3.7 4.9 9.2))) 1.0 0.001) - (test-group "vec3*" - (test-equal "vec3 * vec3" - (vec3* (vec3 2.0 3.0 4.0) (vec3 5.0 6.0 7.0)) (vec3 10.0 18.0 28.0)) - (test-equal "vec3 * scalar" - (vec3* (vec3 2.0 3.0 4.0) 5.0) (vec3 10.0 15.0 20.0))) - (test-group "vec3+" - (test-equal "vec3 + vec3" - (vec3+ (vec3 1.0 2.0 3.0) (vec3 4.0 5.0 6.0)) (vec3 5.0 7.0 9.0)) - (test-equal "vec3 + scalar" - (vec3+ (vec3 1.0 2.0 3.0) 4.0) (vec3 5.0 6.0 7.0))) - (test-group "vec3-" - (test-equal "vec3 - vec3" - (vec3- (vec3 1.0 2.0 3.0) (vec3 4.0 5.0 6.0)) (vec3 -3.0 -3.0 -3.0)) - (test-equal "vec3 - scalar" - (vec3- (vec3 1.0 2.0 3.0) 4.0) (vec3 -3.0 -2.0 -1.0))))) -- cgit v1.2.3