From 4047c0d0a92eae8a7394b4caa479d0cb6dd9017c Mon Sep 17 00:00:00 2001 From: David Thompson Date: Mon, 24 Oct 2022 17:17:50 -0400 Subject: math: matrix: Add copy procedures. --- tests/matrix.scm | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'tests') diff --git a/tests/matrix.scm b/tests/matrix.scm index 7f36280..0cd24a9 100644 --- a/tests/matrix.scm +++ b/tests/matrix.scm @@ -24,7 +24,34 @@ #:use-module (chickadee math vector)) (with-tests "matrix" + (test-group "3x3 matrices" + (test-assert "matrix3-copy" + (let ((m (make-matrix3 0 1 2 + 3 4 5 + 6 7 8))) + (matrix3= m (matrix3-copy m)))) + (test-assert "matrix3-copy!" + (let ((src (make-matrix3 0 1 2 + 3 4 5 + 6 7 8)) + (dest (make-null-matrix3))) + (matrix3-copy! src dest) + (matrix3= src dest)))) (test-group "4x4 matrices" + (test-assert "matrix4-copy" + (let ((m (make-matrix4 0 1 2 3 + 4 5 6 7 + 8 9 0 1 + 2 3 4 5))) + (matrix4= m (matrix4-copy m)))) + (test-assert "matrix4-copy!" + (let ((src (make-matrix4 0 1 2 3 + 4 5 6 7 + 8 9 0 1 + 2 3 4 5)) + (dest (make-null-matrix4))) + (matrix4-copy! src dest) + (matrix4= src dest))) (test-group "multiplication" (test-assert "identity" (let ((m (make-matrix4 0 1 2 3 -- cgit v1.2.3