Sunday, August 17, 2008

Comparison between 4Test and C language Keywords

Few months back, I was going through 4Test Language Reference (Silktest 5.01) PDF document. There I have seen the comparison of C Language and 4Test. Then I searched the same table in Silktest8.5 Help documentation. It is available under 4Test Reference -> About the 4Test Language -> Comparison of 4Test and C.

Comparison Table: 4Test and C language Keywords

Data type / Feature

C Language

4Test Script

Any type: Stores data of any typeNo datatype available.ANYTYPE aName
Array int ai[10];
  • array [10] of integer ai
  • integer ai[10]
  • Arrays in 4Test can be dynamically resized.
Boolean: Stores either TRUE or FALSEint b;boolean b
Characterchar c;string c. 4Test has no seperate data type for single character.
Enumeratedenum COLOR{red, white, blue};type COLOR is enum red white blue
Floating-point float f; double d;
  • real f
  • real d
Integerint i; long, short, unsignedinteger i
ListSimilar datatype is not available.list of integer li. 4Test has dynamic lists.
NumericSimilar datatype is not available.number n.4Test NUMBER type stores either integers or floating point numbers.
Pointerchar *p; 4Test does not have pointers; however, data can be indirectly referenced using the @ operator.
Pointer to function int (*func) (); @(sFunc) ()
Stringchar s[5]; STRING s. 4Test strings are dynamically allocated; you do not need to declare their lengths.
Structure struct Person { char name[8]; int age; } type Person is record { string name integer age}
User-defined type typedef struct Person PERSON_INFO;type PERSON_INFO is Person
Type cast operator (typename) expression [typename] expression
Equality (==) operator differences if ((i=5) == TRUE) --> This code compiles in C if ((i=5) == TRUE) --> Ths code does not compile in 4Test:This difference is intentional. Because this construct can lead to unreadable code, 4Test does not allow it.

No comments: