From 7d763b5778cfbf81ee420558d13e8acbb66d860a Mon Sep 17 00:00:00 2001 From: Jasper Date: Sun, 31 Aug 2025 15:47:31 +0200 Subject: Initial commit --- tests.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 tests.c (limited to 'tests.c') diff --git a/tests.c b/tests.c new file mode 100644 index 0000000..9b2a4dc --- /dev/null +++ b/tests.c @@ -0,0 +1,24 @@ +#include "tests.h" + +#include + +#include "matrix.h" + +void test_LR() +{ + Matrix *A = matrix_from_str("[2 3 1;4 1 -5;-1 2 3]"); + Matrix *b = matrix_from_str("[-1;2;3]"); + + Matrix **LR = matrix_LR(A, b); + Matrix *L = LR[0]; + Matrix *R = LR[1]; + Matrix *y = matrix_forwardel(L, b); + Matrix *x = matrix_backsubst(R, y); + + assert(matrix_eq(matrix_mult(A, x), b, 0.01)); +} + +void run_tests() +{ + test_LR(); +} -- cgit v1.2.3