Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
..
Failed to load latest commit information.
BI.Expression.Benchmark.pas
FMXBI.Expression.Tree.pas
Main_Unit.fmx
Main_Unit.pas
README.md
TeeBI_Expressions_Test.dpr
TeeBI_Expressions_Test.dproj
TeeBI_Expressions_Test.res

README.md

TExpression Tests and Benchmarks

This example project (made with Firemonkey), shows several test cases of TExpression capabilities.

TExpression Test Demo

The list of available tests is:

0           -> 0

1           -> 1

True        -> True

False       -> False

-1          -> -1

+1          -> 1

-1E20       -> -1E20

-2E3        -> -2000

-5.1e-3     -> -0.0051

2e10        -> 20000000000

1.234       -> 1.234

"abc"       -> abc

'ab"c'      -> ab"c

"a"         -> a

"x" + "y"   -> xy

'zzzz'      -> zzzz

1234        -> 1234

-1234       -> -1234

123.456e4   -> 1234560

1+1         -> 2

1.2 + 3.4   -> 4.6

1.2+3.4     -> 4.6

-3-2        -> -5

-3+ -1      -> -4

2*2         -> 4

6/3         -> 2

5/2         -> 2.5

(123)       -> 123

(1+1)*2     -> 4

(2*3)-(2-1) -> 5

5^3         -> 125

2 = 2       -> True

3 = 5       -> False

3 > 2       -> True

-1>=-2      -> True

12.6<=12.6  -> True

12.6<12.6   -> False

12.6<>12.7  -> True

"xx"<>"yy"  -> True

"xx"<>"xx"  -> False

5<10        -> True

"a" + "bc"  -> abc

7 >= 9      -> False

6 <=2       -> False

(1<3) and (4>2) -> True

True and True -> True

True or false -> True

true and not false -> True

false or not false -> True

not true   -> False

not FALSE  -> True

'x' in []  -> False

'x' in ["123"] -> False

'x' in [ 'x' ] -> True

'x' in ["x"] -> True

'x' in ['','a','x'] -> True

'x' in ['y','z','w'] -> False

not (23 in [14,15,23,65]) -> False

not ('a'='b') -> True

not (23 in [14.2]) -> True

1 in [1,2,3] -> True

1 in [4] -> False

PI    -> 3.14159265358979

cos(pi) -> -1

Sin(0.52359878) -> 0.500000003811985

sqr(5) -> 25

Exp( 10 ) -> 22026.4657948067

Ln( 6.8 ) -> 2.76553474636298

log( 10000) -> 4

(5*4) + sqr(3) - sqrt(36) -> 23

Date('5/6/2015') -> 5/6/2015

Millennium('11/7/2016') -> 3

Century('11/7/2016') -> 21

Year('11/7/2016') -> 2016

Month('11/7/2016') -> 11

Day('11/7/2016') -> 7

Now ->

Time("10:23:45") -> 10:23:45

Hour("10:23:45") -> 10

Minute("10:23:45") -> 23

Second("10:23:45") -> 45

"ABC" contains "B" -> True

"" contains "" -> False

"ABC" contains 'X' -> False

'Hello World' contains 'W' -> True

'Hello World' starts 'He' -> True

'Hello World' starts 'Wo' -> False

'Hello World' ends 'ld' -> True

'Hello World' ends 'Wo' -> False

Lower("AbC") -> abc

Upper("aBC") -> ABC

Lower("A" + "B") -> ab

Length("Hello World") -> 11

Trim(" XYZ ") -> XYZ

Lower(Trim(" aBC    ")) -> abc

IsEmpty("") -> True

IsEmpty(Upper("abc")) -> False

trunc(1.2) -> 1

trunc(1.9) -> 1

trunc(-2.2) -> -2

round(0.5) -> 0

round(0.50001) -> 1

round(0.4) -> 0

round(0.9) -> 1