Real (%REAL) Macro

Applies to TestComplete 15.62, last modified on March 19, 2024

Description

The Real macro is used to insert real numbers into strings generated with the Custom String generator.

The macro is an analog of the Real data generator.

Syntax

The macro has the following syntax:

%REAL(MinValue, MaxValue, DecimalDigits, Increment, *SEQ|*RND, *xN)

Parameters

MinValue and MaxValue

Optional parameters. Specify the lower and upper bounds of actual numbers to be generated.

Note: The value of the MaxValue parameter must be greater than or equal to the value of the MinValue parameter. Both parameters can be specified as an integer or as an actual number. Default values: MinValue = -102.5 and MaxValue = 102.5.

DecimalDigits

Specifies the maximum number of decimal digits in generated numbers. If you want to generate integer numbers only, you can either specify 0 as the value of this parameter or use the Integer macro. The default value of the parameter is 3.

Increment

Optional parameter. Specifies an increment value for the generated sequence. Note that if you want to generate a descending sequence, you need to specify a negative value for this parameter. You can also specify an actual number as the value of this parameter. The default value of the parameter is 2.5.

This parameter is used only with the *Sequential generation mode.

*SEQ or *RND

Optional parameter. Specifies the generation mode:

  • *SEQ (or *Sequential) - Default. If this mode is used, TestComplete generates a sequence of values that will start from the value of the MinValue parameter. The increment value of the sequence is specified by the Increment parameter.
  • *RND (or *Random) - If this mode is used, TestComplete generates random actual number values within the specified range.

*xN

Optional parameter. Specifies the number of possible repetitions of each value in series of generated strings. N is a positive number that specifies the number of repetitions: 1, 2, 3, and so on. The default parameter value is *x1 (no repetitions).

Examples

The following example demonstrates how to use the Real macro:

  • %REAL(-102.5, 102.5, 3, 5.125)

    Generates a sequence of values starting from -102.5 with the increment value of 5.125. The maximum number of the generated values’ decimal digits is 3.

  • %REAL(-102.55, 102.55, 2, -5.05)

    Generates a sequence of values starting from 102.55 with the increment value of -5.125. The maximum number of the generated values’ decimal digits is 2.

  • %REAL(-100.5, 100.5, 2, 5.125, *RND)

    Generates a random collection of values from -100.5 to 100.5. The maximum number of the generated values’ decimal digits is 2. In this case, the value of the Increment parameter (5.125) is omitted.

  • %REAL(-10.5, 10.5, 1, -3, *x2)

    Generates a sequence of values starting from 10.5 with the increment value of -3. The maximum number of the generated values’ decimal digits is 1. Also, each of the generated values will be repeated twice.

  • %REAL()

    Generates a sequence of values starting from -102.5 with the increment value of 2.5 (default parameter values). The maximum number of the generated values’ decimal digits is 3.

  • %REAL(*Random, *x3)

    Generates a random collection of values from -102.5 to 102.5. Each generated value will be repeated three times.

Remarks

  • If some numeric parameters are specified, the macro requires that the first numeric parameter be the value of the MinValue parameter. The second numeric parameter must be the value of the MaxValue parameter. The third numeric parameter must be the value of the DecimalDigits parameter. If you specify one more numeric parameter, it will be interpreted as the value of the Increment parameter. In this case, the *Sequential generation mode will be used automatically.

  • For more information on adding macros to custom strings, see About Custom String Generator

  • For more information on general rules used for specifying macro parameters, see Custom String Generator Rules.

See Also

Macro Reference
Custom String Generator Rules
Custom String Generator
Real Generator
Using Data Generators
Generate Data Dialog

Highlight search results