RSI Logo
Google
Reactis: Model-Based Testing and Validation
 
 Reactis User's Guide   Contents  |  Index
 Chapters:  1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20

Chapter 17  The Reactis API

17.1  Overview

The Reactis Application Programming Interface (API) enables users to access some of the tool's functionality from C programs. The operations listed in the following section are implemented in the libreactis.dll library that is included in the Reactis distribution. To use the API a #include directive must be added to a program to input this DLL.

The following usage scenario highlights the most important functions in the API and explains the order in which to call them. A more detailed sample program apitest.c is also included in the distribution to demonstrate more aspects of how to use the API.

Assume you want to do the following:

  • Create a test suite for a model
  • Export the test suite in CSV format to run it in a hardware in the loop environment.

You will need to call the following functions to accomplish this task:

  1. Call rsOpen  to receive a RsHandle  value which all other API functions require as a parameter. In the following, the term RsHandle will refer to the handle returned by this call.
  2. Call rsTester  passing the RsHandle, a model file name and other parameters according to the documentation of rsTester . This will create a test suite and return an RsTestSuite  value (an abstract data structure storing the generated test suite).
  3. If the rsTester  call in the previous step fails, call rsGetLastError  to retrieve a description of the problem that caused the call to fail. This can be done if any of the API functions fails.
  4. Call the rsGetCoverageCriteria  functions to retrieve coverage of the test suite that was just created.
  5. Call rsSimOpen  passing the RsHandle, and a model file name. This will return a RsSim value which serves as a handle to the newly created Simulator session.
  6. Call rsSimExportSuite  passing the RsSim  handle returned by rsSimOpen , the RsTestSuite  value returned by rsTester  and a filename with a .csv suffix. This will export the test suite created in step two in the CSV format supported by Reactis.
  7. Call rsSimClose passing the RsSim handle returned by rsSimOpen . rsSimClose will free all memory allocated by the Simulator functions.
  8. Call rsClose , passing the RsHandle as an argument. This will free all memory allocated by the Reactis API.

17.2  Compiling a C or C++ program with the Reactis API

You can compile and run an application that uses the Reactis API as follows.

  • Insert #include "reactis.h" at the top of your C (or C++) code. This compiler directive specifies the names, parameters and return values of the Reactis API functions.
  • Add a suitable .lib library file to your linker options to specify to the linker how to find the Reactis API functions in the “libreactis.dll” dynamic link library. Unfortunately, different compilers use different .lib file formats. The Reactis distribution contains .lib files suitable for a few compilers:
    Microsoft Visual C++ .net, 7.0, 8.0 and 2005
    The correct library file for this compiler is libreactis_vc.lib
    GCC
    The Gnu C compiler included in distributions like Cygwin or MinGW accepts the Microsoft .lib file format.
    Use libreactis_vc.lib
    MathWorks “mex” compiler
    If you want to use Reactis API functions in code compiled with the “mex” compiler tool distributed with MATLAB , use the libreactis_lcc.lib library file.
    If you are using a compiler that is not listed, you can try the following:
    • Some compilers include tools that can create .lib files from a given DLL. Check whether that is true for your compiler. If so, create a .lib library from libreactis.dll and use that.
    • Other compilers accept the Microsoft .lib file format. Try adding libreactis_vc.lib to your linker input settings.
    • Send an email to help@reactive-systems.com describing your compiler type and version. We will try to generate a matching “.lib” file as soon as possible.
  • Compile your application. The way to do this is highly dependent on your compiler and application code. For example, to compile the “apitest.c” example using GCC, type
    gcc -o apitest.exe apitest.c libreactis_vc.lib
  • Add the Reactis “bin” folder (e.g. c:\Program Files\Reactis\bin) to your Windows search path. This is necessary so your application can locate the libreactis.dll library. Alternatively, you can copy libreactis.dll into the folder where your application's executable file is located.

17.3  Reactis API files

The following is a description of files distributed with Reactis that are related to the Reactis API. You can find these files in the lib\api subfolder in your Reactis distribution:

reactis.h
Header file containing declarations for the API functions.
libreactis_vc.lib
Library file suitable for Microsoft Visual C++ and GCC.
libreactis_lcc.lib
Library file suitable for MathWorks mex compiler.
libreactis.lib
Same as libreactis_vc.lib
apitest.c
Example program to illustrate how to use the API functions.
apitest.exe
Compiled version of apitest.c
libreactis.dll
Dynamic Link Library containing implementations of the API functions. This file is located in the Reactis “bin” folder.

17.4  Alphabetical list of API functions

rsClose
rsGetCoverageCriteriaCount
rsGetCoverageCriteriaName
rsGetCoverageCriteriaNumCovered
rsGetCoverageCriteriaNumTargets
rsGetCoverageCriteriaNumUncovered
rsGetCoverageCriteriaNumUnreachable
rsGetCoverageCriteriaPercentCovered
rsGetLastError
rsGetParameterValue
rsGetParameterValueBool
rsGetParameterValueDouble
rsOpen
rsSetParameterValue
rsSimClose
rsSimExportSuite
rsSimImportSuite
rsSimImportSuites
rsSimOpen
rsSimRunSuite
rsSimUpdateOutputs
rsSuiteClose
rsSuiteGetNumTests
rsSuiteGetReactisVersion
rsSuiteGetTestNumSteps
rsSuiteGetTestName
rsSuiteOpen
rsSuiteSave
rsTester
rsVersion
rsVersionParse

17.5  API Operations

17.5.1   rsClose 

Terminates a Reactis API session.

Syntax

void rsClose (RsHandle *h);
Parameters
h
Pointer to RsHandle structure as returned by rsOpen .
Return Value

None.

17.5.2   rsGetCoverageCriteriaCount 

Returns the number of coverage criteria corresponding to most recent call to rsTester or rsSimRunSuite .

Syntax

int rsGetCoverageCriteriaCount (RsHandle *h);
Parameters
h
Pointer to RsHandle structure as returned by rsOpen .
Return Value

Number of coverage criteria being tracked. When calling any of the rsGetCoverageCriteria functions, the 'index' parameter must be less than the value returned by rsGetCoverageCriteriaCount .

The return value is 0 if rsTester or rsSimRunSuite was not called before or an error occurred during the last call.

17.5.3   rsGetCoverageCriteriaName 

Returns the name of a coverage criterion corresponding to the most recent call to rsTester or rsSimRunSuite .

Syntax

int rsGetCoverageCriteriaName (
    RsHandle *h,
    int index,
    char *buffer,
    int bufferSize
);
Parameters
h
Pointer to RsHandle structure as returned by rsOpen .
index
The index of the coverage criterion. This value must be greater or equal to 0 and less than the return value of rsGetCoverageCriteriaCount .
buffer
The buffer that receives the name of the coverage criterion. the buffer's size must correspond to the value of the bufferSize parameter. If the this parameter is NULL then the value returned by rsGetCoverageCriteriaName will be the buffer size required to store the criterion's name.
bufferSize
The size of the buffer passed in as the third argument. If the actual name of the criterion is longer than this value, it will be truncated to the length of the buffer. In that case the return value of rsGetCoverageCriteriaName will be the buffer size that would be required to receive the whole name.
Return Value

Returns -1 if an error occurred (either the index parameter is outside the valid range or neither rsTester or rsSimRunSuite have been called before).

Returns 0 on success.

Returns a value greater than 0 if either the buffer parameter is NULL or the bufferSize parameter was not sufficient to receive the complete name. In that case the value returned specifies the buffer size required to store the complete name.

17.5.4   rsGetCoverageCriteriaNumCovered 

Returns the name of a coverage criterion corresponding to the most recent call to rsTester or rsSimRunSuite .

Syntax

int rsGetCoverageCriteriaNumCovered (RsHandle *h, int index);
Parameters
h
Pointer to RsHandle structure as returned by rsOpen .
index
The index of the coverage criterion. This value must be greater or equal to 0 and less than the return value of rsGetCoverageCriteriaCount .
Return Value

Returns -1 if an error occurred (either the index parameter is outside the valid range or neither rsTester or rsSimRunSuite have been called before).

Returns the number of covered targets for the coverage criterion specified by the index parameter.

17.5.5   rsGetCoverageCriteriaNumTargets 

Returns the name of a coverage criterion corresponding to the most recent call to rsTester or rsSimRunSuite .

Syntax

int rsGetCoverageCriteriaNumTargets (RsHandle *h, int index);
Parameters
h
Pointer to RsHandle structure as returned by rsOpen .
index
The index of the coverage criterion. This value must be greater or equal to 0 and less than the return value of rsGetCoverageCriteriaCount .
Return Value

Returns -1 if an error occurred (either the index parameter is outside the valid range or neither rsTester or rsSimRunSuite have been called before).

Returns the total number of targets for the coverage criterion specified by the index parameter.

17.5.6   rsGetCoverageCriteriaNumUncovered 

Returns the name of a coverage criterion corresponding to the most recent call to rsTester or rsSimRunSuite .

Syntax

int rsGetCoverageCriteriaNumUncovered (RsHandle *h, int index);
Parameters
h
Pointer to RsHandle structure as returned by rsOpen .
index
The index of the coverage criterion. This value must be greater or equal to 0 and less than the return value of rsGetCoverageCriteriaCount .
Return Value

Returns -1 if an error occurred (either the index parameter is outside the valid range or neither rsTester or rsSimRunSuite have been called before).

Returns the number of uncovered targets for the coverage criterion specified by the index parameter.

17.5.7   rsGetCoverageCriteriaNumUnreachable 

Returns the name of a coverage criterion corresponding to the most recent call to rsTester or rsSimRunSuite .

Syntax

int rsGetCoverageCriteriaNumUnreachable (RsHandle *h, int index);
Parameters
h
Pointer to RsHandle structure as returned by rsOpen .
index
The index of the coverage criterion. This value must be greater or equal to 0 and less than the return value of rsGetCoverageCriteriaCount .
Return Value

Returns -1 if an error occurred (either the index parameter is outside the valid range or neither rsTester or rsSimRunSuite have been called before).

Returns the number of unreachable targets for the coverage criterion specified by the index parameter.

17.5.8   rsGetCoverageCriteriaPercentCovered 

Returns the name of a coverage criterion corresponding to the most recent call to rsTester or rsSimRunSuite .

Syntax

double rsGetCoverageCriteriaPercentCovered (RsHandle *h, int index);
Parameters
h
Pointer to RsHandle structure as returned by rsOpen .
index
The index of the coverage criterion. This value must be greater or equal to 0 and less than the return value of rsGetCoverageCriteriaCount .
Return Value

Returns -1 if an error occurred (either the index parameter is outside the valid range or neither rsTester or rsSimRunSuite have been called before).

Returns the percentage of covered targets for the coverage criterion specified by the index parameter. The value ranges from 0.0 (nothing was covered) to 100.0 (all reachable targets were covered).

17.5.9   rsGetParameterValue 

Get the value of a global Reactis parameter. This function can be used to retrieve values for any type of parameter. For boolean parameters, the value returned is either the string “0” or “1”. For double parameters, the value returned is the double value converted to a string. For a more convenient way to access boolean or double parameters, use functions rsGetParameterValueBool and rsGetParameterValueDouble .

Syntax

int rsGetParameterValue (
    RsHandle *h,
    char *name,
    char *buffer,
    int bufferSize
);
Parameters
h
Pointer to RsHandle structure as returned by rsOpen .
name
The name of the parameter. For a list of valid parameter names see the description of function rsSetParameterValue .
buffer
The buffer that receives the value of the parameter. the buffer's size must correspond to the value of the bufferSize parameter. If the this parameter is NULL then the value returned by rsGetCoverageCriteriaName will be the buffer size required to store the parameter's value.
bufferSize
The size of the buffer passed in as the third argument. If the actual name of the parameter's value is longer than this value, it will be truncated to the length of the buffer. In that case the return value of rsGetParameterValue will be the buffer size that would be required to receive the whole value.
Return Value

Returns -1 if an error occurred (the parameterName parameter is not valid).

Returns 0 on success.

Returns a value greater than 0 if either the buffer parameter is NULL or the bufferSize parameter was not sufficient to receive the complete value. In that case the value returned specifies the buffer size required to store the complete value.

17.5.10   rsGetParameterValueBool 

Get the value of a boolean typed global Reactis parameter. For a list of valid parameter names see the description of function rsSetParameterValue .

Syntax

int rsGetParameterValueBool (
    RsHandle *h,
    int parameterName,
    int *value,
);
Parameters
h
Pointer to RsHandle structure as returned by rsOpen .
parameterName
The name of the parameter. For a list of valid parameter names see the description of function rsSetParameterValue .
value
A pointer to an integer variable that will receive the value of the boolean parameter: 0 for “false” and 1 for “true”.
Return Value

0,if an error occurred. In this case call rsGetLastError to get the error string.
1,if no error occurred.

17.5.11   rsGetParameterValueDouble 

Get the value of a “double” typed global Reactis parameter. For a list of valid parameter names see the description of function rsSetParameterValue .

Syntax

int rsGetParameterValueDouble (
    RsHandle *h,
    int parameterName,
    double *value,
);
Parameters
h
Pointer to RsHandle structure as returned by rsOpen .
parameterName
The name of the parameter. For a list of valid parameter names see the description of function rsSetParameterValue .
value
A pointer to an “double” variable that will receive the value of the parameter.
Return Value

0,if an error occurred. In this case call rsGetLastError to get the error string.
1,if no error occurred.

17.5.12   rsGetLastError 

Returns a string describing the most recent error that occurred during a Reactis API function call.

Syntax

const char *rsGetLastError(RsHandle *h);
Parameters
h
Pointer to RsHandle structure as returned by rsOpen .
Return Value

Pointer to a string describing the most recent error message. A NULL value is returned if no error has occurred so far. Reactis allocates and releases the memory needed for the string. The pointer is only valid until the next call to any other API function.

17.5.13   rsOpen 

Starts a Reactis API session.

Syntax

RsHandle  *rsOpen (
    const char *licenseServer,
    char *errorBuf,
    unsigned int errorBufSize
);
Parameters
licenseServer
Character string of the form “server[:port]” that specifies how the API session should contact the Reactis License Manager. The server can be either specified by name (“ReactisLM:3999”) or by IP address (“192.168.1.10:3999”). If the port number is omitted, then default 3999 is used. If licenseServer is NULL, information from the Reactis initialization file is used if available, otherwise the default "127.0.0.1:3999" is used.
errorBuf
Buffer to receive the error description if rsOpen fails. Memory for this buffer must be allocated by the caller before calling rsOpen . If rsOpen fails and errorBuf is NULL then the error message will be discarded.
errorBufSize
Size of errorBuf, i.e. maximum size of error message string. If actual error message string is longer than errorBufSize, it will be truncated.
Return Value

Pointer to a RsHandle structure which contains internal information about the new API session. This handle will be passed to all other API functions. If the open operation fails, then a NULL value is returned and (if errorBuf is non-NULL) an error message is copied into errorBuf.

17.5.14   rsSetParameterValue 

Set the value of a global Reactis parameter. Currently supported parameters are:

ConditionalInputExecution
(possible values: off, on, inherit): Enable/disable conditional input branch execution. When set to 'inherit' Reactis will use the setting given in the model.
CreateTesterParameterFiles
(boolean): When creating a test suite, also create a parameters file (extension '.rtp')
DoMWICaching
(boolean): Create and use cache files (files with extension '.mwi')
DoRelationalOperatorBoundaryCoverage
(boolean): Track boundary coverage for relational operators
EnableLogging
(boolean): Enable Reactis' logging facility. Enabling this can decrease performace and may generate large log files. Only enable this if asked to do so by the Reactis support team.
ExecuteMatlabStartupScripts
(boolean): Execute startup.m and pathdef.m scripts in model folder
IgnoreToWorkspaceBlocks
(boolean): Ignore 'ToFile' and 'ToWorkspace' blocks
LibraryPath
(string): Global Reactis library path. This must be a semicolon-separated list of directories. Do not use quotes.
LogFile
(string): Set the location of Reactis' log file to be created if loggin gis enabled (see parameter EnableLogging).
LogLevel
(string): Set information about what to write to the Reactis log file (see parameter EnableLogging). If you are asked to create a log file by the Reactis support team, the required LogLevel string will be indicated.
MatlabRoot
(string): Root directory of the Matlab version that Reactis should use. Do not use quotes.
OnIntegerOverflow
(possible values: none, warning, error, inherit): Set integer overflow behavior. When set to 'inherit' Reactis will use the setting given in the model.
PrependReactisPathToMatlabPath
(boolean): Before loading a model in Matlab, prepend Reactis' search path to Matlab's search path.
ReactisFilesDir
(string): Specifies the directory where Reactis stores files that it creates and uses.
ShortCircuitSFExpressions
(boolean): Short-circuit Stateflow boolean operators.
ShortCircuitSLLogicBlocks
(boolean): Short-circuit Simulink boolean operators.
StateflowLoopDetectionTimeout
(double): Maximum time for Reactis to compute a simulation step. If the computation of a simulation step takes longer, Reactis assumes there is an infinite loop; the simulation is then terminated and an error message printed.
StateflowOutportMerge
(possible values: none, error, warning): What to do when detecting a Stateflow outport merge.
UserName
(string): Name of the current user. Setting this to "—" will make Reactis use the logon name of the current user. This information will be reported to the license server.
UserPhone
(string): Phone number of the current user. This information will be reported to the license server.
UseCPlugin
(boolean): Enable Reactis for C features.
DoCCaching
(boolean): Create and use cache files for C code (files with extension '.rso')
SFunctionCoverage
(possible values: off, cumulative, separate): Default S-Function source code coverage tracking behavior
Syntax

int rsSetParameterValue (
    RsHandle *h,
    char *name,
    char *value,
);
Parameters
h
Pointer to RsHandle structure as returned by rsOpen .
name
The name of the parameter. See the list of supported parameters above.
value
The new value of the parameter. For parameters of type “boolean”, allowed values are “0”, “false”, “1” or “true”.
bufferSize
The size of the buffer passed in as the third argument. If the actual name of the parameter's value is longer than this value, it will be truncated to the length of the buffer. In that case the return value of rsSetParameterValue will be the buffer size that would be required to receive the whole value.
Return Value

0,if an error occurred. In this case call rsGetLastError to get the error string.
1,if no error occurred.

17.5.15   rsSimClose 

Terminates a Reactis Simulator session started by rsSimOpen .

Syntax

void rsSimClose (RsSim *sim);
Parameters
sim
Pointer to RsSim structure that was previously opened with rsSimOpen .
Return Value

None.

17.5.16   rsSimExportSuite 

Exports a test suite to CSV (comma separated value) or MATLAB script format.

Syntax

int rsSimExportSuite (
    RsSim *sim,
    RsTestSuite *suite,
    const char *fileName
);
Parameters
sim
Pointer to RsSim structure that was previously opened with rsSimOpen .
suite
Pointer to RsTestSuite structure that was created by rsSuiteOpen , rsTester  or rsSimImportSuite .
fileName
Path and name of the target file. The export function determines the export format by the filename extension:
.csvExport as a CSV (comma separated value) file
.mExport as a MATLAB script file
Return Value

0,if an error occurred. In this case call rsGetLastError to get the error string.
1,if no error occurred.

17.5.17   rsSimImportSuite 

Imports a test suite from a CSV (comma separated value) formatted file or from an RST file. In the latter case ports or configuration variables may be deleted or added to the test suite to make the imported suite conform to the model.

Syntax

RsTestSuite * rsSimImportSuite (
    RsSim *sim,
    const char *fileName
);
Parameters
sim
Pointer to RsSim structure that was previously opened with rsSimOpen .
fileName
Path and name of the source file. The import function determines the file format by the filename extension:
.csvImport a CSV (comma separated value) file
.rstImport a Reactis test suite. Add or remove input ports, output ports and configuration variables to match the current model.
Return Value

Pointer to a RsTestSuite structure that can be used to run it in a Simulator session. NULL, if the import failed. In that case, call rsGetLastError to retrieve the error message string.

17.5.18   rsSimImportSuites 

Imports multiple test suites from CSV (Comma separated value) format into the same RST file.

Syntax

RsTestSuite * rsSimImportSuites (
    RsSim *sim,
    int numFiles
    const char *fileNames[]
);
Parameters
sim
Pointer to RsSim structure that was previously opened with rsSimOpen .
numFiles
Number of filenames provided in the fileNames array parameter
fileNames
Array containing paths and names of the source files. The import function determines the file format by the filename extension:
.csvImport a CSV (comma separated value) file
Return Value

Pointer to a RsTestSuite structure that can be used to run it in a Simulator session. NULL, if the import failed. In that case, call rsGetLastError to retrieve the error message string.

17.5.19   rsSimOpen 

Initializes a Reactis Simulator session.

Syntax

RsSim *rsSimOpen (     RsHandle *h,
    const char *modelFileName,
    const char *infoFileName
);
Parameters
h
Pointer to RsHandle structure as returned by rsOpen .
modelFileName
Path and name of .mdl file containing model to simulate.
infoFileName
Path and name of Reactis info file (.rsi file) associated with the model. Can be NULL, in which case no .rsi file will be used.
Return Value

Pointer to a RsSim structure that must be used in all subsequent calls to this simulator session. A NULL value is returned, if the invocation of Reactis Simulator failed. In that case, calling rsGetLastError retrieves the error message string.

17.5.20   rsSimRunSuite 

Runs a test suite in a Reactis Simulator session.

Syntax

int rsSimRunSuite (RsSim *sim, RsTestSuite *suite);
Parameters
sim
Pointer to RsSim structure that was previously opened with rsSimOpen .
suite
Pointer to RsTestSuite structure that was created by rsSuiteOpen or rsTester . May be NULL, in which case random simulation will take place.
Return Value

0,if an error occurred. In this case call rsGetLastError to get the error string.
1,if no error occurred.

17.5.21   rsSimUpdateOutputs 

Runs a test suite in a Reactis Simulator session and update the test suite's output vectors according to the values produced by the model. The filename specifying the new test suite must not equal the test suite's current location.

Syntax

int rsSimUpdateOutputs (
    RsSim *sim,
    RsTestSuite *suite,
    const char *fileName
);
Parameters
sim
Pointer to RsSim structure that was previously opened with rsSimOpen .
suite
Pointer to RsTestSuite structure that was created by rsSuiteOpen , rsTester  or rsSimImportSuite .
fileName
The new filename of the test suite after updating the outputs.
Return Value

0,if an error occurred. In this case call rsGetLastError to get the error string.
1,if no error occurred.

17.5.22   rsSuiteClose 

Closes a test suite that was opened by rsSuiteOpen or created by rsTester .

Syntax

void rsSuiteClose (RsTestSuite *suite);
Parameters
suite
Pointer to RsTestSuite structure as returned by rsSuiteOpen or rsTester .
Return Value

None.

17.5.23   rsSuiteGetNumTests 

Returns the number of tests in a test suite.

Syntax

int rsSuiteGetNumTests(RsTestSuite *suite);
Parameters
suite
Pointer to RsTestSuite structure as returned by rsSuiteOpen or rsTester .
Return Value

Returns the number of tests in the test suite specified by the suite parameter or -1 if an error occurred. In that case you may call rsGetLastError to retrieve the error message string.

17.5.24   rsSuiteGetReactisVersion 

Returns the version of Reactis that created this test suite.

Syntax

const char *rsSuiteGetReactisVersion(RsTestSuite *suite);
Parameters
suite
Pointer to RsTestSuite structure as returned by rsSuiteOpen or rsTester .
Return Value

Pointer to an internal character buffer containing the Reactis version string. For information on version string composition see appendix B. NULL, if an error occurred while retrieving the version. In that case you may call rsGetLastError to retrieve the error message string.

17.5.25   rsSuiteGetTestNumSteps 

Returns the number of steps for a test in a test suite.

Syntax

int rsSuiteGetNumTestSteps(RsTestSuite *suite, int index);
Parameters
suite
Pointer to RsTestSuite structure as returned by rsSuiteOpen or rsTester .
index
Index of the test to query. This value must be greater or equal to 0 and less than the return value of rsSuiteGetNumTests .
Return Value

Returns the number of steps in the test specified by the index parameter in the test suite specified by the suite parameter or -1 if an error occurred. In that case you may call rsGetLastError to retrieve the error message string.

17.5.26   rsSuiteGetTestName 

Returns the name of a test in a test suite.

Syntax

int rsSuiteGetTestName(
    RsTestSuite *suite,
    int index,
    char *buffer,
    int bufferSize
);
Parameters
suite
Pointer to RsTestSuite structure as returned by rsSuiteOpen or rsTester .
index
Index of the test to query. This value must be greater or equal to 0 and less than the return value of rsSuiteGetNumTests .
buffer
The buffer that receives the test name. The buffer's size must correspond to the value of the bufferSize parameter. If the buffer parameter is NULL then the value returned by rsSuiteGetTestName will be the buffer size required to store the whole name.
bufferSize
The size of the buffer passed in as the third argument. If the actual name is longer than this value, it will be truncated to the length of the buffer. In that case the return value of rsSuiteGetTestName will be the buffer size that would be required to receive the whole name.
Return Value

Returns -1 if an error occurred. In this case you may call rsGetLastError to retrieve the error message string.

Returns 0 on success.

Returns a value greater than 0 if either the buffer parameter is NULL or the bufferSize was not sufficient to receive the complete name. In that case the value returned specifies the buffer size required to store the complete name.

17.5.27   rsSuiteOpen 

Loads a test suite from a file.

Syntax

RsTestSuite *rsSuiteOpen(RsHandle *h, const char *testSuiteFileName);
Parameters
h
Pointer to RsHandle structure as returned by rsOpen .
testSuiteFileName
Path and name of the Reactis test suite file (.rst file) to open.
Return Value

Pointer to a RsTestSuite structure that can be run in a simulator session. A NULL value is returned if file does not exist or cannot be read.

17.5.28   rsSuiteSave 

Saves a test suite.

Syntax

int rsSuiteSave (RsTestSuite *suite, const char *filename);
Parameters
suite
Pointer to RsTestSuite structure as returned by rsSuiteOpen or rsTester .
filename
Filename and path to which the suite should be saved.
Return Value

0 if saving failed, <>0 otherwise.

17.5.29   rsTester 

Creates a test suite.

Syntax

RsTestSuite *rsTester (
    RsHandle *h,
    const char *modelFileName,
    const char *infoFileName,
    const char *testSuiteFileName,
    const char *params
);
Parameters
h
Pointer to RsHandle structure as returned by rsOpen .
modelFileName
Path and name of model file (.mdl file).
infoFileName
Path and name of Reactis info file (.rsi file) associated with the model. Can be NULL, in which case no info file will be used.
testSuiteFileName
Path and name of the resulting test suite file (.rst file). The file must be writable and will be overwritten if it already exists. testSuiteFileName can be NULL in which case a temporary file will be created which will be deleted when calling rsSuiteClose .
params
A string containing parameters for test-suite generation. The string may include one or more of the following flags. All are optional.
-a 0|1
  Turns input abstraction on (1) or off (0). Inputs abstraction usually improves the performance of Tester and should be left on (default). In rare cases, turning it off may improve coverage. If coverage problems are encountered with inputs abstraction on, it may be beneficial to take a test suite produced with abstraction on, preload it into Tester, turn abstraction off, and then run Tester again.

-g c1;c2;...;cn
  Specify a list of criteria that should be used to guide test suite generation. Possible values for c1, c2, ... including a short description can be found in the table below. For a detailed description on coverage criteria in Reactis please refer to chapter 6.

Subsystem
Simulink Conditional Subsystems.
Branch
Branches in Simulink blocks.
State
Stateflow States.
ConditionAction
Stateflow Condition Actions.
TransitionAction
Stateflow Transition Actions.
Condition
Simulink and Stateflow conditions.
Decision
Simulink and Stateflow decisions.
MCDC
Simulink and Stateflow MC/DC coverage.
Boundary
Input boundary values.
LookupDetail
Lookup table coverage.
CStatement
C statements in white-box analysis of Simulink S-Functions and Stateflow custom C code.
UserTarget
User-Defined Targets.
Assertion
Assertions.


-p fName1=y|n;fName2=y|n;...;fNamei=y|n
  Specify a list of .rst files to preload. The y|n argument for each file specifies whether or not pruning of the suite should be allowed. The random and targeted phases will extend the preloaded tests. The preloaded test suite files will not be modified.

-r numTests;numSteps
  Specify the number of tests and steps in the random phase. The defaults are 5 tests of 1000 steps each.

-s randomSeed
  Initial seed for the random number generator.

-t stepsInTargetedPhase
  stepsInTargetedPhase specifies the number of execution steps to take during the targeted phase of test generation. The default is 100,000 steps.

Return Value

Pointer to a RsTestSuite structure that can be used to run it in a Simulator session. NULL, if Reactis Tester failed. In that case, call rsGetLastError to retrieve the error message string.

17.5.30   rsVersion 

Returns a string containing the Reactis version.

Syntax

const char *rsVersion();
Parameters
None.
Return Value

Pointer to an internal character buffer containing the Reactis version string. For information on version string composition see appendix B.

17.5.31   rsVersionParse 

Parses a Reactis version string (as returned by functions rsVersion or rsSuiteGetReactisVersion ) and returns the major, minor and patch number.

Syntax

int rsVersionParse(
    const char *versionString,
    int *major,
    int *minor,
    int *patch
);
Parameters
versionString
Character string representing a version of Reactis as returned by function rsVersion or rsSuiteGetReactisVersion . For information on version string composition see appendix B.
major
Pointer to an integer receiving the major version number.
minor
Pointer to an integer receiving the minor version number.
patch
Pointer to an integer receiving the patch number.
Return Value

Returns 1 if successful, 0 otherwise.