From 5d31f28bedc3d045f01f390245b5afbbb316e414 Mon Sep 17 00:00:00 2001 From: Zuhaitz Méndez Fernández de Aránguiz Date: Thu, 22 Jan 2026 22:56:40 +0000 Subject: Fix for #91 --- tests/modules/test_aliasing.zc | 4 ++-- tests/modules/test_modules/_math.zc | 19 +++++++++++++++++++ tests/modules/test_modules/_physics.zc | 17 +++++++++++++++++ tests/modules/test_modules/_simple.zc | 3 +++ tests/modules/test_modules/math.zc | 19 ------------------- tests/modules/test_modules/physics.zc | 17 ----------------- tests/modules/test_modules/simple.zc | 3 --- tests/modules/test_namespaced.zc | 4 ++-- 8 files changed, 43 insertions(+), 43 deletions(-) create mode 100644 tests/modules/test_modules/_math.zc create mode 100644 tests/modules/test_modules/_physics.zc create mode 100644 tests/modules/test_modules/_simple.zc delete mode 100644 tests/modules/test_modules/math.zc delete mode 100644 tests/modules/test_modules/physics.zc delete mode 100644 tests/modules/test_modules/simple.zc (limited to 'tests/modules') diff --git a/tests/modules/test_aliasing.zc b/tests/modules/test_aliasing.zc index 96b200c..468e558 100644 --- a/tests/modules/test_aliasing.zc +++ b/tests/modules/test_aliasing.zc @@ -1,6 +1,6 @@ -import { Vector as MathVec } from "./test_modules/math.zc"; -import { Vector as PhysicsVec } from "./test_modules/physics.zc"; +import { Vector as MathVec } from "./test_modules/_math.zc"; +import { Vector as PhysicsVec } from "./test_modules/_physics.zc"; test "test_selective_aliasing" { var mv = MathVec::new(3, 4); diff --git a/tests/modules/test_modules/_math.zc b/tests/modules/test_modules/_math.zc new file mode 100644 index 0000000..be65a5c --- /dev/null +++ b/tests/modules/test_modules/_math.zc @@ -0,0 +1,19 @@ + +struct Vector { + x: int; + y: int; +} + +impl Vector { + fn new(x: int, y: int) -> Vector { + return Vector { x: x, y: y }; + } + + fn length(self) -> int { + // sqrt(3^2 + 4^2) = 5 + // Implementing simple integer fallback or mocked logic since we don't have sqrt in std (maybe?) + // For 3,4 it is 5. + if (self.x == 3 && self.y == 4) return 5; + return 0; + } +} diff --git a/tests/modules/test_modules/_physics.zc b/tests/modules/test_modules/_physics.zc new file mode 100644 index 0000000..ee56f7e --- /dev/null +++ b/tests/modules/test_modules/_physics.zc @@ -0,0 +1,17 @@ + +struct Vector { + vx: double; + vy: double; +} + +impl Vector { + fn new(vx: double, vy: double) -> Vector { + return Vector { vx: vx, vy: vy }; + } + + fn magnitude(self) -> double { + // sqrt(5^2 + 12^2) = 13 + if (self.vx == 5.0 && self.vy == 12.0) return 13.0; + return 0.0; + } +} diff --git a/tests/modules/test_modules/_simple.zc b/tests/modules/test_modules/_simple.zc new file mode 100644 index 0000000..ed002e2 --- /dev/null +++ b/tests/modules/test_modules/_simple.zc @@ -0,0 +1,3 @@ +fn foo() -> int { + return 100; +} diff --git a/tests/modules/test_modules/math.zc b/tests/modules/test_modules/math.zc deleted file mode 100644 index be65a5c..0000000 --- a/tests/modules/test_modules/math.zc +++ /dev/null @@ -1,19 +0,0 @@ - -struct Vector { - x: int; - y: int; -} - -impl Vector { - fn new(x: int, y: int) -> Vector { - return Vector { x: x, y: y }; - } - - fn length(self) -> int { - // sqrt(3^2 + 4^2) = 5 - // Implementing simple integer fallback or mocked logic since we don't have sqrt in std (maybe?) - // For 3,4 it is 5. - if (self.x == 3 && self.y == 4) return 5; - return 0; - } -} diff --git a/tests/modules/test_modules/physics.zc b/tests/modules/test_modules/physics.zc deleted file mode 100644 index ee56f7e..0000000 --- a/tests/modules/test_modules/physics.zc +++ /dev/null @@ -1,17 +0,0 @@ - -struct Vector { - vx: double; - vy: double; -} - -impl Vector { - fn new(vx: double, vy: double) -> Vector { - return Vector { vx: vx, vy: vy }; - } - - fn magnitude(self) -> double { - // sqrt(5^2 + 12^2) = 13 - if (self.vx == 5.0 && self.vy == 12.0) return 13.0; - return 0.0; - } -} diff --git a/tests/modules/test_modules/simple.zc b/tests/modules/test_modules/simple.zc deleted file mode 100644 index ed002e2..0000000 --- a/tests/modules/test_modules/simple.zc +++ /dev/null @@ -1,3 +0,0 @@ -fn foo() -> int { - return 100; -} diff --git a/tests/modules/test_namespaced.zc b/tests/modules/test_namespaced.zc index d2aa8cd..afc1d6c 100644 --- a/tests/modules/test_namespaced.zc +++ b/tests/modules/test_namespaced.zc @@ -1,6 +1,6 @@ -import "./test_modules/math.zc" as math; -import "./test_modules/physics.zc" as physics; +import "./test_modules/_math.zc" as math; +import "./test_modules/_physics.zc" as physics; test "test_namespaced_imports" { var mv = math::Vector::new(3, 4); -- cgit v1.2.3