]> Nishi Git Mirror - gwion.git/commitdiff
:art: More tests
authorfennecdjay <astor.jeremie@wanadoo.fr>
Mon, 21 Oct 2019 18:02:16 +0000 (20:02 +0200)
committerfennecdjay <astor.jeremie@wanadoo.fr>
Mon, 21 Oct 2019 18:02:16 +0000 (20:02 +0200)
tests/import/class_template_invalid.c [new file with mode: 0644]
tests/sh/import.sh

diff --git a/tests/import/class_template_invalid.c b/tests/import/class_template_invalid.c
new file mode 100644 (file)
index 0000000..ba3dbc5
--- /dev/null
@@ -0,0 +1,48 @@
+#include "gwion_util.h"
+#include "gwion_ast.h"
+#include "oo.h"
+#include "vm.h"
+#include "env.h"
+#include "type.h"
+#include "object.h"
+#include "instr.h"
+#include "gwion.h"
+#include "value.h"
+#include "operator.h"
+#include "import.h"
+#include "gwi.h"
+
+static m_int o_map_key;
+static m_int o_map_value;
+#define MAP_KEY(a) *((M_Object*)(a->data + o_map_key))
+#define MAP_VAL(a) *((M_Object*)(a->data + o_map_value))
+static CTOR(class_template_ctor) {
+  /*char* name = strdup(o->type_ref->name);*/
+  /*char* tmp = strsep(&name, "@");*/
+  /*char* name1 = strsep(&name, "@");*/
+/*Type t1 = nspc_lookup_type1(o->type_ref->info->parent, insert_symbol(name1));*/
+  /*Type t2 = nspc_lookup_type0(shred->vm->emit->env->curr, insert_symbol(name));*/
+/*free(tmp);*/
+/**(M_Object*)(o->data) = new_array(t1->size, 0, t1->array_depth);*/
+  /**(M_Object*)(o->data + SZ_INT) = new_array(t2->size, 0, t2->array_depth);*/
+}
+
+GWION_IMPORT(class_template) {
+  Type t_class_template;
+  const m_str list[2] = { "A", "B" };
+  gwi_tmpl_ini(gwi, 2, list);
+  GWI_OB((t_class_template = gwi_mk_type(gwi, "ClassTemplate", SZ_INT, "Object")))
+  GWI_BB(gwi_class_ini(gwi, t_class_template, class_template_ctor, NULL))
+  gwi_tmpl_end(gwi);
+    GWI_BB(gwi_item_ini(gwi, "A[]", "key"))
+    GWI_BB((o_map_key = gwi_item_end(gwi, ae_flag_member | ae_flag_template, NULL)))
+    GWI_BB(gwi_item_ini(gwi, "B[]", "value"))
+    GWI_BB((o_map_value = gwi_item_end(gwi, ae_flag_member, NULL)))
+   GWI_BB(gwi_func_ini(gwi, "int", "<~C,D'~>test", (f_xfun)1))
+   GWI_BB(gwi_func_end(gwi, ae_flag_none))
+
+  GWI_BB(gwi_class_end(gwi))
+  GWI_BB(gwi_item_ini(gwi, "ClassTemplate<~Ptr<~int~>,int[]~>", "testObject"))
+  GWI_BB(gwi_item_end(gwi, ae_flag_none, NULL))
+  return GW_OK;
+}
index e44592d8f40038871cd497ceba9ca36eae47a5e4..2221b7dd925309ab506812930c91c9fe2e2cbb95 100644 (file)
@@ -1,5 +1,5 @@
 #!/bin/bash
-# [test] #56
+# [test] #57
 
 n=0
 [ "$1" ] && n="$1"