Procházet zdrojové kódy

Moved preprocess tests to separate directory, tweaked some test configuration vars

Taddeus Kroes před 12 roky
rodič
revize
880b03d7a9

+ 7 - 2
Makefile

@@ -37,8 +37,13 @@ myclean:
 	rm -f a.out $(DIST_TGT)
 
 check: all
-	@cd test; CIVAS=../$(CIVAS) CIVVM=../$(CIVVM) CIVCC=../$(CIVCC) \
-		bash run.bash basic nested_funs arrays
+	@cd test; \
+		CIVAS=../$(CIVAS) \
+		CIVVM=../$(CIVVM) \
+		CIVCC=../$(CIVCC) \
+		CFLAGS="-v 1" \
+		RUN_FUNCTIONAL=1 \
+		bash run.bash basic preprocess nested_funs arrays
 
 dist: $(DIST_TGT)
 

+ 1 - 1
phases/typecheck.ml

@@ -53,7 +53,7 @@ let op_types = function
 
 let op_result_type opnd_type = function
   | Not | And | Or | Eq | Ne | Lt | Le | Gt | Ge -> Bool
-  | Neg | Add | Sub | Mul | Div | Mod      -> opnd_type
+  | Neg | Add | Sub | Mul | Div | Mod            -> opnd_type
 
 (* Check if the given operator can be applied to the given type *)
 let check_type_op allowed_types desc node =

+ 3 - 0
test/basic/check_error/invalid_vardec_type.cvc

@@ -0,0 +1,3 @@
+void foo() {
+    void a;
+}

+ 0 - 25
test/basic/functional/array_init.cvc

@@ -1,25 +0,0 @@
-extern void printInt(int val);
-extern void printNewlines(int num);
-
-export int main() {
-    int[2,3] a = [[1,2,3], [4,5,6]];
-    int[2,3] b = 7;
-
-    for(int i=0,2) {
-        for(int j=0,3) {
-            printInt(a[i,j]);
-            printNewlines(1);
-        }
-    }
-
-    printNewlines(1);
-
-    for(int i=0,2) {
-        for(int j=0,3) {
-            printInt(b[i,j]);
-            printNewlines(1);
-        }
-    }
-
-    return 0;
-}

+ 0 - 13
test/basic/functional/array_init.out

@@ -1,13 +0,0 @@
-1
-2
-3
-4
-5
-6
-
-7
-7
-7
-7
-7
-7

+ 0 - 73
test/basic/functional/array_single_eval.cvc

@@ -1,73 +0,0 @@
-extern void printInt(int val);
-extern void printSpaces(int num);
-extern void printNewlines(int num);
-
-int ones = 0;
-int twos = 0;
-
-int one() {
-    ones = ones + 1;
-    return 1;
-}
-
-int two() {
-    twos = twos + 1;
-    return 2;
-}
-
-void printArray1D(int[n] a) {
-    for (int i = 0, n) {
-        printInt(a[i]);
-        if (i != n - 1) printSpaces(1);
-    }
-    printNewlines(1);
-}
-
-void printArray2D(int[n, m] a) {
-    for (int i = 0, n) {
-        for (int j = 0, m) {
-            printInt(a[i, j]);
-            if (j != m - 1) printSpaces(1);
-        }
-        printNewlines(1);
-    }
-}
-
-void printArray3D(int[n, m, o] a) {
-    for (int i = 0, n) {
-        for (int j = 0, m) {
-            for (int k = 0, o) {
-                printInt(a[i, j, k]);
-                if (k != o - 1) printSpaces(1);
-            }
-            if (j != m - 1) printSpaces(2);
-        }
-        printNewlines(1);
-    }
-}
-
-export int main() {
-    int[two()] a        = one();
-    int[two(), two()] b = [[1, one()], [2, two()]];
-    int[2, 3] c         = [one(), two()];
-    int[2, 3, 3] d      = [one(), two()];
-
-    printArray1D(a);
-    printNewlines(1);
-
-    printArray2D(b);
-    printNewlines(1);
-
-    printArray2D(c);
-    printNewlines(1);
-
-    printArray3D(d);
-    printNewlines(1);
-
-    printInt(ones);
-    printSpaces(1);
-    printInt(twos);
-    printNewlines(1);
-
-    return 0;
-}

+ 0 - 12
test/basic/functional/array_single_eval.out

@@ -1,12 +0,0 @@
-1 1
-
-1 1
-2 2
-
-1 1 1
-2 2 2
-
-1 1 1  1 1 1  1 1 1
-2 2 2  2 2 2  2 2 2
-
-4 6

+ 0 - 0
test/basic/check_success/preprocess.cvc → test/preprocess/check_success/preprocess.cvc


+ 0 - 0
test/basic/functional/preprocess.cvc → test/preprocess/functional/preprocess.cvc


+ 0 - 0
test/basic/functional/preprocess.out → test/preprocess/functional/preprocess.out


+ 10 - 8
test/run.bash

@@ -1,8 +1,8 @@
 #!/usr/bin/env bash
 CIVAS=${CIVAS-../bin32/civas}
 CIVVM=${CIVVM-../bin32/civvm}
-CIVCC=${CIVCC-../civicc}
-CFLAGS="-v 1"
+CIVCC=${CIVCC-../bin/civicc}
+CFLAGS=${CFLAGS-}
 
 ALIGN=52
 
@@ -146,13 +146,15 @@ function run_dir {
         check_return $f 1
     done
 
-    for f in $BASE/functional/*.cvc; do
-        check_output $f
-    done
+    if [ ${RUN_FUNCTIONAL-1} -eq 1 ]; then
+        for f in $BASE/functional/*.cvc; do
+            check_output $f
+        done
 
-    for d in $BASE/combined_*; do
-        check_combined $d
-    done
+        for d in $BASE/combined_*; do
+            check_combined $d
+        done
+    fi
 
     echo
 }