summaryrefslogtreecommitdiff
path: root/tests/modules/test_modules/physics.zc
diff options
context:
space:
mode:
authorZuhaitz Méndez Fernández de Aránguiz <zuhaitz@debian>2026-01-14 23:59:54 +0000
committerZuhaitz Méndez Fernández de Aránguiz <zuhaitz@debian>2026-01-14 23:59:54 +0000
commitdcfdc053cb5f9fb4d5eac0a2233c75126b7a8188 (patch)
treef34f30b382fa22d6fd0af46875a5b4b26d00feff /tests/modules/test_modules/physics.zc
parenta918df69269a39ef7350a645b5db025d66ecb18a (diff)
Added some of the tests.
Diffstat (limited to 'tests/modules/test_modules/physics.zc')
-rw-r--r--tests/modules/test_modules/physics.zc17
1 files changed, 17 insertions, 0 deletions
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;
+ }
+}