Expression Process
 
What is Expression:
9+8*7+(6+5)*(4+-1*2+3)+SIN(1)*100+2^3  <=======   that is expression
 
ITTS support expression when:
1: variable assignment
2: the field of "Process" exist expression value
Expression support following operator:
+ - * / ^ 
>   return 1 if true  return 0 if false
<   return 1 if true  return 0 if false
>=  return 1 if true  return 0 if false
<=  return 1 if true  return 0 if false
==  return 1 if true  return 0 if false
<> or !=   not equal return 1 if true  return 0 if false
>>  shift right n bit                 4.61168601842739E18>>62 =1
<<  shift left n bit  (n<=62) 1<<62 = 4.61168601842739E18
&&  AND test, return 1 if both result<>0  return 0 if one of data =0
||  OR test,return 1 if one of data <>0  return 0 if both of data =0
sin(), cos(), tan()
arcsin(), arccos(), arctanh()
ABS()
INT(1.6)=1
ROUND(1.4)=1
ROUND(1.5)=2
ROUND(2.5)=2
ROUND(3.5)=4
FRAC(1.6)=0.6
EXP(1)=2.71828182845905
LOG10()
LOG2()
Ln()
x0210(1010)=10  bin to dec
x1610(10)  =16 hex to dec
AND
OR
XOR
nnnnn.b =binary of (nnnn)
 
Array process to manage array data
example: POS(ccc,aaabbbcccddd,1)=7
example: POS(["ddd"],["aaabbbcccddd"]) =10
 
SIN()
COS()
TAN()
ARCCOS()  ARCCOS(0) = 1.5707963267949   =  (pi/2)
ARCSIN()  ARCSIN(1) = 1.5707963267949   =  (pi/2)
ARCTANH()
 
0xFF=255
0xFFFFFFFF = -1  ( expression use sign int64 to convert )
0x80000000 = -2147483648  ( expression use sign int64 to convert )
0x7FFFFFFF = 2147483647
In ITTS, expression support smart format.
 
Also you could direct assign expression to variable or string variable:
A=1+2+3+4    variable A=10
B:Str=ABCDE  string variable B=ABCDE
For this feature, you could direct assign some of result data to variable in same test item, don't to add additional test item assign the field value to variable
Example:
assign variable
a=100, 
str1:str=FF
 
['&VAR:A']+['&STR_VAR:str1':x1610([all])] +1 = 356
If there is brance "{}" inside the process string please refer to Brance process
 
Example for variable assignment:
 
Example 1
variable a1 will assigned as 18
Example 2
Expression also could work with smart format
a2 = 10 + a1   (in Example 1, a1 was assigned as 18  )
     =10+18
     =28
 
Example 3
multiple variable assignment
you could  assign many variable in one single test item.
a1=1+2+3=6
a2=2
a3=3+a1 = 9
 
Example 4
Process the field
 
the field of Process existing x1002(['&var:a1']):8  this will change value3 to binary code with 8 digit
PIS field data of a1_as_bin = 00000110   ( if a1=6 )
 
Example 5 
work with smart format:  '&ANS' and '&F:n'
final answer=100+1=101
 
variable assignment:
a1 = 1, a2 = 2, a3 = 3
 
final answer in Pis result fieeld:
x1 in field 9  = 3   (expression  ['&F:3'] will get the 3'rd pos of answer "1;2;3" =3 )
x2 in field 10 = 2   (expression  ['&F:2'] will get the second pos of answer "1;2;3" =2 )
x1 in field 9  = 11  (expression  ['&F:3'] +10 will get the first pos of answer "1;2;3" =1   then + 10 =11)
 
Example 6
Direct assign answer to variable
 
Take the answer then calculate with expression
also assign the processed answer to variable a1
PIS field x =101
variable a1=101
 
Example in Delphi
 
in ITTS
converter_value= ['&STR_VAR:EP':X1610([1][2][3])] 
// it should be setting in ITTS ini section
 
in Delphi
Btn_str  := 'EP:str='+Btn_str; // ex: EP:str=FFF
strcopy(pContent, PAnsiChar(Btn_str));
lAccessMain(pContent, 1024, PAnsiChar(Btn_str), Expression_Process); // let ITTS get the information EP=FFF
lAccessMain(pContent, 1024, PAnsiChar(converter_value), Expression_Process); // process 
s1 := pContent; // s1 is the process result
 

Copyright © 2020
IntretechTW. All Rights Reserved.