summaryrefslogtreecommitdiff
path: root/ecomp-c/test1.e
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2020-03-27 18:23:07 +0100
committerAndreas Baumann <mail@andreasbaumann.cc>2020-03-27 18:23:07 +0100
commita9e2a012b7b777fb015b827cd9203f025ea45713 (patch)
treebfd4b9350294fd7d3e76cc730576e2a6e1683f71 /ecomp-c/test1.e
parentba1b75042fc18ce908ae377a0cdf463f24c4dd3e (diff)
downloadcompilertests-a9e2a012b7b777fb015b827cd9203f025ea45713.tar.gz
compilertests-a9e2a012b7b777fb015b827cd9203f025ea45713.tar.bz2
allow assignment in constant definitions from constant expressions (numbers and other constants for now)
more testing in constants added a boolean type with true and false as predefined constants
Diffstat (limited to 'ecomp-c/test1.e')
-rw-r--r--ecomp-c/test1.e7
1 files changed, 7 insertions, 0 deletions
diff --git a/ecomp-c/test1.e b/ecomp-c/test1.e
index ca531f9..5dbb04d 100644
--- a/ecomp-c/test1.e
+++ b/ecomp-c/test1.e
@@ -7,6 +7,10 @@ module test1;
const
// integer constant
N, M : integer = 20;
+ O : integer = N;
+
+ // boolean constant
+ INIT_STATE : boolean = true;
var
// this is an integer
@@ -16,6 +20,7 @@ var
b : integer;
c : integer; // c too
d, e, f : integer;
+ flag : boolean;
begin
a := 1;
@@ -27,4 +32,6 @@ begin
d := a * ( c + b ); // d should be 8 * ( 20 + 7 ) = 216 (D8 hex)
e := ( ( 7 * a + b ) + 2 * ( b + a + 3 ) ) * 4 / 2; // ((7*8+7)+2*(7+8+3))*4/2=198 (C6 hex)
f := a - b; // should be 8-7=1
+ flag := INIT_STATE; // should be false
+ //flag := a > b; // flag should be true
end