]> Nishi Git Mirror - gwion.git/commitdiff
:art: More type algebra and tests
authorfennecdjay <astor.jeremie@wanadoo.fr>
Fri, 16 Aug 2019 10:41:39 +0000 (12:41 +0200)
committerfennecdjay <astor.jeremie@wanadoo.fr>
Fri, 16 Aug 2019 10:41:39 +0000 (12:41 +0200)
src/lib/engine.c
tests/new/typeof.gw [new file with mode: 0644]
tests/new/typeof2.gw [new file with mode: 0644]
tests/new/typeof3.gw [new file with mode: 0644]

index 4c13145e139c2d2527f17aa848465ead031bf486..4b128d24b97410d992dd48eb9aecad32fdc890fe 100644 (file)
@@ -106,6 +106,7 @@ ANN static m_bool import_core_libs(const Gwi gwi) {
 
   GWI_BB(gwi_oper_ini(gwi, "Class", "Class", "int"))
   GWI_BB(gwi_oper_end(gwi, "==", int_eq))
+  GWI_BB(gwi_oper_end(gwi, "!=", int_neq))
   GWI_BB(gwi_oper_end(gwi, ">=", instr_class_ge))
   GWI_BB(gwi_oper_end(gwi, ">",  instr_class_gt))
   GWI_BB(gwi_oper_end(gwi, "<=", instr_class_le))
diff --git a/tests/new/typeof.gw b/tests/new/typeof.gw
new file mode 100644 (file)
index 0000000..44e41d8
--- /dev/null
@@ -0,0 +1,8 @@
+<<< typeof(1) == typeof(2) >>>;
+<<< typeof(1) != typeof(2) >>>;
+<<< typeof(1) > typeof(2) >>>;
+<<< typeof(1) >= typeof(2) >>>;
+<<< typeof(1) < typeof(2) >>>;
+<<< typeof(1) <= typeof(2) >>>;
+<<< typeof(1) == Object >>>;
+<<< typeof(1) > Object >>>;
diff --git a/tests/new/typeof2.gw b/tests/new/typeof2.gw
new file mode 100644 (file)
index 0000000..1e9bd9a
--- /dev/null
@@ -0,0 +1,2 @@
+<<< int >>>;
+<<< typeof(1) >= int >>>;
diff --git a/tests/new/typeof3.gw b/tests/new/typeof3.gw
new file mode 100644 (file)
index 0000000..9039e93
--- /dev/null
@@ -0,0 +1,9 @@
+class C {}
+class D extends C {}
+C c;
+D d;
+<<< typeof(c) < typeof(d) >>>;
+<<< typeof(c) > typeof(d) >>>;
+<<< C < D >>>;
+<<< C > D >>>;
+