diff options
author | pacien | 2018-06-05 22:48:55 +0200 |
---|---|---|
committer | pacien | 2018-06-05 22:48:55 +0200 |
commit | 97ff7dd6abf007f100c0b12c67702f98c45701c3 (patch) | |
tree | 55e135a59af96f2290dcdd0becdf9d1534f35b48 /res | |
parent | 9673f668dc38acfff868f3c657eccb17a22975be (diff) | |
download | tpc-compiler-97ff7dd6abf007f100c0b12c67702f98c45701c3.tar.gz |
add const tests
Diffstat (limited to 'res')
-rw-r--r-- | res/test_const_ko.tpc | 9 | ||||
-rw-r--r-- | res/test_const_ok.tpc | 9 |
2 files changed, 18 insertions, 0 deletions
diff --git a/res/test_const_ko.tpc b/res/test_const_ko.tpc new file mode 100644 index 0000000..6683d01 --- /dev/null +++ b/res/test_const_ko.tpc | |||
@@ -0,0 +1,9 @@ | |||
1 | const c1 = 0; | ||
2 | const c2 = 0; | ||
3 | |||
4 | entier main(void) { | ||
5 | entier c1; | ||
6 | c1 = 0; /* expect no error */ | ||
7 | c2 = 0; /* expect an error */ | ||
8 | return 1; | ||
9 | } | ||
diff --git a/res/test_const_ok.tpc b/res/test_const_ok.tpc new file mode 100644 index 0000000..caf647c --- /dev/null +++ b/res/test_const_ok.tpc | |||
@@ -0,0 +1,9 @@ | |||
1 | const c1 = 1; | ||
2 | const c2 = 2; | ||
3 | |||
4 | entier main(void) { | ||
5 | const c2 = 3; | ||
6 | const c3 = 4; | ||
7 | print(c1 + c2 + c3); /* expect: 1+3+4 = 8 */ | ||
8 | return 0; | ||
9 | } | ||