Please note : This help page is for an older version of Enteprise Archtiect. The latest help can be found here.

Testpoint Constraints

A Constraint is typically composed using local and member variables in expressions, separated by operators to define one or more specific criteria that must be met. A constraint must evaluate as true to be considered as Passed. If a constraint evaluates as false, it is considered as Failed.

Any variables referenced within the constraint must be in scope at the position where the Testpoint or Breakpoint is evaluated.

General/Arithmetic Operators

Operator

Description

See also

+

Add

Example: a + b > 0

-

Subtract

Example: a - b > 0

/

Divide

Example: a / b == 2

*

Multiply

Example: a * b == c

%

Modulus

Example: a % 2 == 1

( )

Parentheses - Used to define precedence in complex expressions.

Example: ((a / b) * c) <= 100

[ ]

Square Brackets - Used for accessing Arrays.

Example: Names[0].Surname == "Smith"

.

Dot operator - Used to access member variables of a Class.

Example: Station.Name == "Flinders"

->

Alternative notation for the Dot operator.

Example: Station->Name == "Flinders"

Comparison Operators

Operator

Description

See also

=

Equal To

Example: a = b

==

Equal To

Example: a == b

!=

Not Equal To

Example: a != b

<>

Not Equal To

Example: a <> b

>

Greater Than

Example: a > b

>=

Greater Than or Equal To

Example: a >= b

<

Less Than

Example: a < b

<=

Less Than or Equal To

Example: a <= b

Logical Operators

Operator

Description

See also

AND

Logical AND

Example: (a >= 1) AND (a <= 10)

OR

Logical OR

Example: (a == 1) OR (b == 1)

Bitwise Operators

Operator

Description

See also

&

Bitwise AND

Example: (1 & 1) = 1

(1 & 0) = 0

|

Bitwise OR

Example: (1 | 1) = 1

(1 | 0) = 1

^

Bitwise XOR (exclusive OR)

Example: (1 ^ 1) = 0

(1 ^ 0) = 1

Additional Examples

Example

Description

(( m_nValue & 0xFFFF0000) == 0)

Use a Bitwise AND operator (&) with a hexadecimal value as the right operand to test that no bits are set in high order bytes of the variable.

(( m_nValue & 0x0000FFFF) == 0)

Use a Bitwise AND operator (&) with a hexadecimal value as the right operand to test that no bits are set in low order bytes of the variable.

m_value[0][1] = 2

Accessing a multi-dimensional array

a AND (b OR c)

Combining AND and OR operators, using parentheses to ensure precedence. In this example, variable 'a' must be true, and either 'b' or 'c' must be true.

Notes

  • String comparisons are case-sensitive

Learn more

Learning Center topics

  • Alt+F1 | Enterprise Architect | Execution Analysis | Testpoints | About Constraints