The Ref2 test is typically used with digital tests where data has to be compared against a known reference using a mask. This test compares the 32-bit (long) test result with a binary reference mask. The expected reference and the mask are represented by a single string, which may contain ones (1), zeros (0), and "don't cares" (x).
When a REF-2 reference test is completed, the internal variable TestRefResult variable or TestResult Variable is compared against the reference/mask, ignoring the bits specified as "don't care" (x). This variable should be set during the test execution by a program statement. If the result and the reference/mask are identical, the TestStatus is Pass (1). If it is not, the TestStatus is Fail (2).
To define a Ref2 test's properties:
1. Select the test and click (Properties) on the ATEasy
toolbar. The Test Properties dialog
appears:
2. In the Ref2 field, enter the binary reference mask to which TestResult is to be compared. You can enter up to 32-characters each can be 0, 1 or x. 0 and 1 used to verify that bit value is 0 or 1. x signifies don't care bit where that bit is not used to determine if the result status (TestStatus) is PASS or FAIL. If there are less than 32-characters, the most significant bit that are not displayed and are assumed to be x (don't care). In the above example (screen shot), only bit 1, 2, 4 and 5 in TestResult are checked, these bit should be 1, 1, 0, and 0 accordingly. If TestResult is 1110 (0xE in hexadecimal) TestStatus will be set to PASS and if the value is 1100 - it will be set to FAIL since bit 1 supposed to be 1 and not 0. The Ref-2 value can be also retrieved or set programmatically using Ref2, or Mask and Ref properties of the ATest class.
3. Make other selections and entries as needed in the dialog box. For descriptions of the common test properties (name, ID, etc.), see Test Properties Window.
4. Click the Windows Close button in the upper-right corner of the dialog box to close it.
The Ref2 properties include a single Reference/Mask string. During testing, the reference parameter is printed on the test log. The reference is the expected value and the mask represents the bits that should be compared. A mask of “101” specifies that bits 0 and 2 should be compared. Both values are 32 bits integer (long).
After the Ref2 test is finished, ATEasy prints the results to the log window in binary format.
Here is an example of Ref2 test log output in text format:
Here is an example of the same Ref2 test log output in HTML format:
The following example simulates the way ATEasy calculates TestStatus in Ref-X or Ref-2 tests after the test was executed.
TestResult=0xFAEA
if TestStatus=NONE and VarType(TestResult) <> vtEmpty then
if (TestResult or Test.Ref) and Test.Mask() then
TestStatus=FAIL
else
TestStatus=PASS
endif
endif
! The status now is in TestStatus where ATEasy writes the
! status field.
Note that the TestResult internal variable should be assigned by the test during test execution.
Ref2 Property (ATest), Mask Property (ATest), GetTestRef, GetTestMask, SetTestRef, SetTestMask, TestResult Variable, TestRefResult Variable, TestStatus Variable