diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2008-01-05 16:36:56 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2008-01-05 16:36:56 +0000 |
commit | 4887a05481e143bfc4796230605d0a9ff7f2cb5a (patch) | |
tree | 495dce9e5a774e6826fa09f2651ae3c8c546822d /misc/pascal/tests/src/006-optconst.pas | |
parent | 9684605c30d1f7f2f7120d8c1b5645e7ca4eb54f (diff) | |
download | nuttx-4887a05481e143bfc4796230605d0a9ff7f2cb5a.tar.gz nuttx-4887a05481e143bfc4796230605d0a9ff7f2cb5a.tar.bz2 nuttx-4887a05481e143bfc4796230605d0a9ff7f2cb5a.zip |
Pascal Tests
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@504 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'misc/pascal/tests/src/006-optconst.pas')
-rw-r--r-- | misc/pascal/tests/src/006-optconst.pas | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/misc/pascal/tests/src/006-optconst.pas b/misc/pascal/tests/src/006-optconst.pas new file mode 100644 index 000000000..511d807eb --- /dev/null +++ b/misc/pascal/tests/src/006-optconst.pas @@ -0,0 +1,43 @@ +{ A test of constant optimiztion } + +program constopt; +var + i1, i2, i3 : integer; + b1 : boolean +begin + { integer operations: + 1. =, <>, <, <=, >, >= + 2. +, -, OR + 3. *, DIV, AND, SHL, SHR + 4. -, NOT + } + + i1 := -2; { -2 } + i1 := 3 * 2; { 6 } + i1 := 3 * (-2); { -6 } + i1 := 3 div 2; { 1 } + i1 := 3 div (-2); { -1 } + i1 := 4 * 3 div (-2); { -6 } + i1 := 4 * (3 div (-2)); { -4 } + i1 := (4 * 3) div (-2); { -6 } + + i1 := 3 + 2; { 5 } + i1 := 3 - 2; { 1 } + i1 := 3 + (-2); { 1 } + i1 := 4 + 3 - 2; { 5 } + i1 := 4 + (3 - 2); { 5 } + i1 := (4 + 3) - 2; { 5 } + + b1 := -2 = 3 + 2; { -2 = 5 0 } + b1 := 3 * 2 <> 3 - 2; { 6 <> 1 -1 } + b1 := 3 * (-2) < 3 + (-2); { -6 < 1 -1 } + b1 := 3 div 2 <= 4 + 3 - 2; { 1 <= 5 -1 } + b1 := 3 div (-2) > 4 + (3 - 2); { -1 > 5 0 } + b1 := 4 * 3 div (-2) >= (4 + 3) - 2; { -6 >= 5 0 } + + { floating point operations } + { to be provided } + + { string operations } + { to be provided } +end. |