From 38004f74df5b2dbcb07e6ad5ac2272f16882e018 Mon Sep 17 00:00:00 2001 From: y-jan137 Date: Thu, 12 Mar 2026 16:40:43 +0300 Subject: Add basic ops --- tests/test_vector.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'tests/test_vector.cpp') diff --git a/tests/test_vector.cpp b/tests/test_vector.cpp index 1d7b91a..364ce31 100644 --- a/tests/test_vector.cpp +++ b/tests/test_vector.cpp @@ -1,6 +1,8 @@ #include "linalg_error.hpp" +#include "norms.hpp" #include "vector.hpp" +#include #include #include @@ -86,3 +88,11 @@ TEST_CASE("Vector arithmetic enforces shape compatibility", "[vector]") { CHECK_THROWS_AS(a + short_vec, DimensionMismatchError); CHECK_THROWS_AS(linalg::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)); + + const Vector zero(5); + CHECK(linalg::norm2(zero) == Catch::Approx(0.0)); +} -- cgit v1.2.3