summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAlex AUVOLAT <alexis211@gmail.com>2013-10-29 17:42:34 +0100
committerAlex AUVOLAT <alexis211@gmail.com>2013-10-29 17:42:34 +0100
commit8f1093f0e00f9b1df7ce343a879303fd56a95d08 (patch)
tree6aaf0720c2093ba05cb81ba7f95b4e9808b3ecab /tests
downloadLPC-Projet-8f1093f0e00f9b1df7ce343a879303fd56a95d08.tar.gz
LPC-Projet-8f1093f0e00f9b1df7ce343a879303fd56a95d08.zip
First commit.
Diffstat (limited to 'tests')
-rw-r--r--tests/LISEZMOI18
-rw-r--r--tests/exec/ABR.cpp60
-rw-r--r--tests/exec/ABR.out3
-rw-r--r--tests/exec/Makefile6
-rw-r--r--tests/exec/address1.cpp11
-rw-r--r--tests/exec/address1.out3
-rw-r--r--tests/exec/address2.cpp12
-rw-r--r--tests/exec/address2.out2
-rw-r--r--tests/exec/address3.cpp14
-rw-r--r--tests/exec/address3.out3
-rw-r--r--tests/exec/affect.cpp12
-rw-r--r--tests/exec/affect.out2
-rw-r--r--tests/exec/arith1.cpp14
-rw-r--r--tests/exec/arith1.out5
-rw-r--r--tests/exec/bst.cpp101
-rw-r--r--tests/exec/bst.out4
-rw-r--r--tests/exec/for1.cpp7
-rw-r--r--tests/exec/for1.out10
-rw-r--r--tests/exec/for2.cpp8
-rw-r--r--tests/exec/for2.out11
-rw-r--r--tests/exec/for3.cpp11
-rw-r--r--tests/exec/for3.out27
-rw-r--r--tests/exec/global.cpp14
-rw-r--r--tests/exec/global.out3
-rw-r--r--tests/exec/hexa.cpp15
-rw-r--r--tests/exec/hexa.out7
-rw-r--r--tests/exec/inheritance1.cpp30
-rw-r--r--tests/exec/inheritance1.out4
-rw-r--r--tests/exec/inheritance2.cpp26
-rw-r--r--tests/exec/inheritance2.out2
-rw-r--r--tests/exec/josephus.cpp101
-rw-r--r--tests/exec/josephus.out6
-rw-r--r--tests/exec/mandelbrot.cpp60
-rw-r--r--tests/exec/mandelbrot.out30
-rw-r--r--tests/exec/octal.cpp13
-rw-r--r--tests/exec/octal.out6
-rw-r--r--tests/exec/pascal.cpp62
-rw-r--r--tests/exec/pascal.out42
-rw-r--r--tests/exec/passing.cpp13
-rw-r--r--tests/exec/passing.out2
-rw-r--r--tests/exec/prepost1.cpp14
-rw-r--r--tests/exec/prepost1.out5
-rw-r--r--tests/exec/ref1.cpp8
-rw-r--r--tests/exec/ref1.out1
-rw-r--r--tests/exec/ref2.cpp14
-rw-r--r--tests/exec/ref2.out3
-rw-r--r--tests/exec/ref3.cpp18
-rw-r--r--tests/exec/ref3.out5
-rw-r--r--tests/exec/ref4.cpp16
-rw-r--r--tests/exec/ref4.out4
-rw-r--r--tests/exec/ref5.cpp29
-rw-r--r--tests/exec/ref5.out13
-rw-r--r--tests/exec/ref6.cpp20
-rw-r--r--tests/exec/ref6.out8
-rw-r--r--tests/exec/string.cpp10
-rw-r--r--tests/exec/string.out7
-rw-r--r--tests/exec/true_false.cpp8
-rw-r--r--tests/exec/true_false.out2
-rw-r--r--tests/exec/vehicles.cpp78
-rw-r--r--tests/exec/vehicles.out10
-rw-r--r--tests/syntax/bad/testfile-bad_hexa-1.cpp1
-rw-r--r--tests/syntax/bad/testfile-bad_ident1-1.cpp1
-rw-r--r--tests/syntax/bad/testfile-bad_ident2-1.cpp1
-rw-r--r--tests/syntax/bad/testfile-bad_octal-1.cpp1
-rw-r--r--tests/syntax/bad/testfile-block1-1.cpp1
-rw-r--r--tests/syntax/bad/testfile-block2-1.cpp1
-rw-r--r--tests/syntax/bad/testfile-expr1-1.cpp1
-rw-r--r--tests/syntax/bad/testfile-expr10-1.cpp1
-rw-r--r--tests/syntax/bad/testfile-expr11-1.cpp1
-rw-r--r--tests/syntax/bad/testfile-expr2-1.cpp1
-rw-r--r--tests/syntax/bad/testfile-expr3-1.cpp1
-rw-r--r--tests/syntax/bad/testfile-expr4-1.cpp1
-rw-r--r--tests/syntax/bad/testfile-expr6-1.cpp1
-rw-r--r--tests/syntax/bad/testfile-expr7-1.cpp1
-rw-r--r--tests/syntax/bad/testfile-expr8-1.cpp1
-rw-r--r--tests/syntax/bad/testfile-expr9-1.cpp1
-rw-r--r--tests/syntax/bad/testfile-for1-1.cpp1
-rw-r--r--tests/syntax/bad/testfile-for2-1.cpp1
-rw-r--r--tests/syntax/bad/testfile-for3-1.cpp1
-rw-r--r--tests/syntax/bad/testfile-for4-1.cpp1
-rw-r--r--tests/syntax/bad/testfile-for5-1.cpp1
-rw-r--r--tests/syntax/bad/testfile-for6-1.cpp1
-rw-r--r--tests/syntax/bad/testfile-for7-1.cpp1
-rw-r--r--tests/syntax/bad/testfile-for8-1.cpp1
-rw-r--r--tests/syntax/bad/testfile-if1-1.cpp1
-rw-r--r--tests/syntax/bad/testfile-if2-1.cpp1
-rw-r--r--tests/syntax/bad/testfile-if3-1.cpp1
-rw-r--r--tests/syntax/bad/testfile-if_else-1.cpp1
-rw-r--r--tests/syntax/bad/testfile-illegal_char-1.cpp1
-rw-r--r--tests/syntax/bad/testfile-illegal_char-2.cpp2
-rw-r--r--tests/syntax/bad/testfile-instr_decl1-1.cpp1
-rw-r--r--tests/syntax/bad/testfile-instr_expr-1.cpp1
-rw-r--r--tests/syntax/bad/testfile-keyword1-1.cpp1
-rw-r--r--tests/syntax/bad/testfile-lexer_hack-1.cpp2
-rw-r--r--tests/syntax/bad/testfile-lexer_hack-2.cpp3
-rw-r--r--tests/syntax/bad/testfile-lexing1-1.cpp1
-rw-r--r--tests/syntax/bad/testfile-lexing2-1.cpp2
-rw-r--r--tests/syntax/bad/testfile-lexing3-1.cpp1
-rw-r--r--tests/syntax/bad/testfile-lexing4-1.cpp1
-rw-r--r--tests/syntax/bad/testfile-lexing5-1.cpp1
-rw-r--r--tests/syntax/bad/testfile-lexing6-1.cpp1
-rw-r--r--tests/syntax/bad/testfile-newline_in_string-1.cpp5
-rw-r--r--tests/syntax/bad/testfile-parameters2-1.cpp1
-rw-r--r--tests/syntax/bad/testfile-quotes_in_string-1.cpp3
-rw-r--r--tests/syntax/bad/testfile-return1-1.cpp1
-rw-r--r--tests/syntax/bad/testfile-unclosed_comment-1.cpp1
-rw-r--r--tests/syntax/bad/testfile-unclosed_escaped_string-1.cpp3
-rw-r--r--tests/syntax/bad/testfile-unclosed_string-1.cpp4
-rw-r--r--tests/syntax/bad/testfile-var2-1.cpp1
-rw-r--r--tests/syntax/good/testfile-assign-1.cpp1
-rw-r--r--tests/syntax/good/testfile-compare-1.cpp1
-rw-r--r--tests/syntax/good/testfile-for-1.cpp2
-rw-r--r--tests/typing/bad/testfile-ampersand-1.cpp1
-rw-r--r--tests/typing/bad/testfile-ampersand-2.cpp2
-rw-r--r--tests/typing/bad/testfile-ampersand-3.cpp4
-rw-r--r--tests/typing/bad/testfile-arith-1.cpp2
-rw-r--r--tests/typing/bad/testfile-arith-2.cpp3
-rw-r--r--tests/typing/bad/testfile-arith-3.cpp2
-rw-r--r--tests/typing/bad/testfile-arith-4.cpp3
-rw-r--r--tests/typing/bad/testfile-arith-5.cpp2
-rw-r--r--tests/typing/bad/testfile-arith-6.cpp3
-rw-r--r--tests/typing/bad/testfile-arrow-1.cpp1
-rw-r--r--tests/typing/bad/testfile-arrow-2.cpp2
-rw-r--r--tests/typing/bad/testfile-arrow-3.cpp3
-rw-r--r--tests/typing/bad/testfile-arrow-4.cpp3
-rw-r--r--tests/typing/bad/testfile-arrow-5.cpp5
-rw-r--r--tests/typing/bad/testfile-assign-1.cpp1
-rw-r--r--tests/typing/bad/testfile-assign-10.cpp2
-rw-r--r--tests/typing/bad/testfile-assign-11.cpp3
-rw-r--r--tests/typing/bad/testfile-assign-12.cpp2
-rw-r--r--tests/typing/bad/testfile-assign-13.cpp2
-rw-r--r--tests/typing/bad/testfile-assign-14.cpp2
-rw-r--r--tests/typing/bad/testfile-assign-15.cpp3
-rw-r--r--tests/typing/bad/testfile-assign-16.cpp2
-rw-r--r--tests/typing/bad/testfile-assign-17.cpp2
-rw-r--r--tests/typing/bad/testfile-assign-18.cpp2
-rw-r--r--tests/typing/bad/testfile-assign-19.cpp3
-rw-r--r--tests/typing/bad/testfile-assign-2.cpp2
-rw-r--r--tests/typing/bad/testfile-assign-20.cpp2
-rw-r--r--tests/typing/bad/testfile-assign-21.cpp2
-rw-r--r--tests/typing/bad/testfile-assign-22.cpp2
-rw-r--r--tests/typing/bad/testfile-assign-23.cpp3
-rw-r--r--tests/typing/bad/testfile-assign-24.cpp2
-rw-r--r--tests/typing/bad/testfile-assign-25.cpp2
-rw-r--r--tests/typing/bad/testfile-assign-26.cpp4
-rw-r--r--tests/typing/bad/testfile-assign-27.cpp1
-rw-r--r--tests/typing/bad/testfile-assign-28.cpp3
-rw-r--r--tests/typing/bad/testfile-assign-29.cpp3
-rw-r--r--tests/typing/bad/testfile-assign-3.cpp2
-rw-r--r--tests/typing/bad/testfile-assign-30.cpp3
-rw-r--r--tests/typing/bad/testfile-assign-31.cpp4
-rw-r--r--tests/typing/bad/testfile-assign-4.cpp3
-rw-r--r--tests/typing/bad/testfile-assign-5.cpp3
-rw-r--r--tests/typing/bad/testfile-assign-6.cpp3
-rw-r--r--tests/typing/bad/testfile-assign-7.cpp4
-rw-r--r--tests/typing/bad/testfile-assign-8.cpp4
-rw-r--r--tests/typing/bad/testfile-assign-9.cpp1
-rw-r--r--tests/typing/bad/testfile-bang-1.cpp2
-rw-r--r--tests/typing/bad/testfile-bang-2.cpp4
-rw-r--r--tests/typing/bad/testfile-call-1.cpp2
-rw-r--r--tests/typing/bad/testfile-call-2.cpp5
-rw-r--r--tests/typing/bad/testfile-class-1.cpp1
-rw-r--r--tests/typing/bad/testfile-class-2.cpp3
-rw-r--r--tests/typing/bad/testfile-comparison-1.cpp2
-rw-r--r--tests/typing/bad/testfile-comparison-2.cpp3
-rw-r--r--tests/typing/bad/testfile-comparison-3.cpp3
-rw-r--r--tests/typing/bad/testfile-comparison-4.cpp3
-rw-r--r--tests/typing/bad/testfile-comparison-5.cpp3
-rw-r--r--tests/typing/bad/testfile-comparison-6.cpp4
-rw-r--r--tests/typing/bad/testfile-deref-1.cpp1
-rw-r--r--tests/typing/bad/testfile-deref-2.cpp2
-rw-r--r--tests/typing/bad/testfile-deref-3.cpp4
-rw-r--r--tests/typing/bad/testfile-field-1.cpp1
-rw-r--r--tests/typing/bad/testfile-field-2.cpp2
-rw-r--r--tests/typing/bad/testfile-field-3.cpp3
-rw-r--r--tests/typing/bad/testfile-field-4.cpp3
-rw-r--r--tests/typing/bad/testfile-field-5.cpp3
-rw-r--r--tests/typing/bad/testfile-field-6.cpp3
-rw-r--r--tests/typing/bad/testfile-field-7.cpp5
-rw-r--r--tests/typing/bad/testfile-for-1.cpp2
-rw-r--r--tests/typing/bad/testfile-for-2.cpp4
-rw-r--r--tests/typing/bad/testfile-global-1.cpp3
-rw-r--r--tests/typing/bad/testfile-if-1.cpp2
-rw-r--r--tests/typing/bad/testfile-if-2.cpp4
-rw-r--r--tests/typing/bad/testfile-local-1.cpp2
-rw-r--r--tests/typing/bad/testfile-redef-1.cpp2
-rw-r--r--tests/typing/bad/testfile-redef-2.cpp4
-rw-r--r--tests/typing/bad/testfile-redef-3.cpp4
-rw-r--r--tests/typing/bad/testfile-redef-4.cpp4
-rw-r--r--tests/typing/bad/testfile-redef-5.cpp2
-rw-r--r--tests/typing/bad/testfile-redef-6.cpp3
-rw-r--r--tests/typing/bad/testfile-ref-1.cpp1
-rw-r--r--tests/typing/bad/testfile-ref-2.cpp3
-rw-r--r--tests/typing/bad/testfile-return-1.cpp3
-rw-r--r--tests/typing/bad/testfile-return-2.cpp4
-rw-r--r--tests/typing/bad/testfile-return-3.cpp4
-rw-r--r--tests/typing/bad/testfile-scope-1.cpp1
-rw-r--r--tests/typing/bad/testfile-scope-2.cpp3
-rw-r--r--tests/typing/bad/testfile-undef_var-1.cpp1
-rw-r--r--tests/typing/bad/testfile-undef_var-2.cpp3
-rw-r--r--tests/typing/bad/testfile-undef_var-3.cpp4
-rw-r--r--tests/typing/bad/testfile-while-1.cpp2
-rw-r--r--tests/typing/bad/testfile-while-2.cpp4
-rw-r--r--tests/typing/good/testfile-subtype-1.cpp5
204 files changed, 1371 insertions, 0 deletions
diff --git a/tests/LISEZMOI b/tests/LISEZMOI
new file mode 100644
index 0000000..6ee526d
--- /dev/null
+++ b/tests/LISEZMOI
@@ -0,0 +1,18 @@
+
+Les tests sont organisés en différentes catégories :
+
+ syntax/bad/ refusés à l'analyse lexicale ou syntaxique
+ typing/bad/ refusés à l'analyse sémantique
+ typing/good/ acceptés à l'analyse sémantique
+ exec-fail/ compilés avec succès mais l'exécution du code MIPS doit échouer
+ exec/ compilés et exécutés avec succès, le résultat attendu étant
+ conforme au fichier .out
+
+Les tests sont cumulatifs i.e.
+
+- les fichiers de typing/bad/, exec-fail/ et exec/ peuvent être
+ utilisés pour la catégorie syntax/good/
+
+- les fichiers de exec-fail/ et exec/ peuvent être
+ utilisés pour la catégorie typing/good/
+
diff --git a/tests/exec/ABR.cpp b/tests/exec/ABR.cpp
new file mode 100644
index 0000000..979ff4b
--- /dev/null
+++ b/tests/exec/ABR.cpp
@@ -0,0 +1,60 @@
+#include <iostream>
+
+/* arbres binaires de recherche */
+
+class ABR {
+public:
+ int valeur;
+ ABR *gauche;
+ ABR *droite;
+ ABR(ABR *g, int v, ABR *d);
+ void insere(int x);
+ int contient(int x);
+ void affiche();
+};
+
+ABR::ABR(ABR *g, int v, ABR *d) { valeur = v; gauche = g; droite = d; }
+
+void ABR::insere(int x) {
+ if (x == valeur) return;
+ if (x < valeur) {
+ if (gauche == NULL)
+ gauche = new ABR(NULL, x, NULL);
+ else
+ gauche->insere(x);
+ } else
+ if (droite == NULL)
+ droite = new ABR(NULL, x, NULL);
+ else
+ droite->insere(x);
+}
+
+int ABR::contient(int x) {
+ if (x == valeur) return true;
+ if (x < valeur && gauche != NULL) return gauche->contient(x);
+ if (droite != NULL) return droite->contient(x);
+ return false;
+}
+
+void ABR::affiche() {
+ if (gauche != NULL) gauche->affiche();
+ std::cout << "(" << valeur << ")";
+ if (droite != NULL) droite->affiche();
+}
+
+
+int main() {
+ ABR dico = ABR(NULL, 1, NULL);
+ dico.insere(17);
+ dico.insere(5);
+ dico.insere(8);
+ dico.affiche(); std::cout << "\n";
+
+ if (dico.contient(5) &&
+ ! dico.contient(0) &&
+ dico.contient(17) &&
+ ! dico.contient(3))
+ std::cout << "ok\n";
+
+ dico.affiche(); std::cout << "\n";
+}
diff --git a/tests/exec/ABR.out b/tests/exec/ABR.out
new file mode 100644
index 0000000..8855386
--- /dev/null
+++ b/tests/exec/ABR.out
@@ -0,0 +1,3 @@
+(1)(5)(8)(17)
+ok
+(1)(5)(8)(17)
diff --git a/tests/exec/Makefile b/tests/exec/Makefile
new file mode 100644
index 0000000..b260ba0
--- /dev/null
+++ b/tests/exec/Makefile
@@ -0,0 +1,6 @@
+
+%: %.cpp
+ g++ -o $@ $^
+ ./$@
+ ./$@ > $*.out
+
diff --git a/tests/exec/address1.cpp b/tests/exec/address1.cpp
new file mode 100644
index 0000000..fe70014
--- /dev/null
+++ b/tests/exec/address1.cpp
@@ -0,0 +1,11 @@
+#include <iostream>
+
+int main() {
+ int x = 41;
+ std::cout << "x = " << x << "\n";
+ int *y = &x;
+ *y = 42;
+ std::cout << "x = " << x << "\n";
+ *y = *y + 1;
+ std::cout << "x = " << x << "\n";
+}
diff --git a/tests/exec/address1.out b/tests/exec/address1.out
new file mode 100644
index 0000000..4202a65
--- /dev/null
+++ b/tests/exec/address1.out
@@ -0,0 +1,3 @@
+x = 41
+x = 42
+x = 43
diff --git a/tests/exec/address2.cpp b/tests/exec/address2.cpp
new file mode 100644
index 0000000..75c2c4f
--- /dev/null
+++ b/tests/exec/address2.cpp
@@ -0,0 +1,12 @@
+#include <iostream>
+
+void f(int *y) {
+ *y = 42;
+}
+
+int main() {
+ int x = 41;
+ std::cout << "x = " << x << "\n";
+ f(&x);
+ std::cout << "x = " << x << "\n";
+}
diff --git a/tests/exec/address2.out b/tests/exec/address2.out
new file mode 100644
index 0000000..8b53391
--- /dev/null
+++ b/tests/exec/address2.out
@@ -0,0 +1,2 @@
+x = 41
+x = 42
diff --git a/tests/exec/address3.cpp b/tests/exec/address3.cpp
new file mode 100644
index 0000000..3917dc1
--- /dev/null
+++ b/tests/exec/address3.cpp
@@ -0,0 +1,14 @@
+#include <iostream>
+
+void f(int *y) {
+ *y = *y + 1;
+}
+
+int main() {
+ int x = 41;
+ std::cout << "x = " << x << "\n";
+ f(&x);
+ std::cout << "x = " << x << "\n";
+ f(&x);
+ std::cout << "x = " << x << "\n";
+}
diff --git a/tests/exec/address3.out b/tests/exec/address3.out
new file mode 100644
index 0000000..4202a65
--- /dev/null
+++ b/tests/exec/address3.out
@@ -0,0 +1,3 @@
+x = 41
+x = 42
+x = 43
diff --git a/tests/exec/affect.cpp b/tests/exec/affect.cpp
new file mode 100644
index 0000000..fd65fd1
--- /dev/null
+++ b/tests/exec/affect.cpp
@@ -0,0 +1,12 @@
+#include <iostream>
+
+int main() {
+ int x = 0;
+ int y = 0;
+ x = ++y;
+ y = ++y + ++x;
+ y++;
+ x = --x + y;
+ std::cout << "x=" << x << "\n";
+ std::cout << "y=" << y << "\n";
+}
diff --git a/tests/exec/affect.out b/tests/exec/affect.out
new file mode 100644
index 0000000..a6e2f7b
--- /dev/null
+++ b/tests/exec/affect.out
@@ -0,0 +1,2 @@
+x=6
+y=5
diff --git a/tests/exec/arith1.cpp b/tests/exec/arith1.cpp
new file mode 100644
index 0000000..2280f76
--- /dev/null
+++ b/tests/exec/arith1.cpp
@@ -0,0 +1,14 @@
+#include <iostream>
+
+int main() {
+ int x = 41;
+ std::cout << "x = " << x << "\n";
+ x = x+1;
+ std::cout << "x = " << x << "\n";
+ x = 2*x;
+ std::cout << "x = " << x << "\n";
+ x = 2*x + 3;
+ std::cout << "x = " << x << "\n";
+ x = 1 - 2*x;
+ std::cout << "x = " << x << "\n";
+}
diff --git a/tests/exec/arith1.out b/tests/exec/arith1.out
new file mode 100644
index 0000000..a397f16
--- /dev/null
+++ b/tests/exec/arith1.out
@@ -0,0 +1,5 @@
+x = 41
+x = 42
+x = 84
+x = 171
+x = -341
diff --git a/tests/exec/bst.cpp b/tests/exec/bst.cpp
new file mode 100644
index 0000000..e5ccce8
--- /dev/null
+++ b/tests/exec/bst.cpp
@@ -0,0 +1,101 @@
+
+#include <iostream>
+
+// arbres binaires, où l'arbre vide est NULL
+
+class Node {
+public:
+ int elt;
+ Node *left, *right;
+ Node(Node *left, int elt, Node *right);
+};
+
+Node::Node(Node *left, int elt, Node *right) {
+ this->left = left;
+ this->elt = elt;
+ this->right = right;
+}
+
+int tree_size(Node *t) {
+ if (t == NULL) return 0;
+ return 1 + tree_size(t->left) + tree_size(t->right);
+}
+
+Node *tree_add(Node *t, int x) {
+ if (t == NULL) return new Node(NULL, x, NULL);
+ if (x < t->elt) t->left = tree_add(t->left, x);
+ else if (x > t->elt) t->right = tree_add(t->right, x);
+ return t;
+}
+
+void tree_add_ref(Node* &t, int x) {
+ if (t == NULL ) t = new Node(NULL, x, NULL);
+ else if (x < t->elt) tree_add_ref(t->left, x);
+ else if (x > t->elt) tree_add_ref(t->right, x);
+}
+
+void tree_print(Node *t) {
+ if (t == NULL) return;
+ std::cout << "(";
+ tree_print(t->left);
+ std::cout << t->elt;
+ tree_print(t->right);
+ std::cout << ")";
+}
+
+
+// encapsulation dans une classe
+
+class BST {
+public:
+ Node *root;
+ BST();
+ int size();
+ void add1(int x);
+ void add2(int x);
+ void print();
+};
+
+BST::BST() {
+ this->root = NULL;
+}
+
+int BST::size() {
+ return tree_size(this->root);
+}
+
+void BST::add1(int x) {
+ this->root = tree_add(this->root, x);
+}
+
+void BST::add2(int x) {
+ tree_add_ref(this->root, x);
+}
+
+void BST::print() {
+ tree_print(this->root);
+ std::cout << std::endl;
+}
+
+
+// tests
+
+int main() {
+ BST t;
+ t.add1(2);
+ t.add2(3);
+ t.add1(1);
+ t.print();
+ t.add2(7);
+ t.add1(0);
+ t.print();
+ BST *u = new BST();
+ int i;
+ for (i = 0; i < 10; i++)
+ u->add1((31 * i) % 7);
+ u->print();
+ for (i = 0; i < 10; i++)
+ u->add2((29 * i) % 13);
+ u->print();
+ return 0;
+}
diff --git a/tests/exec/bst.out b/tests/exec/bst.out
new file mode 100644
index 0000000..2795607
--- /dev/null
+++ b/tests/exec/bst.out
@@ -0,0 +1,4 @@
+((1)2(3))
+(((0)1)2(3(7)))
+(0(((1)2)3(((4)5)6)))
+(0(((1)2)3(((4)5)6((8)9((11)12)))))
diff --git a/tests/exec/for1.cpp b/tests/exec/for1.cpp
new file mode 100644
index 0000000..3ac56de
--- /dev/null
+++ b/tests/exec/for1.cpp
@@ -0,0 +1,7 @@
+#include <iostream>
+
+int main() {
+ int i;
+ for (i = 0; i < 10; i++)
+ std::cout << "i = " << i << "\n";
+}
diff --git a/tests/exec/for1.out b/tests/exec/for1.out
new file mode 100644
index 0000000..dc59d9b
--- /dev/null
+++ b/tests/exec/for1.out
@@ -0,0 +1,10 @@
+i = 0
+i = 1
+i = 2
+i = 3
+i = 4
+i = 5
+i = 6
+i = 7
+i = 8
+i = 9
diff --git a/tests/exec/for2.cpp b/tests/exec/for2.cpp
new file mode 100644
index 0000000..65ce735
--- /dev/null
+++ b/tests/exec/for2.cpp
@@ -0,0 +1,8 @@
+#include <iostream>
+
+int main() {
+ int i;
+ for (i = 0; i < 10; i++)
+ std::cout << "i = " << i << "\n";
+ std::cout << "i = " << i << "\n";
+}
diff --git a/tests/exec/for2.out b/tests/exec/for2.out
new file mode 100644
index 0000000..2bcca9c
--- /dev/null
+++ b/tests/exec/for2.out
@@ -0,0 +1,11 @@
+i = 0
+i = 1
+i = 2
+i = 3
+i = 4
+i = 5
+i = 6
+i = 7
+i = 8
+i = 9
+i = 10
diff --git a/tests/exec/for3.cpp b/tests/exec/for3.cpp
new file mode 100644
index 0000000..3df619c
--- /dev/null
+++ b/tests/exec/for3.cpp
@@ -0,0 +1,11 @@
+#include <iostream>
+
+int main() {
+ int i;
+ int j;
+ for (i = 0; i < 5; i++)
+ for (j = 0; j < 5; j++)
+ std::cout << "i*j = " << i*j << "\n";
+ std::cout << "i = " << i << "\n";
+ std::cout << "j = " << j << "\n";
+}
diff --git a/tests/exec/for3.out b/tests/exec/for3.out
new file mode 100644
index 0000000..6ed4dd6
--- /dev/null
+++ b/tests/exec/for3.out
@@ -0,0 +1,27 @@
+i*j = 0
+i*j = 0
+i*j = 0
+i*j = 0
+i*j = 0
+i*j = 0
+i*j = 1
+i*j = 2
+i*j = 3
+i*j = 4
+i*j = 0
+i*j = 2
+i*j = 4
+i*j = 6
+i*j = 8
+i*j = 0
+i*j = 3
+i*j = 6
+i*j = 9
+i*j = 12
+i*j = 0
+i*j = 4
+i*j = 8
+i*j = 12
+i*j = 16
+i = 5
+j = 5
diff --git a/tests/exec/global.cpp b/tests/exec/global.cpp
new file mode 100644
index 0000000..8a32a23
--- /dev/null
+++ b/tests/exec/global.cpp
@@ -0,0 +1,14 @@
+#include <iostream>
+
+int x, *p;
+
+int main() {
+ x = 41;
+ std::cout << x << "\n";
+ p = &x;
+ *p = *p + 1;
+ std::cout << x << "\n";
+ int &r = x;
+ r = r + 1;
+ std::cout << x << "\n";
+}
diff --git a/tests/exec/global.out b/tests/exec/global.out
new file mode 100644
index 0000000..f91de27
--- /dev/null
+++ b/tests/exec/global.out
@@ -0,0 +1,3 @@
+41
+42
+43
diff --git a/tests/exec/hexa.cpp b/tests/exec/hexa.cpp
new file mode 100644
index 0000000..70feac9
--- /dev/null
+++ b/tests/exec/hexa.cpp
@@ -0,0 +1,15 @@
+#include <iostream>
+
+int main() {
+ std::cout << 0x100 << "\n";
+ std::cout << 0xff << "\n";
+ std::cout << 0xFF << "\n";
+ int maxint = 0x7fffffff;
+ std::cout << maxint << "\n";
+ int x = 0xDEADBEEF;
+ std::cout << x << "\n";
+ x = 0xFFFFFFFF;
+ std::cout << x << "\n";
+ x = 0x80000000;
+ std::cout << x << "\n";
+}
diff --git a/tests/exec/hexa.out b/tests/exec/hexa.out
new file mode 100644
index 0000000..2a5b25b
--- /dev/null
+++ b/tests/exec/hexa.out
@@ -0,0 +1,7 @@
+256
+255
+255
+2147483647
+-559038737
+-1
+-2147483648
diff --git a/tests/exec/inheritance1.cpp b/tests/exec/inheritance1.cpp
new file mode 100644
index 0000000..8a2c1e7
--- /dev/null
+++ b/tests/exec/inheritance1.cpp
@@ -0,0 +1,30 @@
+#include <iostream>
+
+class A {
+public:
+ virtual void f();
+};
+
+class B : public A {
+public:
+ void f();
+};
+
+void A::f() {
+ std::cout << "this is A::f" << "\n";
+}
+
+void B::f() {
+ std::cout << "this is B::f" << "\n";
+}
+
+int main() {
+ A a;
+ a.f();
+ B b;
+ b.f();
+ A *x = &b;
+ x->f();
+ x = &a;
+ x->f();
+}
diff --git a/tests/exec/inheritance1.out b/tests/exec/inheritance1.out
new file mode 100644
index 0000000..bb94fe2
--- /dev/null
+++ b/tests/exec/inheritance1.out
@@ -0,0 +1,4 @@
+this is A::f
+this is B::f
+this is B::f
+this is A::f
diff --git a/tests/exec/inheritance2.cpp b/tests/exec/inheritance2.cpp
new file mode 100644
index 0000000..272b341
--- /dev/null
+++ b/tests/exec/inheritance2.cpp
@@ -0,0 +1,26 @@
+#include <iostream>
+
+class A {
+public:
+ virtual void f();
+};
+
+class B : public A {
+public:
+ void f();
+};
+
+void A::f() {
+ std::cout << "this is A::f" << "\n";
+}
+
+void B::f() {
+ std::cout << "this is B::f" << "\n";
+}
+
+int main() {
+ A *a = new A();
+ a->f();
+ a = new B();
+ a->f();
+}
diff --git a/tests/exec/inheritance2.out b/tests/exec/inheritance2.out
new file mode 100644
index 0000000..68820df
--- /dev/null
+++ b/tests/exec/inheritance2.out
@@ -0,0 +1,2 @@
+this is A::f
+this is B::f
diff --git a/tests/exec/josephus.cpp b/tests/exec/josephus.cpp
new file mode 100644
index 0000000..f43dac6
--- /dev/null
+++ b/tests/exec/josephus.cpp
@@ -0,0 +1,101 @@
+#include <iostream>
+
+/*** listes circulaires doublement chaînées ***/
+
+class ListeC {
+ public:
+ int valeur;
+ ListeC *suivant;
+ ListeC *precedent;
+ ListeC(int v);
+ void insererApres(int v);
+ void supprimer();
+ void afficher();
+};
+
+/* constructeur = liste réduite à un élément */
+ListeC::ListeC(int v) {
+ valeur = v;
+ suivant = precedent = this;
+}
+
+/* insertion après un élément */
+void ListeC::insererApres(int v) {
+ ListeC *e = new ListeC(0);
+ e->valeur = v;
+ e->suivant = suivant;
+ suivant = e;
+ e->suivant->precedent = e;
+ e->precedent = this;
+}
+
+/* suppression d'un élément */
+void ListeC::supprimer() {
+ precedent->suivant = suivant;
+ suivant->precedent = precedent;
+}
+
+/* affichage */
+void ListeC::afficher() {
+ ListeC *c = this;
+ std::cout << c->valeur << " ";
+ c = c->suivant;
+ for (; c != this;) {
+ std::cout << c->valeur << " ";
+ c = c->suivant;
+ }
+ std::cout << "\n";
+}
+
+/*** problème de Josephus ***/
+
+/* construction de la liste circulaire 1,2,...,n;
+ l'élément retourné est celui contenant 1 */
+ListeC *cercle(int n) {
+ ListeC *l = new ListeC(1);
+ int i;
+ for (i = n; i >= 2; i--) {
+ l->insererApres(i);
+ }
+ return l;
+}
+
+/* jeu de Josephus */
+int josephus(int n, int p) {
+ /* c est le joueur courant, 1 au départ */
+ ListeC *c = cercle(n);
+
+ /* tant qu'il reste plus d'un joueur */
+ for (; c != c->suivant;) {
+ /* on élimine un joueur */
+ int i;
+ for (i = 1; i < p; i++)
+ c = c->suivant;
+ c->supprimer();
+ // std::cout << c->valeur << " est éliminé";
+ c = c->suivant;
+ }
+ // std::cout << "le gagnant est " << c->valeur;
+ return c->valeur;
+}
+
+/*** Tests ***/
+
+int main() {
+ ListeC l = ListeC(1);
+ l.afficher();
+ l.insererApres(3);
+ l.afficher();
+ l.insererApres(2);
+ l.afficher();
+ l.suivant->supprimer();
+ l.afficher();
+
+ ListeC *c = cercle(7);
+ c->afficher();
+
+ if (josephus(7, 5) == 6 &&
+ josephus(5, 5) == 2 &&
+ josephus(5, 17) == 4 && josephus(13, 2) == 11)
+ std::cout << "ok\n";
+}
diff --git a/tests/exec/josephus.out b/tests/exec/josephus.out
new file mode 100644
index 0000000..0506f80
--- /dev/null
+++ b/tests/exec/josephus.out
@@ -0,0 +1,6 @@
+1
+1 3
+1 2 3
+1 3
+1 2 3 4 5 6 7
+ok
diff --git a/tests/exec/mandelbrot.cpp b/tests/exec/mandelbrot.cpp
new file mode 100644
index 0000000..206b18b
--- /dev/null
+++ b/tests/exec/mandelbrot.cpp
@@ -0,0 +1,60 @@
+
+#include <iostream>
+
+/* arithmetique de virgule fixe
+ precision q = 8192 i.e. 13 bits pour la partie decimale */
+
+int add(int x, int y) {
+ return x + y;
+}
+int sub(int x, int y) {
+ return x - y;
+}
+int mul(int x, int y) {
+ int t = x * y;
+ return (t + 8192 / 2) / 8192;
+}
+int div(int x, int y) {
+ int t = x * 8192;
+ return (t + y / 2) / y;
+}
+int of_int(int x) {
+ return x * 8192;
+}
+
+int iter(int n, int a, int b, int xn, int yn) {
+ if (n == 100) return true;
+ int xn2 = mul(xn, xn);
+ int yn2 = mul(yn, yn);
+ if (add(xn2, yn2) > of_int(4)) return false;
+ return iter(n+1, a, b, add(sub(xn2, yn2), a),
+ add(mul(of_int(2), mul(xn, yn)), b));
+}
+
+int inside(int x, int y) {
+ return iter(0, x, y, of_int(0), of_int(0));
+}
+
+int main() {
+ int steps = 30;
+ int xmin = of_int(-2);
+ int xmax = of_int(1);
+ int deltax = div(sub(xmax, xmin), of_int(2 * steps));
+ int ymin = of_int(-1);
+ int ymax = of_int(1);
+ int deltay = div(sub(ymax, ymin), of_int(steps));
+ int i;
+ for (i = 0; i < steps; i++) {
+ int y = add(ymin, mul(of_int(i), deltay));
+ int j;
+ for (j = 0; j < 2 * steps; j++) {
+ int x = add(xmin, mul(of_int(j), deltax));
+ if (inside(x, y))
+ std::cout << "0";
+ else
+ std::cout << "1";
+ }
+ std::cout << "\n";
+ }
+}
+
diff --git a/tests/exec/mandelbrot.out b/tests/exec/mandelbrot.out
new file mode 100644
index 0000000..11cc36c
--- /dev/null
+++ b/tests/exec/mandelbrot.out
@@ -0,0 +1,30 @@
+111111111111111111111111111111111111111111111111111111111111
+111111111111111111111111111111111111111111111111111111111111
+111111111111111111111111111111111111110111111111111111111111
+111111111111111111111111111111111111000011111111111111111111
+111111111111111111111111111111111111000011111111111111111111
+111111111111111111111111111111111111100111111111111111111111
+111111111111111111111111111111011000000000011111111111111111
+111111111111111111111111111110000000000000000001111111111111
+111111111111111111111111111110000000000000000011111111111111
+111111111111111111111111111100000000000000000001111111111111
+111111111111111111111111110000000000000000000000011111111111
+111111111111111110110111111000000000000000000000111111111111
+111111111111111110000000110000000000000000000000111111111111
+111111111111111100000000010000000000000000000000111111111111
+111111111111111100000000010000000000000000000001111111111111
+111110111100000000000000000000000000000000000111111111111111
+111111111111111100000000010000000000000000000000111111111111
+111111111111111100000000010000000000000000000000111111111111
+111111111111111110000000110000000000000000000000111111111111
+111111111111111110110111111000000000000000000000111111111111
+111111111111111111111111111000000000000000000000011111111111
+111111111111111111111111111100000000000000000001111111111111
+111111111111111111111111111110000000000000000011111111111111
+111111111111111111111111111111000000000000000001111111111111
+111111111111111111111111111111011000000000011111111111111111
+111111111111111111111111111111111111100111111111111111111111
+111111111111111111111111111111111111000011111111111111111111
+111111111111111111111111111111111111000011111111111111111111
+111111111111111111111111111111111111110111111111111111111111
+111111111111111111111111111111111111111111111111111111111111
diff --git a/tests/exec/octal.cpp b/tests/exec/octal.cpp
new file mode 100644
index 0000000..649ebde
--- /dev/null
+++ b/tests/exec/octal.cpp
@@ -0,0 +1,13 @@
+#include <iostream>
+
+int main() {
+ std::cout << 0100 << "\n";
+ std::cout << 0777 << "\n";
+ std::cout << 0644 << "\n";
+ int maxint = 017777777777;
+ std::cout << maxint << "\n";
+ int x = 037777777777;
+ std::cout << x << "\n";
+ x = 020000000000;
+ std::cout << x << "\n";
+}
diff --git a/tests/exec/octal.out b/tests/exec/octal.out
new file mode 100644
index 0000000..ee77d8d
--- /dev/null
+++ b/tests/exec/octal.out
@@ -0,0 +1,6 @@
+64
+511
+420
+2147483647
+-1
+-2147483648
diff --git a/tests/exec/pascal.cpp b/tests/exec/pascal.cpp
new file mode 100644
index 0000000..a8a581e
--- /dev/null
+++ b/tests/exec/pascal.cpp
@@ -0,0 +1,62 @@
+
+// triangle de Pascal modulo 7
+// on n'a pas de tableaux, alors on utilise des listes chaînées
+
+#include <iostream>
+
+class Array {
+public:
+ int val;
+ Array *next;
+ Array(int n); // une liste à n éléments
+ int get(int i);
+ void set(int i, int v);
+};
+
+Array::Array(int n) {
+ if (n == 1) return;
+ next = new Array(n-1);
+}
+
+int Array::get(int i) {
+ if (i == 0) return val;
+ return next->get(i-1);
+}
+
+void Array::set(int i, int v) {
+ if (i == 0) val = v;
+ else next->set(i-1, v);
+}
+
+void print_row(Array *r, int i) {
+ int j;
+ for (j = 0; j <= i; j++) {
+ if (r->get(j) != 0)
+ std::cout << "*";
+ else
+ std::cout << "0";
+ }
+ std::cout << "\n";
+}
+
+void compute_row(Array *r, int j) {
+ int v = 0;
+ if (j == 0)
+ v = 1;
+ else
+ v = (r->get(j) + r->get(j-1)) % 7;
+ r->set(j, v);
+ if (j > 0)
+ compute_row(r, j-1);
+}
+
+int main() {
+ int h = 42;
+ Array *r = new Array(h+1);
+ int i;
+ for (i = 0; i < h; i++) {
+ r->set(i, 0);
+ compute_row(r, i);
+ print_row(r, i);
+ }
+}
diff --git a/tests/exec/pascal.out b/tests/exec/pascal.out
new file mode 100644
index 0000000..58ca9bc
--- /dev/null
+++ b/tests/exec/pascal.out
@@ -0,0 +1,42 @@
+*
+**
+***
+****
+*****
+******
+*******
+*000000*
+**00000**
+***0000***
+****000****
+*****00*****
+******0******
+**************
+*000000*000000*
+**00000**00000**
+***0000***0000***
+****000****000****
+*****00*****00*****
+******0******0******
+*********************
+*000000*000000*000000*
+**00000**00000**00000**
+***0000***0000***0000***
+****000****000****000****
+*****00*****00*****00*****
+******0******0******0******
+****************************
+*000000*000000*000000*000000*
+**00000**00000**00000**00000**
+***0000***0000***0000***0000***
+****000****000****000****000****
+*****00*****00*****00*****00*****
+******0******0******0******0******
+***********************************
+*000000*000000*000000*000000*000000*
+**00000**00000**00000**00000**00000**
+***0000***0000***0000***0000***0000***
+****000****000****000****000****000****
+*****00*****00*****00*****00*****00*****
+******0******0******0******0******0******
+******************************************
diff --git a/tests/exec/passing.cpp b/tests/exec/passing.cpp
new file mode 100644
index 0000000..6354fa5
--- /dev/null
+++ b/tests/exec/passing.cpp
@@ -0,0 +1,13 @@
+#include <iostream>
+
+void incr(int &y) {
+ y = y+1;
+}
+
+int main() {
+ int x = 5;
+ std::cout << "x = " << x << std::endl;
+ incr(x);
+ std::cout << "x = " << x << std::endl;
+}
+
diff --git a/tests/exec/passing.out b/tests/exec/passing.out
new file mode 100644
index 0000000..62226ae
--- /dev/null
+++ b/tests/exec/passing.out
@@ -0,0 +1,2 @@
+x = 5
+x = 6
diff --git a/tests/exec/prepost1.cpp b/tests/exec/prepost1.cpp
new file mode 100644
index 0000000..c536018
--- /dev/null
+++ b/tests/exec/prepost1.cpp
@@ -0,0 +1,14 @@
+#include <iostream>
+
+int main() {
+ int x = 41;
+ std::cout << "x = " << x << "\n";
+ x++;
+ std::cout << "x = " << x << "\n";
+ x--;
+ std::cout << "x = " << x << "\n";
+ ++x;
+ std::cout << "x = " << x << "\n";
+ --x;
+ std::cout << "x = " << x << "\n";
+}
diff --git a/tests/exec/prepost1.out b/tests/exec/prepost1.out
new file mode 100644
index 0000000..12ad2b0
--- /dev/null
+++ b/tests/exec/prepost1.out
@@ -0,0 +1,5 @@
+x = 41
+x = 42
+x = 41
+x = 42
+x = 41
diff --git a/tests/exec/ref1.cpp b/tests/exec/ref1.cpp
new file mode 100644
index 0000000..f62d1f6
--- /dev/null
+++ b/tests/exec/ref1.cpp
@@ -0,0 +1,8 @@
+#include <iostream>
+
+int main() {
+ int x = 41;
+ int &y = x;
+ y = 42;
+ std::cout << "x = " << x << "\n";
+}
diff --git a/tests/exec/ref1.out b/tests/exec/ref1.out
new file mode 100644
index 0000000..2d76aba
--- /dev/null
+++ b/tests/exec/ref1.out
@@ -0,0 +1 @@
+x = 42
diff --git a/tests/exec/ref2.cpp b/tests/exec/ref2.cpp
new file mode 100644
index 0000000..d4d2eb8
--- /dev/null
+++ b/tests/exec/ref2.cpp
@@ -0,0 +1,14 @@
+#include <iostream>
+
+void f(int &y) {
+ y = 42;
+}
+
+int main() {
+ int x = 41;
+ std::cout << "x = " << x << "\n";
+ f(x);
+ std::cout << "x = " << x << "\n";
+ x = 41;
+ std::cout << "x = " << x << "\n";
+}
diff --git a/tests/exec/ref2.out b/tests/exec/ref2.out
new file mode 100644
index 0000000..26f06b0
--- /dev/null
+++ b/tests/exec/ref2.out
@@ -0,0 +1,3 @@
+x = 41
+x = 42
+x = 41
diff --git a/tests/exec/ref3.cpp b/tests/exec/ref3.cpp
new file mode 100644
index 0000000..ba58365
--- /dev/null
+++ b/tests/exec/ref3.cpp
@@ -0,0 +1,18 @@
+#include <iostream>
+
+void f(int &y) {
+ y = y + 1;
+}
+
+int main() {
+ int x = 41;
+ std::cout << "x = " << x << "\n";
+ f(x);
+ std::cout << "x = " << x << "\n";
+ f(x);
+ std::cout << "x = " << x << "\n";
+ x = 0;
+ std::cout << "x = " << x << "\n";
+ f(x);
+ std::cout << "x = " << x << "\n";
+}
diff --git a/tests/exec/ref3.out b/tests/exec/ref3.out
new file mode 100644
index 0000000..65e2846
--- /dev/null
+++ b/tests/exec/ref3.out
@@ -0,0 +1,5 @@
+x = 41
+x = 42
+x = 43
+x = 0
+x = 1
diff --git a/tests/exec/ref4.cpp b/tests/exec/ref4.cpp
new file mode 100644
index 0000000..4f59ef4
--- /dev/null
+++ b/tests/exec/ref4.cpp
@@ -0,0 +1,16 @@
+#include <iostream>
+
+void f(int &y) {
+ y = y + 1;
+}
+
+int main() {
+ int x = 41;
+ std::cout << "x = " << x << "\n";
+ f(x);
+ std::cout << "x = " << x << "\n";
+ int &z = x;
+ f(z);
+ std::cout << "x = " << x << "\n";
+ std::cout << "z = " << z << "\n";
+}
diff --git a/tests/exec/ref4.out b/tests/exec/ref4.out
new file mode 100644
index 0000000..771565f
--- /dev/null
+++ b/tests/exec/ref4.out
@@ -0,0 +1,4 @@
+x = 41
+x = 42
+x = 43
+z = 43
diff --git a/tests/exec/ref5.cpp b/tests/exec/ref5.cpp
new file mode 100644
index 0000000..1f9944b
--- /dev/null
+++ b/tests/exec/ref5.cpp
@@ -0,0 +1,29 @@
+#include <iostream>
+
+void f(int &y) {
+ y = y + 1;
+}
+
+int main() {
+ int x = 41;
+ std::cout << "x = " << x << "\n";
+ f(x);
+ std::cout << "x = " << x << "\n";
+ int &z = x;
+ f(z);
+ std::cout << "x = " << x << "\n";
+ std::cout << "z = " << z << "\n";
+ int &u = z;
+ f(u);
+ std::cout << "x = " << x << "\n";
+ std::cout << "z = " << z << "\n";
+ std::cout << "u = " << u << "\n";
+ f(z);
+ std::cout << "x = " << x << "\n";
+ std::cout << "z = " << z << "\n";
+ std::cout << "u = " << u << "\n";
+ f(x);
+ std::cout << "x = " << x << "\n";
+ std::cout << "z = " << z << "\n";
+ std::cout << "u = " << u << "\n";
+}
diff --git a/tests/exec/ref5.out b/tests/exec/ref5.out
new file mode 100644
index 0000000..d52026a
--- /dev/null
+++ b/tests/exec/ref5.out
@@ -0,0 +1,13 @@
+x = 41
+x = 42
+x = 43
+z = 43
+x = 44
+z = 44
+u = 44
+x = 45
+z = 45
+u = 45
+x = 46
+z = 46
+u = 46
diff --git a/tests/exec/ref6.cpp b/tests/exec/ref6.cpp
new file mode 100644
index 0000000..3737786
--- /dev/null
+++ b/tests/exec/ref6.cpp
@@ -0,0 +1,20 @@
+#include <iostream>
+
+int &f(int b, int &x, int &y) {
+ std::cout << "x = " << x << "\n";
+ std::cout << "y = " << y << "\n";
+ if (b) return x; else return y;
+}
+
+int main() {
+ int x = 42;
+ int y = 43;
+ int &r = f(1, x, y);
+ // now r is an alias for x
+ r = 12;
+ std::cout << "x = " << x << "\n";
+ std::cout << "y = " << y << "\n";
+ f(0,x,y) = 13;
+ std::cout << "x = " << x << "\n";
+ std::cout << "y = " << y << "\n";
+}
diff --git a/tests/exec/ref6.out b/tests/exec/ref6.out
new file mode 100644
index 0000000..cb5da25
--- /dev/null
+++ b/tests/exec/ref6.out
@@ -0,0 +1,8 @@
+x = 42
+y = 43
+x = 12
+y = 43
+x = 12
+y = 43
+x = 12
+y = 13
diff --git a/tests/exec/string.cpp b/tests/exec/string.cpp
new file mode 100644
index 0000000..38183b8
--- /dev/null
+++ b/tests/exec/string.cpp
@@ -0,0 +1,10 @@
+#include <iostream>
+
+int main() {
+ std::cout << "abc\n";
+ std::cout << "a\nc\n";
+ std::cout << "a\\c\n";
+ std::cout << "a\tc\n";
+ std::cout << "a\"c\n";
+ std::cout << "\x41\x42\x43\n";
+}
diff --git a/tests/exec/string.out b/tests/exec/string.out
new file mode 100644
index 0000000..0772ea1
--- /dev/null
+++ b/tests/exec/string.out
@@ -0,0 +1,7 @@
+abc
+a
+c
+a\c
+a c
+a"c
+ABC
diff --git a/tests/exec/true_false.cpp b/tests/exec/true_false.cpp
new file mode 100644
index 0000000..42a4f65
--- /dev/null
+++ b/tests/exec/true_false.cpp
@@ -0,0 +1,8 @@
+#include <iostream>
+
+int main() {
+ int b = true;
+ std::cout << "b = " << b << "\n";
+ b = false;
+ std::cout << "b = " << b << "\n";
+}
diff --git a/tests/exec/true_false.out b/tests/exec/true_false.out
new file mode 100644
index 0000000..1748f7d
--- /dev/null
+++ b/tests/exec/true_false.out
@@ -0,0 +1,2 @@
+b = 1
+b = 0
diff --git a/tests/exec/vehicles.cpp b/tests/exec/vehicles.cpp
new file mode 100644
index 0000000..51ab55d
--- /dev/null
+++ b/tests/exec/vehicles.cpp
@@ -0,0 +1,78 @@
+#include <iostream>
+
+class Vehicle {
+public:
+ int position;
+ Vehicle();
+ virtual void move(int d);
+};
+
+Vehicle::Vehicle() {
+ position = 10;
+}
+
+void Vehicle::move(int d) {
+ std::cout << "vehicle moves\n";
+ position = position + d;
+}
+
+
+class Car : public Vehicle {
+public:
+ // champ position hérité
+ int passengers;
+ Car();
+ // methode move() héritée
+ void await(Vehicle &v);
+};
+
+Car::Car() {
+}
+
+void Car::await(Vehicle &v) {
+ std::cout << "await: position = " << v.position << "\n";
+ if (v.position < position)
+ v.move(position - v.position);
+ else
+ move(10);
+}
+
+class Truck : public Vehicle {
+public:
+ // champ position hérité
+ int load;
+ Truck();
+ void move(int d);
+};
+
+Truck::Truck() {
+}
+
+void Truck::move(int d) { // methode move redéfinie
+ std::cout << "truck moves\n";
+ if (d <= 55) position = position + d; else position = position + 55;
+}
+
+int main() {
+ Truck t;
+ std::cout << "t at " << t.position << "\n";
+ Car c;
+ c.passengers = 2;
+ std::cout << "c at " << c.position << "\n";
+ c.move(60);
+ std::cout << "c at " << c.position << "\n";
+ Vehicle *v = &c; // alias
+ v->move(70);
+ std::cout << "c at " << c.position << "\n";
+ c.await(t);
+ std::cout << "t at " << t.position << "\n";
+ std::cout << "c at " << c.position << "\n";
+
+}
+
+/*
+Local Variables:
+compile-command: "make vehicles"
+End:
+*/
+
diff --git a/tests/exec/vehicles.out b/tests/exec/vehicles.out
new file mode 100644
index 0000000..b5f6c21
--- /dev/null
+++ b/tests/exec/vehicles.out
@@ -0,0 +1,10 @@
+t at 10
+c at 10
+vehicle moves
+c at 70
+vehicle moves
+c at 140
+await: position = 10
+truck moves
+t at 65
+c at 140
diff --git a/tests/syntax/bad/testfile-bad_hexa-1.cpp b/tests/syntax/bad/testfile-bad_hexa-1.cpp
new file mode 100644
index 0000000..e0f8f14
--- /dev/null
+++ b/tests/syntax/bad/testfile-bad_hexa-1.cpp
@@ -0,0 +1 @@
+int main() { int x = 0xG; }
diff --git a/tests/syntax/bad/testfile-bad_ident1-1.cpp b/tests/syntax/bad/testfile-bad_ident1-1.cpp
new file mode 100644
index 0000000..823ff28
--- /dev/null
+++ b/tests/syntax/bad/testfile-bad_ident1-1.cpp
@@ -0,0 +1 @@
+void 1A() { }
diff --git a/tests/syntax/bad/testfile-bad_ident2-1.cpp b/tests/syntax/bad/testfile-bad_ident2-1.cpp
new file mode 100644
index 0000000..acc7054
--- /dev/null
+++ b/tests/syntax/bad/testfile-bad_ident2-1.cpp
@@ -0,0 +1 @@
+void A'A() { }
diff --git a/tests/syntax/bad/testfile-bad_octal-1.cpp b/tests/syntax/bad/testfile-bad_octal-1.cpp
new file mode 100644
index 0000000..f44401f
--- /dev/null
+++ b/tests/syntax/bad/testfile-bad_octal-1.cpp
@@ -0,0 +1 @@
+int main() { int x = 08; }
diff --git a/tests/syntax/bad/testfile-block1-1.cpp b/tests/syntax/bad/testfile-block1-1.cpp
new file mode 100644
index 0000000..e5dc71d
--- /dev/null
+++ b/tests/syntax/bad/testfile-block1-1.cpp
@@ -0,0 +1 @@
+void f() { { }
diff --git a/tests/syntax/bad/testfile-block2-1.cpp b/tests/syntax/bad/testfile-block2-1.cpp
new file mode 100644
index 0000000..3ce148d
--- /dev/null
+++ b/tests/syntax/bad/testfile-block2-1.cpp
@@ -0,0 +1 @@
+void f() { { } } }
diff --git a/tests/syntax/bad/testfile-expr1-1.cpp b/tests/syntax/bad/testfile-expr1-1.cpp
new file mode 100644
index 0000000..fe82a74
--- /dev/null
+++ b/tests/syntax/bad/testfile-expr1-1.cpp
@@ -0,0 +1 @@
+void f() { ++ {}; }
diff --git a/tests/syntax/bad/testfile-expr10-1.cpp b/tests/syntax/bad/testfile-expr10-1.cpp
new file mode 100644
index 0000000..c2f97d8
--- /dev/null
+++ b/tests/syntax/bad/testfile-expr10-1.cpp
@@ -0,0 +1 @@
+void m() { a.x = ; }
diff --git a/tests/syntax/bad/testfile-expr11-1.cpp b/tests/syntax/bad/testfile-expr11-1.cpp
new file mode 100644
index 0000000..d0b2d79
--- /dev/null
+++ b/tests/syntax/bad/testfile-expr11-1.cpp
@@ -0,0 +1 @@
+void m() { a.x = {}; }
diff --git a/tests/syntax/bad/testfile-expr2-1.cpp b/tests/syntax/bad/testfile-expr2-1.cpp
new file mode 100644
index 0000000..1fda478
--- /dev/null
+++ b/tests/syntax/bad/testfile-expr2-1.cpp
@@ -0,0 +1 @@
+void f() { 0 ! 0; }
diff --git a/tests/syntax/bad/testfile-expr3-1.cpp b/tests/syntax/bad/testfile-expr3-1.cpp
new file mode 100644
index 0000000..0ff4a82
--- /dev/null
+++ b/tests/syntax/bad/testfile-expr3-1.cpp
@@ -0,0 +1 @@
+void f() { 0 <> 0; }
diff --git a/tests/syntax/bad/testfile-expr4-1.cpp b/tests/syntax/bad/testfile-expr4-1.cpp
new file mode 100644
index 0000000..e03ca37
--- /dev/null
+++ b/tests/syntax/bad/testfile-expr4-1.cpp
@@ -0,0 +1 @@
+void f() { 0 <== 0; }
diff --git a/tests/syntax/bad/testfile-expr6-1.cpp b/tests/syntax/bad/testfile-expr6-1.cpp
new file mode 100644
index 0000000..20d0013
--- /dev/null
+++ b/tests/syntax/bad/testfile-expr6-1.cpp
@@ -0,0 +1 @@
+void f() { (0)0; }
diff --git a/tests/syntax/bad/testfile-expr7-1.cpp b/tests/syntax/bad/testfile-expr7-1.cpp
new file mode 100644
index 0000000..573bbb9
--- /dev/null
+++ b/tests/syntax/bad/testfile-expr7-1.cpp
@@ -0,0 +1 @@
+void f() { j+ ; }
diff --git a/tests/syntax/bad/testfile-expr8-1.cpp b/tests/syntax/bad/testfile-expr8-1.cpp
new file mode 100644
index 0000000..95273c2
--- /dev/null
+++ b/tests/syntax/bad/testfile-expr8-1.cpp
@@ -0,0 +1 @@
+void f() { j ++ i ; }
diff --git a/tests/syntax/bad/testfile-expr9-1.cpp b/tests/syntax/bad/testfile-expr9-1.cpp
new file mode 100644
index 0000000..b400639
--- /dev/null
+++ b/tests/syntax/bad/testfile-expr9-1.cpp
@@ -0,0 +1 @@
+void f() { x = a.; }
diff --git a/tests/syntax/bad/testfile-for1-1.cpp b/tests/syntax/bad/testfile-for1-1.cpp
new file mode 100644
index 0000000..ca4f53e
--- /dev/null
+++ b/tests/syntax/bad/testfile-for1-1.cpp
@@ -0,0 +1 @@
+void m() { int i; for( ; ; true; i++) ; }
diff --git a/tests/syntax/bad/testfile-for2-1.cpp b/tests/syntax/bad/testfile-for2-1.cpp
new file mode 100644
index 0000000..f600997
--- /dev/null
+++ b/tests/syntax/bad/testfile-for2-1.cpp
@@ -0,0 +1 @@
+void m() { int i; for( , i=0; true; i++) ; }
diff --git a/tests/syntax/bad/testfile-for3-1.cpp b/tests/syntax/bad/testfile-for3-1.cpp
new file mode 100644
index 0000000..be7aa4c
--- /dev/null
+++ b/tests/syntax/bad/testfile-for3-1.cpp
@@ -0,0 +1 @@
+void m() { int i; for( i = 0, ; true; i++) ; }
diff --git a/tests/syntax/bad/testfile-for4-1.cpp b/tests/syntax/bad/testfile-for4-1.cpp
new file mode 100644
index 0000000..be2dfdf
--- /dev/null
+++ b/tests/syntax/bad/testfile-for4-1.cpp
@@ -0,0 +1 @@
+void m() { for(int i = 0; ; ; i++) ; }
diff --git a/tests/syntax/bad/testfile-for5-1.cpp b/tests/syntax/bad/testfile-for5-1.cpp
new file mode 100644
index 0000000..303e843
--- /dev/null
+++ b/tests/syntax/bad/testfile-for5-1.cpp
@@ -0,0 +1 @@
+void m() { for(int i = 0; true; i = 0,) ; }
diff --git a/tests/syntax/bad/testfile-for6-1.cpp b/tests/syntax/bad/testfile-for6-1.cpp
new file mode 100644
index 0000000..85e1988
--- /dev/null
+++ b/tests/syntax/bad/testfile-for6-1.cpp
@@ -0,0 +1 @@
+void m() { for(int i = 0; true; i++) }
diff --git a/tests/syntax/bad/testfile-for7-1.cpp b/tests/syntax/bad/testfile-for7-1.cpp
new file mode 100644
index 0000000..41f8b51
--- /dev/null
+++ b/tests/syntax/bad/testfile-for7-1.cpp
@@ -0,0 +1 @@
+void m() { int i; for() ; }
diff --git a/tests/syntax/bad/testfile-for8-1.cpp b/tests/syntax/bad/testfile-for8-1.cpp
new file mode 100644
index 0000000..8b9040e
--- /dev/null
+++ b/tests/syntax/bad/testfile-for8-1.cpp
@@ -0,0 +1 @@
+int main() { for(;;) }
diff --git a/tests/syntax/bad/testfile-if1-1.cpp b/tests/syntax/bad/testfile-if1-1.cpp
new file mode 100644
index 0000000..dad42a8
--- /dev/null
+++ b/tests/syntax/bad/testfile-if1-1.cpp
@@ -0,0 +1 @@
+void m() { if () ; }
diff --git a/tests/syntax/bad/testfile-if2-1.cpp b/tests/syntax/bad/testfile-if2-1.cpp
new file mode 100644
index 0000000..de75066
--- /dev/null
+++ b/tests/syntax/bad/testfile-if2-1.cpp
@@ -0,0 +1 @@
+void m() { if (;) ; }
diff --git a/tests/syntax/bad/testfile-if3-1.cpp b/tests/syntax/bad/testfile-if3-1.cpp
new file mode 100644
index 0000000..a32ebc5
--- /dev/null
+++ b/tests/syntax/bad/testfile-if3-1.cpp
@@ -0,0 +1 @@
+int m() { if (true) }
diff --git a/tests/syntax/bad/testfile-if_else-1.cpp b/tests/syntax/bad/testfile-if_else-1.cpp
new file mode 100644
index 0000000..afa1759
--- /dev/null
+++ b/tests/syntax/bad/testfile-if_else-1.cpp
@@ -0,0 +1 @@
+void m() { if (true) ; else }
diff --git a/tests/syntax/bad/testfile-illegal_char-1.cpp b/tests/syntax/bad/testfile-illegal_char-1.cpp
new file mode 100644
index 0000000..59c227c
--- /dev/null
+++ b/tests/syntax/bad/testfile-illegal_char-1.cpp
@@ -0,0 +1 @@
+@
diff --git a/tests/syntax/bad/testfile-illegal_char-2.cpp b/tests/syntax/bad/testfile-illegal_char-2.cpp
new file mode 100644
index 0000000..f13b8fe
--- /dev/null
+++ b/tests/syntax/bad/testfile-illegal_char-2.cpp
@@ -0,0 +1,2 @@
+
+int main() { @ int x = 1; }
diff --git a/tests/syntax/bad/testfile-instr_decl1-1.cpp b/tests/syntax/bad/testfile-instr_decl1-1.cpp
new file mode 100644
index 0000000..923e6c2
--- /dev/null
+++ b/tests/syntax/bad/testfile-instr_decl1-1.cpp
@@ -0,0 +1 @@
+void m() { int x = 0 }
diff --git a/tests/syntax/bad/testfile-instr_expr-1.cpp b/tests/syntax/bad/testfile-instr_expr-1.cpp
new file mode 100644
index 0000000..af42569
--- /dev/null
+++ b/tests/syntax/bad/testfile-instr_expr-1.cpp
@@ -0,0 +1 @@
+int m() { 0 }
diff --git a/tests/syntax/bad/testfile-keyword1-1.cpp b/tests/syntax/bad/testfile-keyword1-1.cpp
new file mode 100644
index 0000000..fd96c24
--- /dev/null
+++ b/tests/syntax/bad/testfile-keyword1-1.cpp
@@ -0,0 +1 @@
+void m() { fora (i = 0; 1; i++); }
diff --git a/tests/syntax/bad/testfile-lexer_hack-1.cpp b/tests/syntax/bad/testfile-lexer_hack-1.cpp
new file mode 100644
index 0000000..bfb6bb6
--- /dev/null
+++ b/tests/syntax/bad/testfile-lexer_hack-1.cpp
@@ -0,0 +1,2 @@
+S x;
+int main() {}
diff --git a/tests/syntax/bad/testfile-lexer_hack-2.cpp b/tests/syntax/bad/testfile-lexer_hack-2.cpp
new file mode 100644
index 0000000..300ec96
--- /dev/null
+++ b/tests/syntax/bad/testfile-lexer_hack-2.cpp
@@ -0,0 +1,3 @@
+
+class S { public: int a; };
+class S { public: int a; };
diff --git a/tests/syntax/bad/testfile-lexing1-1.cpp b/tests/syntax/bad/testfile-lexing1-1.cpp
new file mode 100644
index 0000000..a1425a1
--- /dev/null
+++ b/tests/syntax/bad/testfile-lexing1-1.cpp
@@ -0,0 +1 @@
+int foo(int a, int b) { return a--b; }
diff --git a/tests/syntax/bad/testfile-lexing2-1.cpp b/tests/syntax/bad/testfile-lexing2-1.cpp
new file mode 100644
index 0000000..6c30d2e
--- /dev/null
+++ b/tests/syntax/bad/testfile-lexing2-1.cpp
@@ -0,0 +1,2 @@
+void m() { int i = 1/// comment starts at first /, not second
+ 1; }
diff --git a/tests/syntax/bad/testfile-lexing3-1.cpp b/tests/syntax/bad/testfile-lexing3-1.cpp
new file mode 100644
index 0000000..8619b21
--- /dev/null
+++ b/tests/syntax/bad/testfile-lexing3-1.cpp
@@ -0,0 +1 @@
+void m() { int i = 1/**/0; }
diff --git a/tests/syntax/bad/testfile-lexing4-1.cpp b/tests/syntax/bad/testfile-lexing4-1.cpp
new file mode 100644
index 0000000..32ac816
--- /dev/null
+++ b/tests/syntax/bad/testfile-lexing4-1.cpp
@@ -0,0 +1 @@
+void m() { i/**/nt i = 10; }
diff --git a/tests/syntax/bad/testfile-lexing5-1.cpp b/tests/syntax/bad/testfile-lexing5-1.cpp
new file mode 100644
index 0000000..d935f8f
--- /dev/null
+++ b/tests/syntax/bad/testfile-lexing5-1.cpp
@@ -0,0 +1 @@
+ void m() { int i = 0; i +/**/= 10; }
diff --git a/tests/syntax/bad/testfile-lexing6-1.cpp b/tests/syntax/bad/testfile-lexing6-1.cpp
new file mode 100644
index 0000000..4989b51
--- /dev/null
+++ b/tests/syntax/bad/testfile-lexing6-1.cpp
@@ -0,0 +1 @@
+ void m() { int i = 0; i + = 10; }
diff --git a/tests/syntax/bad/testfile-newline_in_string-1.cpp b/tests/syntax/bad/testfile-newline_in_string-1.cpp
new file mode 100644
index 0000000..92f9cc9
--- /dev/null
+++ b/tests/syntax/bad/testfile-newline_in_string-1.cpp
@@ -0,0 +1,5 @@
+void f() {
+ g("
+
+");
+}
diff --git a/tests/syntax/bad/testfile-parameters2-1.cpp b/tests/syntax/bad/testfile-parameters2-1.cpp
new file mode 100644
index 0000000..f5e0bfe
--- /dev/null
+++ b/tests/syntax/bad/testfile-parameters2-1.cpp
@@ -0,0 +1 @@
+void m(int x,) {}
diff --git a/tests/syntax/bad/testfile-quotes_in_string-1.cpp b/tests/syntax/bad/testfile-quotes_in_string-1.cpp
new file mode 100644
index 0000000..47a68d8
--- /dev/null
+++ b/tests/syntax/bad/testfile-quotes_in_string-1.cpp
@@ -0,0 +1,3 @@
+void f() {
+ g(" " ");
+}
diff --git a/tests/syntax/bad/testfile-return1-1.cpp b/tests/syntax/bad/testfile-return1-1.cpp
new file mode 100644
index 0000000..135e57d
--- /dev/null
+++ b/tests/syntax/bad/testfile-return1-1.cpp
@@ -0,0 +1 @@
+int m() { return
diff --git a/tests/syntax/bad/testfile-unclosed_comment-1.cpp b/tests/syntax/bad/testfile-unclosed_comment-1.cpp
new file mode 100644
index 0000000..33662f5
--- /dev/null
+++ b/tests/syntax/bad/testfile-unclosed_comment-1.cpp
@@ -0,0 +1 @@
+/*
diff --git a/tests/syntax/bad/testfile-unclosed_escaped_string-1.cpp b/tests/syntax/bad/testfile-unclosed_escaped_string-1.cpp
new file mode 100644
index 0000000..7d889f2
--- /dev/null
+++ b/tests/syntax/bad/testfile-unclosed_escaped_string-1.cpp
@@ -0,0 +1,3 @@
+void f() {
+ g("\");
+}
diff --git a/tests/syntax/bad/testfile-unclosed_string-1.cpp b/tests/syntax/bad/testfile-unclosed_string-1.cpp
new file mode 100644
index 0000000..0fce6a0
--- /dev/null
+++ b/tests/syntax/bad/testfile-unclosed_string-1.cpp
@@ -0,0 +1,4 @@
+void f() {
+ f(");
+ }
+
diff --git a/tests/syntax/bad/testfile-var2-1.cpp b/tests/syntax/bad/testfile-var2-1.cpp
new file mode 100644
index 0000000..858665c
--- /dev/null
+++ b/tests/syntax/bad/testfile-var2-1.cpp
@@ -0,0 +1 @@
+void f() { int }
diff --git a/tests/syntax/good/testfile-assign-1.cpp b/tests/syntax/good/testfile-assign-1.cpp
new file mode 100644
index 0000000..12cdbee
--- /dev/null
+++ b/tests/syntax/good/testfile-assign-1.cpp
@@ -0,0 +1 @@
+void m() { int x; int y; y = x = 0; }
diff --git a/tests/syntax/good/testfile-compare-1.cpp b/tests/syntax/good/testfile-compare-1.cpp
new file mode 100644
index 0000000..81373c8
--- /dev/null
+++ b/tests/syntax/good/testfile-compare-1.cpp
@@ -0,0 +1 @@
+int m() { return 1==2 && 3==4 || !(5>=6); }
diff --git a/tests/syntax/good/testfile-for-1.cpp b/tests/syntax/good/testfile-for-1.cpp
new file mode 100644
index 0000000..71f985d
--- /dev/null
+++ b/tests/syntax/good/testfile-for-1.cpp
@@ -0,0 +1,2 @@
+int main() { for(;;); }
+
diff --git a/tests/typing/bad/testfile-ampersand-1.cpp b/tests/typing/bad/testfile-ampersand-1.cpp
new file mode 100644
index 0000000..065b3c5
--- /dev/null
+++ b/tests/typing/bad/testfile-ampersand-1.cpp
@@ -0,0 +1 @@
+int main() { &1; }
diff --git a/tests/typing/bad/testfile-ampersand-2.cpp b/tests/typing/bad/testfile-ampersand-2.cpp
new file mode 100644
index 0000000..ceffc1b
--- /dev/null
+++ b/tests/typing/bad/testfile-ampersand-2.cpp
@@ -0,0 +1,2 @@
+
+int main() { int x; int y; &(x+y); }
diff --git a/tests/typing/bad/testfile-ampersand-3.cpp b/tests/typing/bad/testfile-ampersand-3.cpp
new file mode 100644
index 0000000..7228085
--- /dev/null
+++ b/tests/typing/bad/testfile-ampersand-3.cpp
@@ -0,0 +1,4 @@
+
+void foo() {}
+int main() { &(foo()); }
+
diff --git a/tests/typing/bad/testfile-arith-1.cpp b/tests/typing/bad/testfile-arith-1.cpp
new file mode 100644
index 0000000..8dde0c2
--- /dev/null
+++ b/tests/typing/bad/testfile-arith-1.cpp
@@ -0,0 +1,2 @@
+class S { public: int a; };
+int main() { S s; s+s; }
diff --git a/tests/typing/bad/testfile-arith-2.cpp b/tests/typing/bad/testfile-arith-2.cpp
new file mode 100644
index 0000000..30c56d4
--- /dev/null
+++ b/tests/typing/bad/testfile-arith-2.cpp
@@ -0,0 +1,3 @@
+
+class S { public: int a; };
+int main() { S s; s+1; }
diff --git a/tests/typing/bad/testfile-arith-3.cpp b/tests/typing/bad/testfile-arith-3.cpp
new file mode 100644
index 0000000..ec4f877
--- /dev/null
+++ b/tests/typing/bad/testfile-arith-3.cpp
@@ -0,0 +1,2 @@
+
+int main() { char *p; p+p; }
diff --git a/tests/typing/bad/testfile-arith-4.cpp b/tests/typing/bad/testfile-arith-4.cpp
new file mode 100644
index 0000000..f9ca567
--- /dev/null
+++ b/tests/typing/bad/testfile-arith-4.cpp
@@ -0,0 +1,3 @@
+
+class S { public: int a; };
+int main() { S s; char *p; p+s; }
diff --git a/tests/typing/bad/testfile-arith-5.cpp b/tests/typing/bad/testfile-arith-5.cpp
new file mode 100644
index 0000000..2637ffc
--- /dev/null
+++ b/tests/typing/bad/testfile-arith-5.cpp
@@ -0,0 +1,2 @@
+
+int main() { char *p; 1-p; }
diff --git a/tests/typing/bad/testfile-arith-6.cpp b/tests/typing/bad/testfile-arith-6.cpp
new file mode 100644
index 0000000..0ef23c4
--- /dev/null
+++ b/tests/typing/bad/testfile-arith-6.cpp
@@ -0,0 +1,3 @@
+
+int main() { int *p; char *q; putchar(p-q); }
+
diff --git a/tests/typing/bad/testfile-arrow-1.cpp b/tests/typing/bad/testfile-arrow-1.cpp
new file mode 100644
index 0000000..d756d00
--- /dev/null
+++ b/tests/typing/bad/testfile-arrow-1.cpp
@@ -0,0 +1 @@
+int main() { 1->a; }
diff --git a/tests/typing/bad/testfile-arrow-2.cpp b/tests/typing/bad/testfile-arrow-2.cpp
new file mode 100644
index 0000000..379a9d0
--- /dev/null
+++ b/tests/typing/bad/testfile-arrow-2.cpp
@@ -0,0 +1,2 @@
+
+int main() { int x; x->a; }
diff --git a/tests/typing/bad/testfile-arrow-3.cpp b/tests/typing/bad/testfile-arrow-3.cpp
new file mode 100644
index 0000000..4691f12
--- /dev/null
+++ b/tests/typing/bad/testfile-arrow-3.cpp
@@ -0,0 +1,3 @@
+
+class S { public: int a; };
+int main() { int x; x->a; }
diff --git a/tests/typing/bad/testfile-arrow-4.cpp b/tests/typing/bad/testfile-arrow-4.cpp
new file mode 100644
index 0000000..4691f12
--- /dev/null
+++ b/tests/typing/bad/testfile-arrow-4.cpp
@@ -0,0 +1,3 @@
+
+class S { public: int a; };
+int main() { int x; x->a; }
diff --git a/tests/typing/bad/testfile-arrow-5.cpp b/tests/typing/bad/testfile-arrow-5.cpp
new file mode 100644
index 0000000..c41b56d
--- /dev/null
+++ b/tests/typing/bad/testfile-arrow-5.cpp
@@ -0,0 +1,5 @@
+
+class S { public: int a; };
+void foo() {}
+int main() { (foo())->a; }
+
diff --git a/tests/typing/bad/testfile-assign-1.cpp b/tests/typing/bad/testfile-assign-1.cpp
new file mode 100644
index 0000000..5da9fdd
--- /dev/null
+++ b/tests/typing/bad/testfile-assign-1.cpp
@@ -0,0 +1 @@
+int main() { 1 = 2; }
diff --git a/tests/typing/bad/testfile-assign-10.cpp b/tests/typing/bad/testfile-assign-10.cpp
new file mode 100644
index 0000000..24bf51e
--- /dev/null
+++ b/tests/typing/bad/testfile-assign-10.cpp
@@ -0,0 +1,2 @@
+
+int main() { 1++; }
diff --git a/tests/typing/bad/testfile-assign-11.cpp b/tests/typing/bad/testfile-assign-11.cpp
new file mode 100644
index 0000000..15716dd
--- /dev/null
+++ b/tests/typing/bad/testfile-assign-11.cpp
@@ -0,0 +1,3 @@
+
+class S { public: int a; };
+int main() { S s; s++; }
diff --git a/tests/typing/bad/testfile-assign-12.cpp b/tests/typing/bad/testfile-assign-12.cpp
new file mode 100644
index 0000000..6440547
--- /dev/null
+++ b/tests/typing/bad/testfile-assign-12.cpp
@@ -0,0 +1,2 @@
+
+int main() { int x; (x+1)++; }
diff --git a/tests/typing/bad/testfile-assign-13.cpp b/tests/typing/bad/testfile-assign-13.cpp
new file mode 100644
index 0000000..188b9c7
--- /dev/null
+++ b/tests/typing/bad/testfile-assign-13.cpp
@@ -0,0 +1,2 @@
+
+int main() { 0--; }
diff --git a/tests/typing/bad/testfile-assign-14.cpp b/tests/typing/bad/testfile-assign-14.cpp
new file mode 100644
index 0000000..01a82c0
--- /dev/null
+++ b/tests/typing/bad/testfile-assign-14.cpp
@@ -0,0 +1,2 @@
+
+int main() { 1--; }
diff --git a/tests/typing/bad/testfile-assign-15.cpp b/tests/typing/bad/testfile-assign-15.cpp
new file mode 100644
index 0000000..3c69dde
--- /dev/null
+++ b/tests/typing/bad/testfile-assign-15.cpp
@@ -0,0 +1,3 @@
+
+class S { public: int a; };
+int main() { S s; s--; }
diff --git a/tests/typing/bad/testfile-assign-16.cpp b/tests/typing/bad/testfile-assign-16.cpp
new file mode 100644
index 0000000..a7c70f0
--- /dev/null
+++ b/tests/typing/bad/testfile-assign-16.cpp
@@ -0,0 +1,2 @@
+
+int main() { int x; (x+1)--; }
diff --git a/tests/typing/bad/testfile-assign-17.cpp b/tests/typing/bad/testfile-assign-17.cpp
new file mode 100644
index 0000000..e65c23e
--- /dev/null
+++ b/tests/typing/bad/testfile-assign-17.cpp
@@ -0,0 +1,2 @@
+
+int main() { ++0; }
diff --git a/tests/typing/bad/testfile-assign-18.cpp b/tests/typing/bad/testfile-assign-18.cpp
new file mode 100644
index 0000000..2294f48
--- /dev/null
+++ b/tests/typing/bad/testfile-assign-18.cpp
@@ -0,0 +1,2 @@
+
+int main() { ++1; }
diff --git a/tests/typing/bad/testfile-assign-19.cpp b/tests/typing/bad/testfile-assign-19.cpp
new file mode 100644
index 0000000..ae01145
--- /dev/null
+++ b/tests/typing/bad/testfile-assign-19.cpp
@@ -0,0 +1,3 @@
+
+class S { public: int a; };
+int main() { S s; ++s; }
diff --git a/tests/typing/bad/testfile-assign-2.cpp b/tests/typing/bad/testfile-assign-2.cpp
new file mode 100644
index 0000000..74969d8
--- /dev/null
+++ b/tests/typing/bad/testfile-assign-2.cpp
@@ -0,0 +1,2 @@
+
+int main() { 0 = 1; }
diff --git a/tests/typing/bad/testfile-assign-20.cpp b/tests/typing/bad/testfile-assign-20.cpp
new file mode 100644
index 0000000..b60dafb
--- /dev/null
+++ b/tests/typing/bad/testfile-assign-20.cpp
@@ -0,0 +1,2 @@
+
+int main() { int x; ++(x+1); }
diff --git a/tests/typing/bad/testfile-assign-21.cpp b/tests/typing/bad/testfile-assign-21.cpp
new file mode 100644
index 0000000..0eeee1f
--- /dev/null
+++ b/tests/typing/bad/testfile-assign-21.cpp
@@ -0,0 +1,2 @@
+
+int main() { --0; }
diff --git a/tests/typing/bad/testfile-assign-22.cpp b/tests/typing/bad/testfile-assign-22.cpp
new file mode 100644
index 0000000..36b8226
--- /dev/null
+++ b/tests/typing/bad/testfile-assign-22.cpp
@@ -0,0 +1,2 @@
+
+int main() { --1; }
diff --git a/tests/typing/bad/testfile-assign-23.cpp b/tests/typing/bad/testfile-assign-23.cpp
new file mode 100644
index 0000000..8a07de0
--- /dev/null
+++ b/tests/typing/bad/testfile-assign-23.cpp
@@ -0,0 +1,3 @@
+
+class S { public: int a; };
+int main() { S s; --s; }
diff --git a/tests/typing/bad/testfile-assign-24.cpp b/tests/typing/bad/testfile-assign-24.cpp
new file mode 100644
index 0000000..4189d96
--- /dev/null
+++ b/tests/typing/bad/testfile-assign-24.cpp
@@ -0,0 +1,2 @@
+
+int main() { int x; --(x+1); }
diff --git a/tests/typing/bad/testfile-assign-25.cpp b/tests/typing/bad/testfile-assign-25.cpp
new file mode 100644
index 0000000..7bb02d2
--- /dev/null
+++ b/tests/typing/bad/testfile-assign-25.cpp
@@ -0,0 +1,2 @@
+
+int main() { int x; x = --x--; }
diff --git a/tests/typing/bad/testfile-assign-26.cpp b/tests/typing/bad/testfile-assign-26.cpp
new file mode 100644
index 0000000..7ce0ded
--- /dev/null
+++ b/tests/typing/bad/testfile-assign-26.cpp
@@ -0,0 +1,4 @@
+
+void foo() {}
+int main() { ++(foo()); }
+
diff --git a/tests/typing/bad/testfile-assign-27.cpp b/tests/typing/bad/testfile-assign-27.cpp
new file mode 100644
index 0000000..66e5295
--- /dev/null
+++ b/tests/typing/bad/testfile-assign-27.cpp
@@ -0,0 +1 @@
+int main() { int *p; -p; }
diff --git a/tests/typing/bad/testfile-assign-28.cpp b/tests/typing/bad/testfile-assign-28.cpp
new file mode 100644
index 0000000..3d20c1b
--- /dev/null
+++ b/tests/typing/bad/testfile-assign-28.cpp
@@ -0,0 +1,3 @@
+
+class S { public: int a; };
+int main() { S s; +s; }
diff --git a/tests/typing/bad/testfile-assign-29.cpp b/tests/typing/bad/testfile-assign-29.cpp
new file mode 100644
index 0000000..dc6e3e6
--- /dev/null
+++ b/tests/typing/bad/testfile-assign-29.cpp
@@ -0,0 +1,3 @@
+
+class S { public: int a; };
+int main() { S s; -s; }
diff --git a/tests/typing/bad/testfile-assign-3.cpp b/tests/typing/bad/testfile-assign-3.cpp
new file mode 100644
index 0000000..4926a21
--- /dev/null
+++ b/tests/typing/bad/testfile-assign-3.cpp
@@ -0,0 +1,2 @@
+
+int main() { int x; int y; (x+y) = 2; }
diff --git a/tests/typing/bad/testfile-assign-30.cpp b/tests/typing/bad/testfile-assign-30.cpp
new file mode 100644
index 0000000..1d650eb
--- /dev/null
+++ b/tests/typing/bad/testfile-assign-30.cpp
@@ -0,0 +1,3 @@
+
+void foo() {}
+int main() { +(foo()); }
diff --git a/tests/typing/bad/testfile-assign-31.cpp b/tests/typing/bad/testfile-assign-31.cpp
new file mode 100644
index 0000000..b31ee49
--- /dev/null
+++ b/tests/typing/bad/testfile-assign-31.cpp
@@ -0,0 +1,4 @@
+
+void foo() {}
+int main() { -(foo()); }
+
diff --git a/tests/typing/bad/testfile-assign-4.cpp b/tests/typing/bad/testfile-assign-4.cpp
new file mode 100644
index 0000000..c71cddc
--- /dev/null
+++ b/tests/typing/bad/testfile-assign-4.cpp
@@ -0,0 +1,3 @@
+
+class S { public: int a; };
+int main() { int x; S s; x = s; }
diff --git a/tests/typing/bad/testfile-assign-5.cpp b/tests/typing/bad/testfile-assign-5.cpp
new file mode 100644
index 0000000..6d42d60
--- /dev/null
+++ b/tests/typing/bad/testfile-assign-5.cpp
@@ -0,0 +1,3 @@
+
+class S { public: int a; };
+int main() { S s; s = 0; }
diff --git a/tests/typing/bad/testfile-assign-6.cpp b/tests/typing/bad/testfile-assign-6.cpp
new file mode 100644
index 0000000..12c2f37
--- /dev/null
+++ b/tests/typing/bad/testfile-assign-6.cpp
@@ -0,0 +1,3 @@
+
+class S { public: int a; };
+int main() { int x; S s; s = x; }
diff --git a/tests/typing/bad/testfile-assign-7.cpp b/tests/typing/bad/testfile-assign-7.cpp
new file mode 100644
index 0000000..2e12f3a
--- /dev/null
+++ b/tests/typing/bad/testfile-assign-7.cpp
@@ -0,0 +1,4 @@
+
+class S { public: int a; };
+class T { public: int b; };
+int main() { S s; T t; s = t; }
diff --git a/tests/typing/bad/testfile-assign-8.cpp b/tests/typing/bad/testfile-assign-8.cpp
new file mode 100644
index 0000000..1c104db
--- /dev/null
+++ b/tests/typing/bad/testfile-assign-8.cpp
@@ -0,0 +1,4 @@
+
+void foo() {}
+int main() { int x; x = foo(); }
+
diff --git a/tests/typing/bad/testfile-assign-9.cpp b/tests/typing/bad/testfile-assign-9.cpp
new file mode 100644
index 0000000..7cfcff7
--- /dev/null
+++ b/tests/typing/bad/testfile-assign-9.cpp
@@ -0,0 +1 @@
+int main() { 0++; }
diff --git a/tests/typing/bad/testfile-bang-1.cpp b/tests/typing/bad/testfile-bang-1.cpp
new file mode 100644
index 0000000..2c45d1c
--- /dev/null
+++ b/tests/typing/bad/testfile-bang-1.cpp
@@ -0,0 +1,2 @@
+class S { public: int a; };
+int main() { S s; !s; }
diff --git a/tests/typing/bad/testfile-bang-2.cpp b/tests/typing/bad/testfile-bang-2.cpp
new file mode 100644
index 0000000..1cecc76
--- /dev/null
+++ b/tests/typing/bad/testfile-bang-2.cpp
@@ -0,0 +1,4 @@
+
+void foo() {}
+int main() { !(foo()); }
+
diff --git a/tests/typing/bad/testfile-call-1.cpp b/tests/typing/bad/testfile-call-1.cpp
new file mode 100644
index 0000000..2de8346
--- /dev/null
+++ b/tests/typing/bad/testfile-call-1.cpp
@@ -0,0 +1,2 @@
+void f(int x) {}
+int main() { f(); }
diff --git a/tests/typing/bad/testfile-call-2.cpp b/tests/typing/bad/testfile-call-2.cpp
new file mode 100644
index 0000000..ddf482c
--- /dev/null
+++ b/tests/typing/bad/testfile-call-2.cpp
@@ -0,0 +1,5 @@
+
+class S { public: int a; };
+void f(int x) {}
+int main() { S s; f(s); }
+
diff --git a/tests/typing/bad/testfile-class-1.cpp b/tests/typing/bad/testfile-class-1.cpp
new file mode 100644
index 0000000..cb39856
--- /dev/null
+++ b/tests/typing/bad/testfile-class-1.cpp
@@ -0,0 +1 @@
+class S { public: S a; };
diff --git a/tests/typing/bad/testfile-class-2.cpp b/tests/typing/bad/testfile-class-2.cpp
new file mode 100644
index 0000000..27a630c
--- /dev/null
+++ b/tests/typing/bad/testfile-class-2.cpp
@@ -0,0 +1,3 @@
+
+class S { public: void v; };
+
diff --git a/tests/typing/bad/testfile-comparison-1.cpp b/tests/typing/bad/testfile-comparison-1.cpp
new file mode 100644
index 0000000..2466fe4
--- /dev/null
+++ b/tests/typing/bad/testfile-comparison-1.cpp
@@ -0,0 +1,2 @@
+class S { public: int a; };
+int main() { int x; S s; 1 < s; }
diff --git a/tests/typing/bad/testfile-comparison-2.cpp b/tests/typing/bad/testfile-comparison-2.cpp
new file mode 100644
index 0000000..fc24f6a
--- /dev/null
+++ b/tests/typing/bad/testfile-comparison-2.cpp
@@ -0,0 +1,3 @@
+
+class S { public: int a; };
+int main() { int x; S s; 1 != s; }
diff --git a/tests/typing/bad/testfile-comparison-3.cpp b/tests/typing/bad/testfile-comparison-3.cpp
new file mode 100644
index 0000000..bdbb44b
--- /dev/null
+++ b/tests/typing/bad/testfile-comparison-3.cpp
@@ -0,0 +1,3 @@
+
+class S { public: int a; };
+int main() { S s1; S s2; s1 < s2; }
diff --git a/tests/typing/bad/testfile-comparison-4.cpp b/tests/typing/bad/testfile-comparison-4.cpp
new file mode 100644
index 0000000..6d7a48f
--- /dev/null
+++ b/tests/typing/bad/testfile-comparison-4.cpp
@@ -0,0 +1,3 @@
+
+class S { public: int a; };
+int main() { S s1; S s2; s1 != s2; }
diff --git a/tests/typing/bad/testfile-comparison-5.cpp b/tests/typing/bad/testfile-comparison-5.cpp
new file mode 100644
index 0000000..61d826c
--- /dev/null
+++ b/tests/typing/bad/testfile-comparison-5.cpp
@@ -0,0 +1,3 @@
+
+class S { public: int a; };
+int main() { int x; S s; 1 == s; }
diff --git a/tests/typing/bad/testfile-comparison-6.cpp b/tests/typing/bad/testfile-comparison-6.cpp
new file mode 100644
index 0000000..f081f6a
--- /dev/null
+++ b/tests/typing/bad/testfile-comparison-6.cpp
@@ -0,0 +1,4 @@
+
+void foo() {}
+int main() { 1 < foo(); }
+
diff --git a/tests/typing/bad/testfile-deref-1.cpp b/tests/typing/bad/testfile-deref-1.cpp
new file mode 100644
index 0000000..7854300
--- /dev/null
+++ b/tests/typing/bad/testfile-deref-1.cpp
@@ -0,0 +1 @@
+int main() { *1; }
diff --git a/tests/typing/bad/testfile-deref-2.cpp b/tests/typing/bad/testfile-deref-2.cpp
new file mode 100644
index 0000000..d3a1318
--- /dev/null
+++ b/tests/typing/bad/testfile-deref-2.cpp
@@ -0,0 +1,2 @@
+
+int main() { int x; *x; }
diff --git a/tests/typing/bad/testfile-deref-3.cpp b/tests/typing/bad/testfile-deref-3.cpp
new file mode 100644
index 0000000..622fa8b
--- /dev/null
+++ b/tests/typing/bad/testfile-deref-3.cpp
@@ -0,0 +1,4 @@
+
+void foo() {}
+int main() { *(foo()); }
+
diff --git a/tests/typing/bad/testfile-field-1.cpp b/tests/typing/bad/testfile-field-1.cpp
new file mode 100644
index 0000000..785c97d
--- /dev/null
+++ b/tests/typing/bad/testfile-field-1.cpp
@@ -0,0 +1 @@
+int main() { 1.a; }
diff --git a/tests/typing/bad/testfile-field-2.cpp b/tests/typing/bad/testfile-field-2.cpp
new file mode 100644
index 0000000..e64aded
--- /dev/null
+++ b/tests/typing/bad/testfile-field-2.cpp
@@ -0,0 +1,2 @@
+
+int main() { int x; x.a; }
diff --git a/tests/typing/bad/testfile-field-3.cpp b/tests/typing/bad/testfile-field-3.cpp
new file mode 100644
index 0000000..382e124
--- /dev/null
+++ b/tests/typing/bad/testfile-field-3.cpp
@@ -0,0 +1,3 @@
+
+class S { public: int a; };
+int main() { int x; x.a; }
diff --git a/tests/typing/bad/testfile-field-4.cpp b/tests/typing/bad/testfile-field-4.cpp
new file mode 100644
index 0000000..4a2cf19
--- /dev/null
+++ b/tests/typing/bad/testfile-field-4.cpp
@@ -0,0 +1,3 @@
+
+class S { public: int a; };
+int main() { S *s; s.a; }
diff --git a/tests/typing/bad/testfile-field-5.cpp b/tests/typing/bad/testfile-field-5.cpp
new file mode 100644
index 0000000..382e124
--- /dev/null
+++ b/tests/typing/bad/testfile-field-5.cpp
@@ -0,0 +1,3 @@
+
+class S { public: int a; };
+int main() { int x; x.a; }
diff --git a/tests/typing/bad/testfile-field-6.cpp b/tests/typing/bad/testfile-field-6.cpp
new file mode 100644
index 0000000..4a2cf19
--- /dev/null
+++ b/tests/typing/bad/testfile-field-6.cpp
@@ -0,0 +1,3 @@
+
+class S { public: int a; };
+int main() { S *s; s.a; }
diff --git a/tests/typing/bad/testfile-field-7.cpp b/tests/typing/bad/testfile-field-7.cpp
new file mode 100644
index 0000000..3ab70cb
--- /dev/null
+++ b/tests/typing/bad/testfile-field-7.cpp
@@ -0,0 +1,5 @@
+
+class S { public: int a; };
+void foo() {}
+int main() { (foo()).a; }
+
diff --git a/tests/typing/bad/testfile-for-1.cpp b/tests/typing/bad/testfile-for-1.cpp
new file mode 100644
index 0000000..bd1cf8e
--- /dev/null
+++ b/tests/typing/bad/testfile-for-1.cpp
@@ -0,0 +1,2 @@
+void foo() {}
+int main() { for( ; foo(); ); }
diff --git a/tests/typing/bad/testfile-for-2.cpp b/tests/typing/bad/testfile-for-2.cpp
new file mode 100644
index 0000000..91dae25
--- /dev/null
+++ b/tests/typing/bad/testfile-for-2.cpp
@@ -0,0 +1,4 @@
+
+class S { public: int a; };
+int main() { S s; for( ; s; ); }
+
diff --git a/tests/typing/bad/testfile-global-1.cpp b/tests/typing/bad/testfile-global-1.cpp
new file mode 100644
index 0000000..860c09d
--- /dev/null
+++ b/tests/typing/bad/testfile-global-1.cpp
@@ -0,0 +1,3 @@
+void v;
+int main() { }
+
diff --git a/tests/typing/bad/testfile-if-1.cpp b/tests/typing/bad/testfile-if-1.cpp
new file mode 100644
index 0000000..2a96643
--- /dev/null
+++ b/tests/typing/bad/testfile-if-1.cpp
@@ -0,0 +1,2 @@
+void foo() {}
+int main() { if(foo()); }
diff --git a/tests/typing/bad/testfile-if-2.cpp b/tests/typing/bad/testfile-if-2.cpp
new file mode 100644
index 0000000..fa8aa4d
--- /dev/null
+++ b/tests/typing/bad/testfile-if-2.cpp
@@ -0,0 +1,4 @@
+
+class S { public: int a; };
+int main() { S s; if(s); }
+
diff --git a/tests/typing/bad/testfile-local-1.cpp b/tests/typing/bad/testfile-local-1.cpp
new file mode 100644
index 0000000..850e678
--- /dev/null
+++ b/tests/typing/bad/testfile-local-1.cpp
@@ -0,0 +1,2 @@
+int main() { void v; }
+
diff --git a/tests/typing/bad/testfile-redef-1.cpp b/tests/typing/bad/testfile-redef-1.cpp
new file mode 100644
index 0000000..db8446b
--- /dev/null
+++ b/tests/typing/bad/testfile-redef-1.cpp
@@ -0,0 +1,2 @@
+int main() {}
+int main() {}
diff --git a/tests/typing/bad/testfile-redef-2.cpp b/tests/typing/bad/testfile-redef-2.cpp
new file mode 100644
index 0000000..4518185
--- /dev/null
+++ b/tests/typing/bad/testfile-redef-2.cpp
@@ -0,0 +1,4 @@
+
+void f() {}
+void f() {}
+int main() {}
diff --git a/tests/typing/bad/testfile-redef-3.cpp b/tests/typing/bad/testfile-redef-3.cpp
new file mode 100644
index 0000000..5e5d141
--- /dev/null
+++ b/tests/typing/bad/testfile-redef-3.cpp
@@ -0,0 +1,4 @@
+
+int f;
+void f() {}
+int main() {}
diff --git a/tests/typing/bad/testfile-redef-4.cpp b/tests/typing/bad/testfile-redef-4.cpp
new file mode 100644
index 0000000..fa82b3d
--- /dev/null
+++ b/tests/typing/bad/testfile-redef-4.cpp
@@ -0,0 +1,4 @@
+
+void f() {}
+int f;
+int main() {}
diff --git a/tests/typing/bad/testfile-redef-5.cpp b/tests/typing/bad/testfile-redef-5.cpp
new file mode 100644
index 0000000..503a592
--- /dev/null
+++ b/tests/typing/bad/testfile-redef-5.cpp
@@ -0,0 +1,2 @@
+
+int main() { int x; int x; }
diff --git a/tests/typing/bad/testfile-redef-6.cpp b/tests/typing/bad/testfile-redef-6.cpp
new file mode 100644
index 0000000..ae81bdc
--- /dev/null
+++ b/tests/typing/bad/testfile-redef-6.cpp
@@ -0,0 +1,3 @@
+
+class S { public: int a; int a; };
+int main() {}
diff --git a/tests/typing/bad/testfile-ref-1.cpp b/tests/typing/bad/testfile-ref-1.cpp
new file mode 100644
index 0000000..34b913a
--- /dev/null
+++ b/tests/typing/bad/testfile-ref-1.cpp
@@ -0,0 +1 @@
+int main() { int &x = 42; }
diff --git a/tests/typing/bad/testfile-ref-2.cpp b/tests/typing/bad/testfile-ref-2.cpp
new file mode 100644
index 0000000..4997202
--- /dev/null
+++ b/tests/typing/bad/testfile-ref-2.cpp
@@ -0,0 +1,3 @@
+
+int main() { int x; int &y = &x; }
+
diff --git a/tests/typing/bad/testfile-return-1.cpp b/tests/typing/bad/testfile-return-1.cpp
new file mode 100644
index 0000000..5eb3571
--- /dev/null
+++ b/tests/typing/bad/testfile-return-1.cpp
@@ -0,0 +1,3 @@
+class S { public: int a; };
+S f() { return 1; }
+int main() { }
diff --git a/tests/typing/bad/testfile-return-2.cpp b/tests/typing/bad/testfile-return-2.cpp
new file mode 100644
index 0000000..b14902c
--- /dev/null
+++ b/tests/typing/bad/testfile-return-2.cpp
@@ -0,0 +1,4 @@
+
+class S { public: int a; };
+int f() { S s; return s; }
+int main() { }
diff --git a/tests/typing/bad/testfile-return-3.cpp b/tests/typing/bad/testfile-return-3.cpp
new file mode 100644
index 0000000..f13c7a3
--- /dev/null
+++ b/tests/typing/bad/testfile-return-3.cpp
@@ -0,0 +1,4 @@
+
+class S { public: int a; };
+int main() { S s; return s; }
+
diff --git a/tests/typing/bad/testfile-scope-1.cpp b/tests/typing/bad/testfile-scope-1.cpp
new file mode 100644
index 0000000..cc6caa9
--- /dev/null
+++ b/tests/typing/bad/testfile-scope-1.cpp
@@ -0,0 +1 @@
+int main() { { int x; } x; }
diff --git a/tests/typing/bad/testfile-scope-2.cpp b/tests/typing/bad/testfile-scope-2.cpp
new file mode 100644
index 0000000..13135ba
--- /dev/null
+++ b/tests/typing/bad/testfile-scope-2.cpp
@@ -0,0 +1,3 @@
+
+int main() { int x; if(x) { int y; } else y; }
+
diff --git a/tests/typing/bad/testfile-undef_var-1.cpp b/tests/typing/bad/testfile-undef_var-1.cpp
new file mode 100644
index 0000000..d6d1769
--- /dev/null
+++ b/tests/typing/bad/testfile-undef_var-1.cpp
@@ -0,0 +1 @@
+int main() { x; }
diff --git a/tests/typing/bad/testfile-undef_var-2.cpp b/tests/typing/bad/testfile-undef_var-2.cpp
new file mode 100644
index 0000000..03922a3
--- /dev/null
+++ b/tests/typing/bad/testfile-undef_var-2.cpp
@@ -0,0 +1,3 @@
+
+int main() { int x; }
+void n() { x; }
diff --git a/tests/typing/bad/testfile-undef_var-3.cpp b/tests/typing/bad/testfile-undef_var-3.cpp
new file mode 100644
index 0000000..9831eb2
--- /dev/null
+++ b/tests/typing/bad/testfile-undef_var-3.cpp
@@ -0,0 +1,4 @@
+
+int main(int x) { }
+void n() { x; }
+
diff --git a/tests/typing/bad/testfile-while-1.cpp b/tests/typing/bad/testfile-while-1.cpp
new file mode 100644
index 0000000..1cadb41
--- /dev/null
+++ b/tests/typing/bad/testfile-while-1.cpp
@@ -0,0 +1,2 @@
+void foo() {}
+int main() { while(foo()); }
diff --git a/tests/typing/bad/testfile-while-2.cpp b/tests/typing/bad/testfile-while-2.cpp
new file mode 100644
index 0000000..3814d87
--- /dev/null
+++ b/tests/typing/bad/testfile-while-2.cpp
@@ -0,0 +1,4 @@
+
+class S { public: int a; };
+int main() { S s; while(s); }
+
diff --git a/tests/typing/good/testfile-subtype-1.cpp b/tests/typing/good/testfile-subtype-1.cpp
new file mode 100644
index 0000000..ee18b1e
--- /dev/null
+++ b/tests/typing/good/testfile-subtype-1.cpp
@@ -0,0 +1,5 @@
+#include <iostream>
+int main() {
+ int *s;
+ s = NULL;
+}