]> Nishi Git Mirror - gwion.git/commitdiff
:art: Test class_ext
authorfennecdjay <astor.jeremie@wanadoo.fr>
Sat, 12 Oct 2019 01:30:10 +0000 (03:30 +0200)
committerfennecdjay <astor.jeremie@wanadoo.fr>
Sat, 12 Oct 2019 01:30:10 +0000 (03:30 +0200)
tests/import/extend_fail_before.c [new file with mode: 0644]
tests/import/extend_fail_empty.c [new file with mode: 0644]
tests/import/extend_fail_set.c [new file with mode: 0644]
tests/import/str2decl.c [new file with mode: 0644]
tests/sh/common.sh

diff --git a/tests/import/extend_fail_before.c b/tests/import/extend_fail_before.c
new file mode 100644 (file)
index 0000000..032bd27
--- /dev/null
@@ -0,0 +1,20 @@
+#include "gwion_util.h"
+#include "gwion_ast.h"
+#include "oo.h"
+#include "vm.h"
+#include "env.h"
+#include "type.h"
+#include "instr.h"
+#include "object.h"
+#include "instr.h"
+#include "vm.h"
+#include "gwion.h"
+#include "value.h"
+#include "operator.h"
+#include "import.h"
+#include "gwi.h"
+
+GWION_IMPORT(extend_event_test) {
+  Type_Decl* td = new_type_decl(gwi->gwion->st->p, new_id_list(gwi->gwion->st->p, insert_symbol(gwi->gwion->st, "Event"), GWI_LOC));
+  return gwi_class_ext(gwi, td);
+}
diff --git a/tests/import/extend_fail_empty.c b/tests/import/extend_fail_empty.c
new file mode 100644 (file)
index 0000000..2cd87ee
--- /dev/null
@@ -0,0 +1,28 @@
+#include "gwion_util.h"
+#include "gwion_ast.h"
+#include "oo.h"
+#include "vm.h"
+#include "env.h"
+#include "type.h"
+#include "instr.h"
+#include "object.h"
+#include "instr.h"
+#include "vm.h"
+#include "gwion.h"
+#include "value.h"
+#include "operator.h"
+#include "import.h"
+#include "gwi.h"
+
+static CTOR(ev_ctor) { printf(" %p this to test ctor\n", (void*)o); }
+
+GWION_IMPORT(extend_event_test) {
+  Type t_ev ;
+  GWI_OB((t_ev = gwi_mk_type(gwi, "Ev", SZ_INT , NULL)))
+  GWI_BB(gwi_class_ini(gwi, t_ev, ev_ctor, NULL))
+  Type_Decl* td = new_type_decl(gwi->gwion->st->p, new_id_list(gwi->gwion->st->p, insert_symbol(gwi->gwion->st, "Event"), GWI_LOC));
+  td->array = new_array_sub(gwi->gwion->mp, NULL);
+  GWI_BB(gwi_class_ext(gwi, td))
+  GWI_BB(gwi_class_end(gwi))
+  return GW_OK;
+}
diff --git a/tests/import/extend_fail_set.c b/tests/import/extend_fail_set.c
new file mode 100644 (file)
index 0000000..323eff8
--- /dev/null
@@ -0,0 +1,28 @@
+#include "gwion_util.h"
+#include "gwion_ast.h"
+#include "oo.h"
+#include "vm.h"
+#include "env.h"
+#include "type.h"
+#include "instr.h"
+#include "object.h"
+#include "instr.h"
+#include "vm.h"
+#include "gwion.h"
+#include "value.h"
+#include "operator.h"
+#include "import.h"
+#include "gwi.h"
+
+static CTOR(ev_ctor) { printf(" %p this to test ctor\n", (void*)o); }
+
+GWION_IMPORT(extend_event_test) {
+  Type t_ev ;
+  GWI_OB((t_ev = gwi_mk_type(gwi, "Ev", SZ_INT , NULL)))
+  GWI_BB(gwi_class_ini(gwi, t_ev, ev_ctor, NULL))
+  Type_Decl* td = new_type_decl(gwi->gwion->st->p, new_id_list(gwi->gwion->st->p, insert_symbol(gwi->gwion->st, "Event"), GWI_LOC));
+  GWI_BB(gwi_class_ext(gwi, td))
+  GWI_BB(gwi_class_ext(gwi, td))
+  GWI_BB(gwi_class_end(gwi))
+  return GW_OK;
+}
diff --git a/tests/import/str2decl.c b/tests/import/str2decl.c
new file mode 100644 (file)
index 0000000..b27a405
--- /dev/null
@@ -0,0 +1,34 @@
+#include <stdlib.h>
+#include <math.h>
+#include "gwion_util.h"
+#include "gwion_ast.h"
+#include "oo.h"
+#include "env.h"
+#include "vm.h"
+#include "gwion.h"
+#include "type.h"
+#include "instr.h"
+#include "object.h"
+#include "value.h"
+#include "operator.h"
+#include "import.h"
+#include "ugen.h"
+#include "func.h"
+#include "gwi.h"
+
+ANN /*static */m_bool _path_valid(const Env env, const m_str path, const loc_t);
+GWION_IMPORT(str2decl) {
+//  const m_str list[2] = { "A", "B" };
+//  gwi_tmpl_ini(gwi, 2, list);
+  const Type t_t0 = gwi_mk_type(gwi, "Test", SZ_INT, "Object");
+  GWI_BB(gwi_class_ini(gwi, t_t0, NULL, NULL))
+//  gwi_tmpl_end(gwi);
+    const Type t_t2 = gwi_mk_type(gwi, "Child", SZ_INT, "Object");
+    GWI_BB(gwi_class_ini(gwi, t_t2, NULL, NULL))
+    GWI_BB(gwi_class_end(gwi))
+  GWI_BB(gwi_class_end(gwi))
+//  const Type t_t1 = gwi_mk_type(gwi, "Test2", SZ_INT, "<~int,<~int~>Ptr~>Test.Child");
+  const Type t_t1 = gwi_mk_type(gwi, "Test2", SZ_INT, "Test.Child");
+  GWI_BB(gwi_class_ini(gwi, t_t1, NULL, NULL))
+  return gwi_class_end(gwi);
+}
index 68b45243cbeafe74cbae0912d3033062449519f5..bbb9906cf7d7e5c12cbe9d83bcbc9c503b120cbd 100644 (file)
@@ -1,5 +1,5 @@
 #!/bin/bash
-# [test] #0
+# [test] #53
 
 set -m
 : "${GWOPT:=}"