summaryrefslogtreecommitdiff
path: root/tiger-compiler/tests/object/type
diff options
context:
space:
mode:
authorMartial Simon <msimon_fr@hotmail.com>2025-09-15 01:07:58 +0200
committerMartial Simon <msimon_fr@hotmail.com>2025-09-15 01:07:58 +0200
commit967be9e750221ab2ab783f95df79bb26d290a45e (patch)
tree6802900a5e975f9f68b169f0f503f040056d6952 /tiger-compiler/tests/object/type
add: added projectsHEADmain
Diffstat (limited to 'tiger-compiler/tests/object/type')
-rwxr-xr-xtiger-compiler/tests/object/type/bad-member-bindings.tig7
-rwxr-xr-xtiger-compiler/tests/object/type/circular-inheritance.tig7
-rwxr-xr-xtiger-compiler/tests/object/type/class-as-bad-parameter.tig7
-rwxr-xr-xtiger-compiler/tests/object/type/class-equals-different-class.tig8
-rwxr-xr-xtiger-compiler/tests/object/type/class-greater-than-different-class.tig8
-rwxr-xr-xtiger-compiler/tests/object/type/class-lower-than-different-class.tig8
-rwxr-xr-xtiger-compiler/tests/object/type/class-not-equals-different-class.tig8
-rwxr-xr-xtiger-compiler/tests/object/type/class-to-int.tig6
-rwxr-xr-xtiger-compiler/tests/object/type/class-to-string.tig6
-rwxr-xr-xtiger-compiler/tests/object/type/incompatible-covariance.tig13
10 files changed, 78 insertions, 0 deletions
diff --git a/tiger-compiler/tests/object/type/bad-member-bindings.tig b/tiger-compiler/tests/object/type/bad-member-bindings.tig
new file mode 100755
index 0000000..86f48ea
--- /dev/null
+++ b/tiger-compiler/tests/object/type/bad-member-bindings.tig
@@ -0,0 +1,7 @@
+let
+ type C = class {}
+ var c := new C
+in
+ c.missing_method();
+ c.missing_attribute
+end \ No newline at end of file
diff --git a/tiger-compiler/tests/object/type/circular-inheritance.tig b/tiger-compiler/tests/object/type/circular-inheritance.tig
new file mode 100755
index 0000000..b5c7d20
--- /dev/null
+++ b/tiger-compiler/tests/object/type/circular-inheritance.tig
@@ -0,0 +1,7 @@
+let
+ class A extends C {}
+ class B extends A {}
+ class C extends B {}
+in
+ ()
+end
diff --git a/tiger-compiler/tests/object/type/class-as-bad-parameter.tig b/tiger-compiler/tests/object/type/class-as-bad-parameter.tig
new file mode 100755
index 0000000..32b66a2
--- /dev/null
+++ b/tiger-compiler/tests/object/type/class-as-bad-parameter.tig
@@ -0,0 +1,7 @@
+let
+ type Entity = class {}
+ var a := new Entity
+ var b := new Entity
+in
+ strcmp(a, b)
+end
diff --git a/tiger-compiler/tests/object/type/class-equals-different-class.tig b/tiger-compiler/tests/object/type/class-equals-different-class.tig
new file mode 100755
index 0000000..16bab53
--- /dev/null
+++ b/tiger-compiler/tests/object/type/class-equals-different-class.tig
@@ -0,0 +1,8 @@
+let
+ type Cube = class {}
+ type Circle = class {}
+ var cube := new Cube
+ var circle := new Circle
+in
+ cube = circle
+end
diff --git a/tiger-compiler/tests/object/type/class-greater-than-different-class.tig b/tiger-compiler/tests/object/type/class-greater-than-different-class.tig
new file mode 100755
index 0000000..367aea8
--- /dev/null
+++ b/tiger-compiler/tests/object/type/class-greater-than-different-class.tig
@@ -0,0 +1,8 @@
+let
+ type Cube = class {}
+ type Circle = class {}
+ var cube := new Cube
+ var circle := new Circle
+in
+ cube > circle
+end
diff --git a/tiger-compiler/tests/object/type/class-lower-than-different-class.tig b/tiger-compiler/tests/object/type/class-lower-than-different-class.tig
new file mode 100755
index 0000000..e486599
--- /dev/null
+++ b/tiger-compiler/tests/object/type/class-lower-than-different-class.tig
@@ -0,0 +1,8 @@
+let
+ type Cube = class {}
+ type Circle = class {}
+ var cube := new Cube
+ var circle := new Circle
+in
+ cube < circle
+end
diff --git a/tiger-compiler/tests/object/type/class-not-equals-different-class.tig b/tiger-compiler/tests/object/type/class-not-equals-different-class.tig
new file mode 100755
index 0000000..7a38a05
--- /dev/null
+++ b/tiger-compiler/tests/object/type/class-not-equals-different-class.tig
@@ -0,0 +1,8 @@
+let
+ type Cube = class {}
+ type Circle = class {}
+ var cube := new Cube
+ var circle := new Circle
+in
+ cube <> circle
+end
diff --git a/tiger-compiler/tests/object/type/class-to-int.tig b/tiger-compiler/tests/object/type/class-to-int.tig
new file mode 100755
index 0000000..a69e5a4
--- /dev/null
+++ b/tiger-compiler/tests/object/type/class-to-int.tig
@@ -0,0 +1,6 @@
+let
+ type Entity = class {}
+ var object := new Entity
+in
+ object := 42
+end
diff --git a/tiger-compiler/tests/object/type/class-to-string.tig b/tiger-compiler/tests/object/type/class-to-string.tig
new file mode 100755
index 0000000..7630936
--- /dev/null
+++ b/tiger-compiler/tests/object/type/class-to-string.tig
@@ -0,0 +1,6 @@
+let
+ type Entity = class {}
+ var object := new Entity
+in
+ object := "string"
+end
diff --git a/tiger-compiler/tests/object/type/incompatible-covariance.tig b/tiger-compiler/tests/object/type/incompatible-covariance.tig
new file mode 100755
index 0000000..0ef37f5
--- /dev/null
+++ b/tiger-compiler/tests/object/type/incompatible-covariance.tig
@@ -0,0 +1,13 @@
+let
+ class Shape {}
+ class Square extends Shape {}
+ class Circle extends Shape {}
+
+ function update_radius(circle : Circle) = ()
+
+ var a := new Square
+ var b := new Circle
+in
+ update_radius(b);
+ update_radius(a)
+end