]> git.xonotic.org Git - xonotic/gmqcc.git/commitdiff
New test-suite initial implementation. Just need to write some tests.
authorDale Weiler <killfieldengine@gmail.com>
Sat, 17 Nov 2012 02:54:30 +0000 (02:54 +0000)
committerDale Weiler <killfieldengine@gmail.com>
Sat, 17 Nov 2012 02:54:30 +0000 (02:54 +0000)
47 files changed:
Makefile
con.c
gmqcc.h
ir.c
main.c
testsuite/Makefile [deleted file]
testsuite/builtins/main.qc [deleted file]
testsuite/calls/main.qc [deleted file]
testsuite/equality/0.1.expected [deleted file]
testsuite/equality/1.0.expected [deleted file]
testsuite/equality/1.1.expected [deleted file]
testsuite/equality/main.qc [deleted file]
testsuite/field-parameters/expected [deleted file]
testsuite/field-parameters/main.qc [deleted file]
testsuite/fielddefs/deflist.expected [deleted file]
testsuite/fielddefs/main.qc [deleted file]
testsuite/fields1/expected [deleted file]
testsuite/fields1/main.qc [deleted file]
testsuite/functions-as-parameters/expected [deleted file]
testsuite/functions-as-parameters/main.qc [deleted file]
testsuite/globaldefs/deflist.expected [deleted file]
testsuite/globaldefs/main.qc [deleted file]
testsuite/if1/main.qc [deleted file]
testsuite/invalid-assign/main.qc [deleted file]
testsuite/invalid-types/assign.qc [deleted file]
testsuite/invalid-types/call1.qc [deleted file]
testsuite/invalid-types/call2.qc [deleted file]
testsuite/invalid-types/call3.qc [deleted file]
testsuite/invalid-types/op.qc [deleted file]
testsuite/loops1/0.expected [deleted file]
testsuite/loops1/1.expected [deleted file]
testsuite/loops1/10.expected [deleted file]
testsuite/loops1/4.expected [deleted file]
testsuite/loops1/main.qc [deleted file]
testsuite/maths1/0.0.expected [deleted file]
testsuite/maths1/0.3.expected [deleted file]
testsuite/maths1/3.6.expected [deleted file]
testsuite/maths1/main.qc [deleted file]
testsuite/maths2/main.qc [deleted file]
testsuite/ngraphs/expected [deleted file]
testsuite/ngraphs/main.qc [deleted file]
testsuite/shadow-gmqcc/expected [deleted file]
testsuite/shadow-gmqcc/main.qc [deleted file]
testsuite/shadow-qcc/expected [deleted file]
testsuite/shadow-qcc/main.qc [deleted file]
testsuite/variadic/main.qc [deleted file]
util.c

index 2a9c17f588e2eb87a8a97b0b8c3b72fea6aee679..dca380612a3d92c036442d6775dcd66746e3498a 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -25,8 +25,8 @@ OBJ     = \
           ast.o       \
           ir.o        \
           con.o
-OBJ_A = test/ast-test.o
-OBJ_I = test/ir-test.o
+          
+OBJ_T = test.o util.o con.o
 OBJ_C = main.o lexer.o parser.o
 OBJ_X = exec-standalone.o util.o con.o
 
@@ -38,23 +38,22 @@ default: gmqcc
 exec-standalone.o: exec.c
        $(CC) -c $< -o $@ $(CFLAGS) -DQCVM_EXECUTOR=1
 
-# test targets
-test_ast: $(OBJ_A) $(OBJ)
-       $(CC) -o $@ $^ $(CFLAGS)
-test_ir:  $(OBJ_I) $(OBJ)
-       $(CC) -o $@ $^ $(CFLAGS)
-qcvm:     $(OBJ_X)
+qcvm: $(OBJ_X)
        $(CC) -o $@ $^ $(CFLAGS) -lm
-test: test_ast test_ir
 
-# compiler target
 gmqcc: $(OBJ_C) $(OBJ)
        $(CC) -o $@ $^ $(CFLAGS)
 
+test: $(OBJ_T)
+       $(CC) -o $@ $^ $(CFLAGS)
+       
+runtests:
+       ./test
+
 #all target is test and all
-all: test gmqcc
+all: gmqcc qcvm test
 
 clean:
-       rm -f *.o gmqcc qcvm test_ast test_ir test/*.o
+       rm -f *.o gmqcc qcvm test *.dat
        
 
diff --git a/con.c b/con.c
index bfe3a23c72650a60b7285f3eaba6618e2a1ede4c..8073a5723d71286568e5d0c164d3e34059af924f 100644 (file)
--- a/con.c
+++ b/con.c
@@ -272,7 +272,7 @@ int con_change(const char *out, const char *err) {
     con_close();
     
     if (GMQCC_IS_DEFINE((FILE*)out)) {
-        console.handle_out = (((FILE*)err) == stdout) ? stdout : stderr;
+        console.handle_out = (((FILE*)out) == stdout) ? stdout : stderr;
         con_enablecolor();
     } else if (!(console.handle_out = fopen(out, "w"))) return 0;
     
@@ -281,6 +281,10 @@ int con_change(const char *out, const char *err) {
         con_enablecolor();
     } else if (!(console.handle_err = fopen(err, "w"))) return 0;
     
+    // no buffering
+    setvbuf(console.handle_out, NULL, _IONBF, 0);
+    setvbuf(console.handle_err, NULL, _IONBF, 0);
+    
     return 1;
 }
 
diff --git a/gmqcc.h b/gmqcc.h
index b88df48859d212a04204f5ef82f80c226e31060f..51369030d09e17d61228b85013a6a63664d9b0c4 100644 (file)
--- a/gmqcc.h
+++ b/gmqcc.h
@@ -196,6 +196,7 @@ void  util_memory_d      (void       *, unsigned int, const char *);
 void *util_memory_r      (void       *, size_t,       unsigned int, const char *);
 void  util_meminfo       ();
 
+bool  util_filexists     (const char *);
 bool  util_strupper      (const char *);
 bool  util_strdigit      (const char *);
 bool  util_strncmpexact  (const char *, const char *, size_t);
diff --git a/ir.c b/ir.c
index 1a99150ffe2c8120f06ad28b0665f3e9e60aa278..5f037ecc37753c79981fb6b80c30748ef48c72cc 100644 (file)
--- a/ir.c
+++ b/ir.c
@@ -2972,7 +2972,7 @@ bool ir_builder_generate(ir_builder *self, const char *filename)
     stmt.o3.u1 = 0;
     vec_push(code_statements, stmt);
 
-    printf("writing '%s'...\n", filename);
+    con_out("writing '%s'...\n", filename);
     return code_write(filename);
 }
 
diff --git a/main.c b/main.c
index 2c14249945cb52744ee13aed23f33a0a0c602ec8..b483db9880d1dd4b4de6a19f2515e5aee3c6f4af 100644 (file)
--- a/main.c
+++ b/main.c
@@ -224,6 +224,8 @@ static bool options_parse(int argc, char **argv) {
             if (options_long_gcc("redirerr", &argc, &argv, &redirerr)) {
                 continue;
             }
+            
+            con_change(redirout, redirerr);
 
             if (!strcmp(argv[0]+1, "debug")) {
                 opts_debug = true;
@@ -381,7 +383,6 @@ static bool options_parse(int argc, char **argv) {
             vec_push(items, item);
         }
     }
-    con_change(redirout, redirerr);
     return true;
 }
 
diff --git a/testsuite/Makefile b/testsuite/Makefile
deleted file mode 100644 (file)
index 6eafd4c..0000000
+++ /dev/null
@@ -1,191 +0,0 @@
-QCC = ../gmqcc
-VM = ../qcvm
-
-TESTLIST = \
-       globaldefs \
-       fielddefs  \
-       builtins   \
-       variadic   \
-       calls      \
-       if1        \
-       loops1     \
-       maths1     \
-       maths2     \
-       equality   \
-       fields1    \
-       invalid-types \
-       ngraphs    \
-       invalid-assign \
-       field-parameters \
-       functions-as-parameters \
-       shadow-qcc shadow-gmqcc
-
-.PHONY: clean test
-
-clean:
-       rm -f gmqcc qcvm
-       rm -f */deflist */*.gm.dat */*.qcc.dat */output
-       rm -rf obj
-
-test: $(TESTLIST)
-
-obj/%.gm.dat: %/main.qc obj
-       @echo "Testing:" $(subst obj/,,$(subst .gm.dat,,$@))
-       @$(QCC) -std=gmqcc -o $@ $< > $@.out 2> $@.err
-
-obj/%.qcc.dat: %/main.qc obj
-       @echo "Testing:" $(subst obj/,,$(subst .qcc.dat,,$@))
-       @$(QCC) -std=qcc -o $@ $< > $@.out 2> $@.err
-
-#######################################################################
-
-# Macro which causes something to be compiled either with -std=qcc or without...
-# this may at some point be extended to also store information about the progs.dat
-# somewhere but for now we only need to build the object.
-define maketest
-$(eval $dat = obj/${1}.${2}.dat)
-$1: obj/$1.$2.dat
-endef
-
-#######################################################################
-
-globaldefs: obj/globaldefs.gm.dat
-       @$(VM) -printdefs $< > $@/deflist
-       @diff $@/deflist $@/deflist.expected
-
-$(eval $(call maketest,fielddefs,gm))
-fielddefs:
-       @$(VM) -printfields $< > $@/deflist
-       @diff $@/deflist $@/deflist.expected
-
-$(eval $(call maketest,builtins,qcc))
-builtins:
-       @$(VM) -string "Hello 1" $< > $@/output
-       @test "`wc -l $@/output | awk '{ print $$1 }'`" = "1"
-       @grep -qE '^Hello 1$$' $@/output
-       @$(VM) -string "A test message Yeah" $< > $@/output
-       @test "`wc -l $@/output | awk '{ print $$1 }'`" = "1"
-       @grep -qE '^A test message Yeah$$' $@/output
-
-$(eval $(call maketest,variadic,qcc))
-variadic:
-       @$(VM) -string "Hello 1" $< > $@/output
-       @test "`wc -l $@/output | awk '{ print $$1 }'`" = "1"
-       @grep -qE '^Hello 1$$' $@/output
-       @$(VM) -string "A test message Yeah" $< > $@/output
-       @test "`wc -l $@/output | awk '{ print $$1 }'`" = "1"
-       @grep -qE '^A test message Yeah$$' $@/output
-
-$(eval $(call maketest,calls,qcc))
-calls:
-       @$(VM) -float 1 -float 100 -float 10000 $< > $@/output
-       @grep -qE '^70907$$' $@/output
-       @$(VM) -float 3 -float 201 -float 90127 $< > $@/output
-       @grep -qE '^632719$$' $@/output
-
-$(eval $(call maketest,if1,qcc))
-if1:
-       @$(VM) -float 1 -float 100 -float 10000 $< > $@/output
-       @grep -qE '^One$$' $@/output
-       @$(VM) -float 2 -float 100 -float 10000 $< > $@/output
-       @grep -qE '^Two$$' $@/output
-       @$(VM) -float 3 -float 100 -float 10000 $< > $@/output
-       @grep -qE '^Three$$' $@/output
-       @$(VM) -float 4 -float 100 -float 10000 $< > $@/output
-       @grep -qE '^Else$$' $@/output
-
-$(eval $(call maketest,loops1,qcc))
-loops1:
-       @$(VM) -float 0 $< > $@/output
-       @diff $@/output $@/0.expected
-       @$(VM) -float 1 $< > $@/output
-       @diff $@/output $@/1.expected
-       @$(VM) -float 4 $< > $@/output
-       @diff $@/output $@/4.expected
-       @$(VM) -float 10 $< > $@/output
-       @diff $@/output $@/10.expected
-
-$(eval $(call maketest,maths1,qcc))
-maths1:
-       @$(VM) -float 0 -float 3 $< > $@/output
-       @diff $@/output $@/0.3.expected
-       @$(VM) -float 3 -float 6 $< > $@/output
-       @diff $@/output $@/3.6.expected
-       @$(VM) -float 0 -float 0 $< > $@/output
-       @diff $@/output $@/0.0.expected
-
-$(eval $(call maketest,maths2,qcc))
-maths2:
-       @$(VM) -vector '1 2 3' -vector '4 5 6' $< > $@/output
-       @grep -qE '^dot = 32$$' $@/output
-       @$(VM) -vector '-5 12 5.5' -vector '4 -5 1' $< > $@/output
-       @grep -qE '^dot = -74.5$$' $@/output
-       @$(VM) -vector '-5 12 5.5' -vector '0 0 0' $< > $@/output
-       @grep -qE '^dot = 0$$' $@/output
-
-$(eval $(call maketest,equality,qcc))
-equality:
-       @$(VM) -float 1 -float 1 $< > $@/output
-       @diff $@/output $@/1.1.expected
-       @$(VM) -float 1 -float 0 $< > $@/output
-       @diff $@/output $@/1.0.expected
-       @$(VM) -float 0 -float 1 $< > $@/output
-       @diff $@/output $@/0.1.expected
-
-$(eval $(call maketest,fields1,qcc))
-fields1:
-       @$(VM) -vector '150 2000 150' -vector '220 1300 -200' $< > $@/output
-       @diff $@/output $@/expected
-
-invalid-types-ok: obj invalid-types/assign.qc invalid-types/op.qc invalid-types/call1.qc invalid-types/call2.qc invalid-types/call3.qc
-       @echo "Testing: invalid-types"
-       @if $(QCC) -std=qcc -o obj/invalid.dat invalid-types/op.qc     > obj/invalid.out 2>&1 ; then echo "Successfully compiled a file which was supposed to fail: op.qc"     ; false ; else true ; fi
-       @if $(QCC) -std=qcc -o obj/invalid.dat invalid-types/call1.qc  > obj/invalid.out 2>&1 ; then echo "Successfully compiled a file which was supposed to fail: call1.qc"  ; false ; else true ; fi
-       @if $(QCC) -std=qcc -o obj/invalid.dat invalid-types/call2.qc  > obj/invalid.out 2>&1 ; then echo "Successfully compiled a file which was supposed to fail: call2.qc"  ; false ; else true ; fi
-       @if $(QCC) -std=qcc -o obj/invalid.dat invalid-types/call3.qc  > obj/invalid.out 2>&1 ; then echo "Successfully compiled a file which was supposed to fail: call3.qc"  ; false ; else true ; fi
-       @if $(QCC) -std=qcc -o obj/invalid.dat invalid-types/assign.qc > obj/invalid.out 2>&1 ; then echo "Successfully compiled a file which was supposed to fail: assign.qc" ; false ; else true ; fi
-       @touch obj/invalid-types-ok
-
-invalid-types: invalid-types-ok
-
-$(eval $(call maketest,ngraphs,qcc))
-ngraphs:
-       @$(VM) $< > $@/output
-       @diff $@/output $@/expected
-
-invalid-assign-ok: obj invalid-assign/main.qc
-       @echo "Testing: invalid-assign"
-       @if $(QCC) -std=qcc -o obj/invalid.dat invalid-assign/main.qc > obj/invalid.out 2>&1 ; then echo "Successfully compiled a file which was supposed to fail: invalid-assign/main.qc" ; false ; else true ; fi
-
-invalid-assign: invalid-assign-ok
-
-$(eval $(call maketest,field-parameters,qcc))
-field-parameters:
-       @$(VM) $< > $@/output
-       @diff $@/output $@/expected
-
-$(eval $(call maketest,functions-as-parameters,qcc))
-functions-as-parameters:
-       @$(VM) $< > $@/output
-       @diff $@/output $@/expected
-
-$(eval $(call maketest,shadow-qcc,qcc))
-shadow-qcc:
-       @$(VM) -vector '33 44 55' $< > $@/output
-       @diff $@/output $@/expected
-
-$(eval $(call maketest,shadow-gmqcc,gm))
-shadow-gmqcc:
-       @$(VM) -vector '33 44 55' $< > $@/output
-       @diff $@/output $@/expected
-
-#######################################################################
-obj:
-       mkdir obj
-
-../gmqcc:
-       $(MAKE) -C ..
-
-../qcvm:
-       $(MAKE) -C .. qcvm
-
diff --git a/testsuite/builtins/main.qc b/testsuite/builtins/main.qc
deleted file mode 100644 (file)
index dd2013e..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-void(string) print = #1;
-
-void(string what) main = {
-    print(what);
-    print("\n");
-};
diff --git a/testsuite/calls/main.qc b/testsuite/calls/main.qc
deleted file mode 100644 (file)
index c6061e0..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-void(string, ...) print = #1;
-string(float)     ftos  = #2;
-
-float(float x, float y, float z) sum = {
-    return x + y + z;
-};
-
-void(float a, float b, float c) main = {
-    local float f;
-    f = sum(sum(a, sum(a, b, c), c),
-            sum(sum(sum(a, b, c), b, sum(a, b, c)), b, sum(a, b, sum(a, b, c))),
-            sum(sum(a, b, c), b, c));
-    print(ftos(f), "\n");
-};
diff --git a/testsuite/equality/0.1.expected b/testsuite/equality/0.1.expected
deleted file mode 100644 (file)
index 1356fb7..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-ne
-lt
-le
diff --git a/testsuite/equality/1.0.expected b/testsuite/equality/1.0.expected
deleted file mode 100644 (file)
index 6a3416e..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-ne
-gt
-ge
diff --git a/testsuite/equality/1.1.expected b/testsuite/equality/1.1.expected
deleted file mode 100644 (file)
index e332b2c..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-eq
-ge
-le
diff --git a/testsuite/equality/main.qc b/testsuite/equality/main.qc
deleted file mode 100644 (file)
index b21f8ff..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-void(string, ...) print = #1;
-string(float)     ftos  = #2;
-
-void(float a, float b) main = {
-    if (a == b) print("eq\n");
-    if (a != b) print("ne\n");
-    if (a >  b) print("gt\n");
-    if (a <  b) print("lt\n");
-    if (a >= b) print("ge\n");
-    if (a <= b) print("le\n");
-};
diff --git a/testsuite/field-parameters/expected b/testsuite/field-parameters/expected
deleted file mode 100644 (file)
index 5716ca5..0000000
+++ /dev/null
@@ -1 +0,0 @@
-bar
diff --git a/testsuite/field-parameters/main.qc b/testsuite/field-parameters/main.qc
deleted file mode 100644 (file)
index 86a31c6..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-void(string, string) print = #1;
-entity()             spawn = #3;
-
-.string a;
-.string b;
-
-void(entity e, .string s) callout = {
-       print(e.s, "\n");
-};
-
-void() main = {
-       local entity e;
-       e = spawn();
-       e.a = "foo";
-       e.b = "bar";
-       callout(e, b);
-};
diff --git a/testsuite/fielddefs/deflist.expected b/testsuite/fielddefs/deflist.expected
deleted file mode 100644 (file)
index 54ca670..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-Field:     void                  at 0
-Field:    float globf            at 0
-Field:   vector globv            at 1
-Field:   string globs            at 4
-Field: function globfunc         at 5
diff --git a/testsuite/fielddefs/main.qc b/testsuite/fielddefs/main.qc
deleted file mode 100644 (file)
index e2d2380..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-.float  globf;
-.vector globv;
-.string globs;
-.void() globfunc;
diff --git a/testsuite/fields1/expected b/testsuite/fields1/expected
deleted file mode 100644 (file)
index 585213f..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-spot1 = '150 2000 175'
-spot2 = '220 1300 -175'
-vis: 0
diff --git a/testsuite/fields1/main.qc b/testsuite/fields1/main.qc
deleted file mode 100644 (file)
index fc64743..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-void(string, ...) print = #1;
-string(float)     ftos  = #2;
-entity()          spawn = #3;
-string(vector)    vtos  = #5;
-void(string, ...) error = #6;
-
-entity self;
-
-.vector origin;
-.vector view;
-
-entity() make = {
-    local entity e;
-    e = spawn();
-    e.view = '0 0 25';
-    return e;
-};
-
-float(entity targ) visible = {
-    local vector spot1, spot2;
-    spot1 = self.origin + self.view;
-    spot2 = targ.origin + targ.view;
-
-    print("spot1 = ", vtos(spot1), "\n");
-    print("spot2 = ", vtos(spot2), "\n");
-    // This was part of some QC code which had a bug
-    // we don't actually return anything important here.
-    return 0;
-};
-
-void(vector a, vector b) main = {
-    local entity targ;
-
-    self = make();
-    targ = make();
-    if (self == targ)
-        error("ERROR, self == targ\n");
-
-    self.origin = a;
-    targ.origin = b;
-
-    print("vis: ", ftos(visible(targ)), "\n");
-};
diff --git a/testsuite/functions-as-parameters/expected b/testsuite/functions-as-parameters/expected
deleted file mode 100644 (file)
index 818e321..0000000
+++ /dev/null
@@ -1 +0,0 @@
-correct
diff --git a/testsuite/functions-as-parameters/main.qc b/testsuite/functions-as-parameters/main.qc
deleted file mode 100644 (file)
index 7790e64..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-void(string, string) print = #1;
-
-string() getter = {
-    return "correct";
-};
-
-void(string() f) printer = {
-    print(f(), "\n");
-};
-
-void() main = {
-    printer(getter);
-};
diff --git a/testsuite/globaldefs/deflist.expected b/testsuite/globaldefs/deflist.expected
deleted file mode 100644 (file)
index edee426..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-Global:     void                  at 0
-Global:    float globf            at 28
-Global:   vector globv            at 29
-Global:   string globs            at 32
-Global: function globfunc         at 33
diff --git a/testsuite/globaldefs/main.qc b/testsuite/globaldefs/main.qc
deleted file mode 100644 (file)
index 3cc2dc1..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-float  globf;
-vector globv;
-string globs;
-void() globfunc;
diff --git a/testsuite/if1/main.qc b/testsuite/if1/main.qc
deleted file mode 100644 (file)
index d3089ce..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-void(string, ...) print = #1;
-
-void(float c) main = {
-    if (c == 1)
-        print("One\n");
-    else if (c == 2)
-        print("Two\n");
-    else if (c == 3)
-        print("Three\n");
-    else
-        print("Else\n");
-};
diff --git a/testsuite/invalid-assign/main.qc b/testsuite/invalid-assign/main.qc
deleted file mode 100644 (file)
index 264ea5a..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-void() main = {
-       local float x;
-       x + 3 = 5;
-};
diff --git a/testsuite/invalid-types/assign.qc b/testsuite/invalid-types/assign.qc
deleted file mode 100644 (file)
index d884201..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-void() main = {
-       local float x;
-       local entity e;
-       x = e;
-};
diff --git a/testsuite/invalid-types/call1.qc b/testsuite/invalid-types/call1.qc
deleted file mode 100644 (file)
index 07d6217..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-void(float, string, entity) fun = #1;
-
-void() main = {
-       local float x;
-       fun(x, x, x);
-};
diff --git a/testsuite/invalid-types/call2.qc b/testsuite/invalid-types/call2.qc
deleted file mode 100644 (file)
index cb84fcd..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-void(float, string, entity) fun = #1;
-
-void() main = {
-       local string x;
-       fun(x, x, x);
-};
diff --git a/testsuite/invalid-types/call3.qc b/testsuite/invalid-types/call3.qc
deleted file mode 100644 (file)
index 4ad110b..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-void(float, string, entity) fun = #1;
-
-void() main = {
-       local entity x;
-       fun(x, x, x);
-};
diff --git a/testsuite/invalid-types/op.qc b/testsuite/invalid-types/op.qc
deleted file mode 100644 (file)
index bee4452..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-void() main = {
-       local float x, y;
-       local entity e;
-       x = y + e;
-};
diff --git a/testsuite/loops1/0.expected b/testsuite/loops1/0.expected
deleted file mode 100644 (file)
index bc0c271..0000000
+++ /dev/null
@@ -1 +0,0 @@
-do 0
diff --git a/testsuite/loops1/1.expected b/testsuite/loops1/1.expected
deleted file mode 100644 (file)
index 8220dfd..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-for 0
-while 0
-do 0
diff --git a/testsuite/loops1/10.expected b/testsuite/loops1/10.expected
deleted file mode 100644 (file)
index 3bfa4d2..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-for 0
-for 1
-for 2
-for 3
-for 4
-for 5
-for 6
-for 7
-for 8
-for 9
-while 0
-while 1
-while 2
-while 3
-while 4
-while 5
-while 6
-while 7
-while 8
-while 9
-do 0
-do 1
-do 2
-do 3
-do 4
-do 5
-do 6
-do 7
-do 8
-do 9
diff --git a/testsuite/loops1/4.expected b/testsuite/loops1/4.expected
deleted file mode 100644 (file)
index 18efd30..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-for 0
-for 1
-for 2
-for 3
-while 0
-while 1
-while 2
-while 3
-do 0
-do 1
-do 2
-do 3
diff --git a/testsuite/loops1/main.qc b/testsuite/loops1/main.qc
deleted file mode 100644 (file)
index 4b4dcea..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-void(string, ...) print = #1;
-string(float)     ftos  = #2;
-
-void(float n) main = {
-    local float i;
-
-    for (i = 0; i < n; i += 1) {
-        print("for ", ftos(i), "\n");
-    }
-
-    i = 0;
-    while (i < n) {
-        print("while ", ftos(i), "\n");
-        i += 1;
-    }
-
-    i = 0;
-    do {
-        print("do ", ftos(i), "\n");
-        i += 1;
-    } while (i < n);
-};
diff --git a/testsuite/maths1/0.0.expected b/testsuite/maths1/0.0.expected
deleted file mode 100644 (file)
index 2423970..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-input: 0 and 0
-+  0
-*  0
-/  0
-&  0
-|  0
-&& 0
-|| 0
diff --git a/testsuite/maths1/0.3.expected b/testsuite/maths1/0.3.expected
deleted file mode 100644 (file)
index dca5e6f..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-input: 0 and 3
-+  3
-*  0
-/  0
-&  0
-|  3
-&& 0
-|| 1
diff --git a/testsuite/maths1/3.6.expected b/testsuite/maths1/3.6.expected
deleted file mode 100644 (file)
index 370a09a..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-input: 3 and 6
-+  9
-*  18
-/  0.5
-&  2
-|  7
-&& 1
-|| 1
diff --git a/testsuite/maths1/main.qc b/testsuite/maths1/main.qc
deleted file mode 100644 (file)
index 58abf54..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-void(string, ...) print = #1;
-string(float)     ftos  = #2;
-string(vector)    vtos  = #5;
-
-void(float a, float b) main = {
-    print("input: ", ftos(a), " and ", ftos(b), "\n");
-    print("+  ", ftos(a+b),  "\n");
-    print("*  ", ftos(a*b),  "\n");
-    print("/  ", ftos(a/b),  "\n");
-    print("&  ", ftos(a&b),  "\n");
-    print("|  ", ftos(a|b),  "\n");
-    print("&& ", ftos(a&&b), "\n");
-    print("|| ", ftos(a||b), "\n");
-};
diff --git a/testsuite/maths2/main.qc b/testsuite/maths2/main.qc
deleted file mode 100644 (file)
index 4d8358f..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-void(string, ...) print = #1;
-string(float)     ftos  = #2;
-
-void(vector a, vector b) main = {
-    print("dot = ", ftos(a*b), "\n");
-};
diff --git a/testsuite/ngraphs/expected b/testsuite/ngraphs/expected
deleted file mode 100644 (file)
index d51a1ba..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-#^[]|{}~\%>
-#^[]|{}~\%>
diff --git a/testsuite/ngraphs/main.qc b/testsuite/ngraphs/main.qc
deleted file mode 100644 (file)
index ef2d38b..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-void(string, string) print = %:1;
-
-void() main = ??<
-       print("??=??'??(??)??!??<??>??-??/??/%>", "??/n");
-       print("#^[]|{}~\\%>", "\n");
-%>;
diff --git a/testsuite/shadow-gmqcc/expected b/testsuite/shadow-gmqcc/expected
deleted file mode 100644 (file)
index 89f4331..0000000
+++ /dev/null
@@ -1 +0,0 @@
-'0 0 0'
diff --git a/testsuite/shadow-gmqcc/main.qc b/testsuite/shadow-gmqcc/main.qc
deleted file mode 100644 (file)
index 08bc917..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-void(string, string) print = #1;
-string(vector) vtos = #5;
-
-void(vector org) main = {
-    local vector org;
-    print(vtos(org), "\n");
-};
diff --git a/testsuite/shadow-qcc/expected b/testsuite/shadow-qcc/expected
deleted file mode 100644 (file)
index 9ec2a0c..0000000
+++ /dev/null
@@ -1 +0,0 @@
-'33 44 55'
diff --git a/testsuite/shadow-qcc/main.qc b/testsuite/shadow-qcc/main.qc
deleted file mode 100644 (file)
index 08bc917..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-void(string, string) print = #1;
-string(vector) vtos = #5;
-
-void(vector org) main = {
-    local vector org;
-    print(vtos(org), "\n");
-};
diff --git a/testsuite/variadic/main.qc b/testsuite/variadic/main.qc
deleted file mode 100644 (file)
index 6c53eb2..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-void(string, ...) print = #1;
-
-void(string what) main = {
-    print(what, "\n");
-};
diff --git a/util.c b/util.c
index 77753a9be006d3add446d1a3bde7c9d9924091fc..a900889e57b90f983d776c44326e02935d9eee7b 100644 (file)
--- a/util.c
+++ b/util.c
@@ -521,6 +521,15 @@ FILE *util_fopen(const char *filename, const char *mode)
 #endif
 }
 
+bool util_filexists(const char *file) {
+    FILE *fp = fopen(file, "rb");
+    if  (!fp) return false;
+    
+    /* it exists */
+    fclose(fp);
+    return true;
+}
+
 void _util_vec_grow(void **a, size_t i, size_t s) {
     size_t m = *a ? 2*_vec_beg(*a)+i : i+1;
     void  *p = mem_r((*a ? _vec_raw(*a) : NULL), s * m + sizeof(size_t)*2);