Skip to content
/ .. / .. /
Bit Matcher Rule










Bit Matcher Rule

The Bit Matcher Rule verifies single bits of a property value, which must be a decimal number or a string representing a hexadecimal number. The Bit Matcher Rule can:

  • State which bits are set to 1 or 0, starting with 1 as the first index.

  • State that all remaining bits are set to either 1 or 0.

  • Accept a wildcard "X" instead of specifying 1 or 0.

Note: Indices must be between 1 and 64 inclusive. All numbers verified by the Bit Matcher Rule will be converted to 64-bit numbers.

Syntax

1
2
3
4
5
6
7
// Verifies specified bits are set to 1
check <property String> has bits <bitPositions List<Number>> set to <bitValue BitValue>;
check <property String> has bits <bitPositions List<Number>> set to <bitValue BitValue> if present;

// Verifies all remaining bits are set to 0
check <property String> has remaining bits set to <bitValue BitValue>;
check <property String> has remaining bits set to <bitValue BitValue> if present;

Parameters

  • property - The property being checked.

  • bitPositions - The index position of the bits being verified. May be a single number or a comma-separated list of numbers.

  • bitValue - The value being checked against the property's bits. May be either:

    • 0 or 1
    • "X" (case sensitive), meaning it is a wildcard.

Example

1
2
3
4
5
6
7
8
check "BIT_CHECKER" has bits 3, 5 set to 1;
check "BIT_CHECKER" has bits 3, 5 set to 1 if present;

check "BIT_CHECKER" has bits 4 set to "X";
check "BIT_CHECKER" has bits 4 set to "X" if present;

check "BIT_CHECKER" has remaining bits set to 0;
check "BIT_CHECKER" has remaining bits set to 0 if present;

In the example above, the bits 3 and 5 are expected to be set to 1, 4 may be set to 0 or 1, and all remaining bits set to 0.

Note: The two Bit Matcher Rule steps can be used independently from each other. For example, only the second step needs to be used if checking that all bits are set to 0.

Additional Examples

Property Value Bit Representation Has bits set to 1 Check Result
20 10100 3, 5 OK
28 11100 3, 4, 5 OK
20 10100 1, 3, 5 FAIL