## Storage Device Driver Reference

[prev][next][parent][TOC]

### Automatic Expected Value Checking

If the Stub Function includes a $EXPECTED keyword then the list of param_ kwd(s) which follow will be automatically verified by DDTT. Use of the $ EXPECTED param_kwd list permits the user to specify expected results in the test case script file. The DDTT will automatically compare the specified expected results with the param_kwd's actual resultant value. If the results match, then no log message is produced. If the value or type fails to compare then an ERROR message is logged which show the actual and expected results. Each param_kwd specified in the grammar file's $EXPECTED list may contain a param_type specifier. It is not necessary to specify a param_type if the param_kwd is a required input parameter and as such has already been specified in the Stub Function Specification. If the parameter is not a required input then the param_type specifier is required . The test case writer may verify the expected results two ways:

Prefix: ET_ - Verify result has the same param_type, NUM, ALNUM, ALPHA, or STRING as the associated param_kwd.

Prefix: EV_ - Verify the result matches the expected value of the associated param_kwd.

The test case script writer specifies which verification method by placing either an "EV_" or "ET_" prefix on the param_kwd to be verified. Consider the following example grammar and test script files:

       *

       * Example grammar entry, video.gra

       *

       @import global.gra

       read_video  $DLL=vidotest               \

             $FUNC=@MMVID_GETCLIP$qr8Kwd_List  \

             MODE=ALNUM                        \

             START_FRAME=NUM                   \

             FRAME_COUNT=NUM                   \

             $EXPECTED                         \

                NEXT_FRAME=NUM                 \

                ACT_FRAME_CNT=NUM              \

                FRAME_TYPE=ALNUM

       *

       * Example Test Case Script

       *

       @newalias alias_1 video.gra

       alias_1 read_video                      \

             MODE=UNCOMPRESSED                 \

             START_FRAME=100                   \

             FRAME_COUNT=30                    \

             EV_NEXT_FRAME=131                 \

             EV_ACT_FRAME_CNT=30               \

             ET_FRAME_TYPE

The above example grammar defines the read_video function. Before this function can be invoked, the test script must have previously defined the input parameters: MODE, START_FRAME, and FRAME_COUNT. The script writer can also provide definitions for expected values, "EV_", or specify that DDTT verify the param_types with the "ET_" prefix for the returned parameters: NEXT_FRAME, ACT_FRAME_CNT, and FRAME_TYPE.

If the script writer does not define expected values with the "EV_" or "ET_ " prefix for all of the param_kwds listed under $EXPECTED, then DDTT will by default issue a warning that no parameter checking is taking place for the missing param_kwd(s).

After executing the above example, DDTT verifies NEXT_FRAME has the value of 131, ACT_FRAME_CNT has the value of 30, and FRAME_TYPE returns an alpha- numeric string. DDTT logs an error message if any of these conditions are not met.

The script writer may turn off all parameter verification by setting the param_kwd $EXPECTED to "off". Parameter verification may be re-activated by setting it back to "ON".

       alias_1 set $EXPECTED=OFF

       *

       *   Parameter Verification is now disabled.

       ...

       alias_1 set $EXPECTED=ON

       *

       *   Parameter Verification is now re-enabled.

       ...

API returns may be automatically checked for expected non-zero returns by capturing the APIRET from the DDTT API cover routines and setting the value into a DDTT keyword variable such as: APIRET_01. Extend the associated grammar specification for the function under test as:

          $EXPECTED                   \

             APIRET_00=NUM

Test cases which call a function instrumented as such will be required to specify an expected value for APIRET_00 and if it fails to match, DDTT will automatically send an error message to the log file.