aboutsummaryrefslogtreecommitdiff
path: root/tests/test_vector.cpp
diff options
context:
space:
mode:
authory-jan137 <yousefjan24000@gmail.com>2026-04-27 07:24:41 +0300
committery-jan137 <yousefjan24000@gmail.com>2026-04-27 07:24:41 +0300
commit4602b36e9d5ea08656e3222846a1f161bbb1cec1 (patch)
tree87618f154f7ebe91657ba1501d695d45a31e7881 /tests/test_vector.cpp
parentb8bc28c70a6f2b0e7de81e85a796303d514df008 (diff)
Module refactor
Diffstat (limited to 'tests/test_vector.cpp')
-rw-r--r--tests/test_vector.cpp16
1 files changed, 7 insertions, 9 deletions
diff --git a/tests/test_vector.cpp b/tests/test_vector.cpp
index 364ce31..a776dc8 100644
--- a/tests/test_vector.cpp
+++ b/tests/test_vector.cpp
@@ -1,6 +1,4 @@
-#include "linalg_error.hpp"
-#include "norms.hpp"
-#include "vector.hpp"
+import linalgebra;
#include <catch2/catch_approx.hpp>
#include <catch2/catch_test_macros.hpp>
@@ -8,8 +6,8 @@
#include <type_traits>
#include <utility>
-using linalg::DimensionMismatchError;
-using linalg::Vector;
+using linalgebra::DimensionMismatchError;
+using linalgebra::Vector;
TEST_CASE("Vector constructors initialize size and values", "[vector]") {
const Vector empty;
@@ -82,17 +80,17 @@ TEST_CASE("Vector arithmetic enforces shape compatibility", "[vector]") {
CHECK(scaled[1] == 1.0);
CHECK(scaled[2] == 1.5);
- CHECK(linalg::dot(a, b) == 32.0);
+ CHECK(linalgebra::dot(a, b) == 32.0);
const Vector short_vec{1.0, 2.0};
CHECK_THROWS_AS(a + short_vec, DimensionMismatchError);
- CHECK_THROWS_AS(linalg::dot(a, short_vec), DimensionMismatchError);
+ CHECK_THROWS_AS(linalgebra::dot(a, short_vec), DimensionMismatchError);
}
TEST_CASE("Vector 2-norm matches manually computed values", "[vector][norms]") {
const Vector v{3.0, 4.0};
- CHECK(linalg::norm2(v) == Catch::Approx(5.0));
+ CHECK(linalgebra::norm2(v) == Catch::Approx(5.0));
const Vector zero(5);
- CHECK(linalg::norm2(zero) == Catch::Approx(0.0));
+ CHECK(linalgebra::norm2(zero) == Catch::Approx(0.0));
}