<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.stridewiki.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Ryanh</id>
	<title>STRIDE Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://www.stridewiki.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Ryanh"/>
	<link rel="alternate" type="text/html" href="https://www.stridewiki.com/index.php?title=Special:Contributions/Ryanh"/>
	<updated>2026-04-28T10:30:05Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.10</generator>
	<entry>
		<id>https://www.stridewiki.com/index.php?title=Test_Unit&amp;diff=14469</id>
		<title>Test Unit</title>
		<link rel="alternate" type="text/html" href="https://www.stridewiki.com/index.php?title=Test_Unit&amp;diff=14469"/>
		<updated>2015-07-07T19:58:54Z</updated>

		<summary type="html">&lt;p&gt;Ryanh: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
&#039;&#039;&#039;Stride&#039;&#039;&#039; groups similar test cases into a single &#039;&#039;runnable&#039;&#039; package called a &#039;&#039;&#039;Test Unit&#039;&#039;&#039; (also known as a &#039;&#039;&#039;Test Suite&#039;&#039;&#039;). These tests are written in C and C++ which are compiled and linked with your software and run, when called, on your target platform. They are suitable for both developer unit testing as well as end-to-end integration testing. An external [[Stride Runner]] is provided which controls the execution of &#039;&#039;&#039;Test Units&#039;&#039;&#039; and publishes test results to the local file system and optionally to [http://www.testspace.com Testspace]. The following is an example of the structure of a &#039;&#039;&#039;Test Unit&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Declare tests&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;source  lang=cpp&amp;gt;&lt;br /&gt;
#include &amp;lt;srtest.h&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
class MyTest : public stride::srTest {&lt;br /&gt;
public: &lt;br /&gt;
    void CheckFoo();&lt;br /&gt;
    void CheckBoo();&lt;br /&gt;
};&lt;br /&gt;
#pragma scl_test_class(MyTest)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Write tests&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;source  lang=cpp&amp;gt;&lt;br /&gt;
#include &amp;lt;mytest.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
void MyTest::CheckFoo() {&lt;br /&gt;
    ..  &lt;br /&gt;
    srEXPECT_EQ(foo(2 + 2), 4); &lt;br /&gt;
}&lt;br /&gt;
void MyTest::CheckBoo() {&lt;br /&gt;
    ..&lt;br /&gt;
    srEXPECT_GT(boo(3 * 3), 7); &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Test Unit ==&lt;br /&gt;
A single &#039;&#039;&#039;Test Unit&#039;&#039;&#039; is a set of &#039;&#039;&#039;Test Methods&#039;&#039;&#039; that always run together as an &#039;&#039;&#039;executable unit&#039;&#039;&#039;. Test Methods are the &#039;&#039;&#039;test cases&#039;&#039;&#039;  that comprise a Test Unit. Each Test Method  by default maps to a single Test Case in the results. When relying on  this default behavior of Test Methods, we refer to these methods as &#039;&#039;static Test Cases&#039;&#039;. A less common technique is  to create and add a Test Case dynamically at runtime to an existing  Suite via the [[Runtime_Test_Services#method_AddCase|Test Services]].  We refer to these as &#039;&#039;dynamic  Test Cases&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Individual test cases are  implemented as test methods or functions which follow a four-phase testing pattern:&lt;br /&gt;
&lt;br /&gt;
# Setting up a  test fixture (optional)&lt;br /&gt;
# Exercising the Software Under Test (SUT)&lt;br /&gt;
# Verifying  that the expected outcome has occurred &lt;br /&gt;
# Tearing down  the test fixture (optional)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Test fixturing&#039;&#039;&#039; refers to the &#039;&#039;Setup&#039;&#039; and &#039;&#039;Teardown&#039;&#039;   phases of the testing.&lt;br /&gt;
&lt;br /&gt;
In the &#039;&#039;&#039;Setup&#039;&#039;&#039;   phase, we put all of the things into place that are required in order to run a test and expect a particular outcome. This includes things   like:&lt;br /&gt;
* Acquiring resources such as memory,   hardware, etc.&lt;br /&gt;
* Setting up required states such as input   files in place, memory filled with a pattern, dependencies initialized,   etc.&lt;br /&gt;
&lt;br /&gt;
In the &#039;&#039;&#039;Tear down&#039;&#039;&#039;   phase, we clean up the fixturing we did in the Setup phase, leaving  the  system in a state that is ready to be used by the next test.&lt;br /&gt;
&lt;br /&gt;
== Packaging ==&lt;br /&gt;
&lt;br /&gt;
Individual functions or methods,  which typically implement a single test case are grouped into one or  more Test Units which are executed as atomic entities.&lt;br /&gt;
&lt;br /&gt;
Grouping  of individual tests into a Test Unit can be accomplished in any of three  ways:&lt;br /&gt;
&lt;br /&gt;
* A Test Unit can be comprised of the public member functions of a &#039;&#039;&#039;C++  class&#039;&#039;&#039;, &lt;br /&gt;
* A Test Unit  can be comprised of a set of &#039;&#039;&#039;C functions&#039;&#039;&#039;,  &lt;br /&gt;
* A Test Unit can be comprised of C functions pointed to by members of a &#039;&#039;&#039;C struct&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The following  table compares the three packaging variants. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &amp;lt;big&amp;gt;&#039;&#039;&#039;&#039;&#039;Comparison of Test Unit Packaging&#039;&#039;&#039;&#039;&#039;&amp;lt;/big&amp;gt;&lt;br /&gt;
! Test Unit  Type!! Advantages !! Disadvantages !! scl pragma &lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
&#039;&#039;&#039;C++ class&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Test_Unit#C++ Class|Example code]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|&lt;br /&gt;
* Simple and easy to use&lt;br /&gt;
* Can be used with target code that is all C, all C++, or a mix&lt;br /&gt;
* Test utility methods can be encapsulated as test class members or members of a parent class&lt;br /&gt;
* Could be [[Parameterized_Test_Units | parametrized]] via constructor arguments&lt;br /&gt;
* Provides convenient syntax for augmenting report annotation (operator &amp;lt;tt&amp;gt;&amp;lt;&amp;lt;&amp;lt;/tt&amp;gt;)&lt;br /&gt;
| &lt;br /&gt;
* Requires a C++ build environment &lt;br /&gt;
| &amp;lt;tt&amp;gt;scl_test_class&amp;lt;/tt&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
&#039;&#039;&#039;C class&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Test_Unit#C  Class|Example code]]&lt;br /&gt;
&lt;br /&gt;
|&lt;br /&gt;
* Provides encapsulation of test methods&lt;br /&gt;
* Provides encapsulation of state via member variables &lt;br /&gt;
* Could be [[Parameterized_Test_Units |parametrized]] via init-function arguments&lt;br /&gt;
|&lt;br /&gt;
* Requires initialization code for structure  function pointer setup&lt;br /&gt;
* [[Test_Documentation_in_C/C%2B%2B|Test Unit documentation]] must be associated with the  structure function pointer members instead of the actual test method implementations.&lt;br /&gt;
| &amp;lt;tt&amp;gt;scl_test_cclass&amp;lt;/tt&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
&#039;&#039;&#039;C functions&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Test_Unit#Free Functions|Example code]]&lt;br /&gt;
&lt;br /&gt;
|&lt;br /&gt;
* Extremely  simple syntax &lt;br /&gt;
|&lt;br /&gt;
* Parametrized test units are not supported&lt;br /&gt;
* No test unit support for constructor/initializer or destructor/de-initializer&lt;br /&gt;
* Changing test unit membership requires editing of the pragma statement &lt;br /&gt;
* [[Test_Documentation_in_C/C%2B%2B|Test Unit documentation]] for the FList must be associated  with the header file - as such, you can only have one FList per header file if you want to document your test units.&lt;br /&gt;
| &amp;lt;tt&amp;gt;scl_test_flist&amp;lt;/tt&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The best choice is usually the C++ class since it offers the best mix of features and ease-of-use. (You can test code written in C or C++ using the C++ class  test units.) However, compiling C++ is not always possible, in this case one of the C-based test unit packaging options must be used.&lt;br /&gt;
&lt;br /&gt;
You can freely mix different deployment methods across a project if desired, the format of the results is consistent across all test unit packaging options.&lt;br /&gt;
&lt;br /&gt;
== Test Method Return Values == &lt;br /&gt;
&lt;br /&gt;
Test Method return values must conform to certain return types as summarized in the following table. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;background-color:#ffffcc;font-family:arial;font-size:9pt;&amp;quot;  &lt;br /&gt;
| &#039;&#039;&#039;Return Type&#039;&#039;&#039; &lt;br /&gt;
| &#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039;How Return Value is Interpreted&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039;Default Status&#039;&#039;&#039;&lt;br /&gt;
|- &lt;br /&gt;
| &amp;lt;tt&amp;gt;void&amp;lt;/tt&amp;gt;&lt;br /&gt;
| Most common return type&lt;br /&gt;
| Since there is no return, PASS/FAIL status is set in the body of the method using a &lt;br /&gt;
* [[Test_Macros|Test Macro]] &lt;br /&gt;
or a runtime call&lt;br /&gt;
* [[Runtime_Test_Services#srTestCaseSetStatus|srTestCaseSetStatus()]]&lt;br /&gt;
* [[Runtime_Test_Services#srTestCaseSetStatusEx|srTestCaseSetStatusEx()]]&lt;br /&gt;
* [[Runtime_Test_Services#method_SetStatus|srTestCase::SetStatus()]]&lt;br /&gt;
| &lt;br /&gt;
* If the method runs to completion without another status being set, the status is srTEST_PASS&lt;br /&gt;
* If the method does not run to completion (due to crash or hang in software under test), the status is srTEST_INPROGRESS&lt;br /&gt;
|-&lt;br /&gt;
| integer type&lt;br /&gt;
| Integer types include:&lt;br /&gt;
* &amp;lt;tt&amp;gt;int&amp;lt;/tt&amp;gt;&lt;br /&gt;
* &amp;lt;tt&amp;gt;short&amp;lt;/tt&amp;gt;&lt;br /&gt;
* &amp;lt;tt&amp;gt;char&amp;lt;/tt&amp;gt;&lt;br /&gt;
* &amp;lt;tt&amp;gt;long&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;small&amp;gt;&#039;&#039;may include signed/unsigned/const qualifiers&#039;&#039;&amp;lt;/small&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* If you explicitly set the status in the method (using a test macro or a runtime call), this status will override the status that would otherwise be set by the return value&lt;br /&gt;
* If you don&#039;t explicitly set the status in the method, the return value determines the status as follows:&lt;br /&gt;
** Return is &#039;&#039;&#039;zero&#039;&#039;&#039; -&amp;gt; srTEST_PASS&lt;br /&gt;
** Return is &#039;&#039;&#039;non-zero&#039;&#039;&#039; -&amp;gt; srTEST_FAIL&lt;br /&gt;
|&lt;br /&gt;
* If the method runs to completion, the status is determined by the rules to the left (there is no default)  &lt;br /&gt;
* If the method does not run to completion (due to crash or hang in software under test), the status is srTEST_INPROGRESS&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;bool&amp;lt;/tt&amp;gt; &lt;br /&gt;
| c++ only&lt;br /&gt;
|&lt;br /&gt;
* If you explicitly set the status in the method (using a test macro or a runtime call), this status will override the status that would otherwise be set by the return value&lt;br /&gt;
* If you don&#039;t explicitly set the status in the method, the return value determines the status as follows:&lt;br /&gt;
** Return is &#039;&#039;&#039;true&#039;&#039;&#039; -&amp;gt; srTEST_PASS&lt;br /&gt;
** Return is &#039;&#039;&#039;false&#039;&#039;&#039; -&amp;gt; srTEST_FAIL&lt;br /&gt;
|&lt;br /&gt;
* If the method runs to completion, the status is determined by the rules to the left (there is no default)  &lt;br /&gt;
* If the method does not run to completion (due to crash or hang in software under test), the status is srTEST_INPROGRESS&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
&lt;br /&gt;
Following are a few short  examples. In each example, a single test unit with the name &amp;quot;MyTest&amp;quot; is  identified to the Stride compiler via [[Test Pragmas]].&lt;br /&gt;
&lt;br /&gt;
=== C++ Class  ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;MyTest.h&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;source  lang=cpp&amp;gt;&lt;br /&gt;
#include &amp;lt;srtest.h&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
class MyTest : public stride::srTest &lt;br /&gt;
{&lt;br /&gt;
public:&lt;br /&gt;
  void ExpectPass() &lt;br /&gt;
  {&lt;br /&gt;
    srNOTE_INFO(&amp;quot;this test should pass&amp;quot;);&lt;br /&gt;
    srEXPECT_EQ(2 + 2, 4); &lt;br /&gt;
  }&lt;br /&gt;
  void ExpectFail() &lt;br /&gt;
  {&lt;br /&gt;
    srNOTE_INFO(&amp;quot;this test should fail&amp;quot;);&lt;br /&gt;
    srEXPECT_GT(2 * 3, 7); &lt;br /&gt;
  }&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
#ifdef _SCL&lt;br /&gt;
// this pragma  identifies MyTest as a test class to the Stride compiler&lt;br /&gt;
#pragma scl_test_class(MyTest)&lt;br /&gt;
#endif&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== C  Class ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;MyTest.h&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source  lang=c&amp;gt;&lt;br /&gt;
#include &amp;lt;srtest.h&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
typedef struct MyTest&lt;br /&gt;
{&lt;br /&gt;
    void (*ExpectPass)(struct MyTest* self);&lt;br /&gt;
    void (*ExpectFail)(struct MyTest* self);&lt;br /&gt;
} MyTest;&lt;br /&gt;
&lt;br /&gt;
void MyTest_Init(MyTest* self);&lt;br /&gt;
&lt;br /&gt;
#ifdef _SCL&lt;br /&gt;
//  This pragma identifies MyTest as a test c class to the Stride compiler.&lt;br /&gt;
//  Extra instrumentation code will be generated to call MyTest_Init()  before&lt;br /&gt;
// tests are run.&lt;br /&gt;
#pragma scl_test_cclass(MyTest, MyTest_Init)&lt;br /&gt;
#endif&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;MyTest.c&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source  lang=&#039;c&#039;&amp;gt;&lt;br /&gt;
#include  &amp;quot;MyTest.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
static void ExpectPass(MyTest* self)&lt;br /&gt;
{&lt;br /&gt;
    srNOTE_INFO(&amp;quot;this test should pass&amp;quot;);&lt;br /&gt;
    srEXPECT_EQ(2 + 2, 4); &lt;br /&gt;
}&lt;br /&gt;
static void ExpectFail(MyTest* self)&lt;br /&gt;
{&lt;br /&gt;
    srNOTE_INFO(&amp;quot;this test should fail&amp;quot;);&lt;br /&gt;
    srEXPECT_GT(2 * 3, 7); &lt;br /&gt;
}&lt;br /&gt;
void MyTest_Init(MyTest* self)&lt;br /&gt;
{&lt;br /&gt;
    self-&amp;gt;ExpectPass = ExpectPass;&lt;br /&gt;
    self-&amp;gt;ExpectFail = ExpectFail;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Free Functions ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;MyTest.h&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=c&amp;gt;&lt;br /&gt;
#include &amp;lt;srtest.h&amp;gt;&lt;br /&gt;
void ExpectPass();&lt;br /&gt;
void ExpectFail();&lt;br /&gt;
&lt;br /&gt;
#ifdef _SCL&lt;br /&gt;
//  this pragma identifies MyTest as a test unit to the Stride compiler,  specifying&lt;br /&gt;
// the four functions as members of the test unit&lt;br /&gt;
#pragma scl_test_flist(&amp;quot;MyTest&amp;quot;, ExpectPass, ExpectFail, ChangeMyName, ChangeMyDescription)&lt;br /&gt;
#endif&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;MyTest.c&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&#039;c&#039;&amp;gt;&lt;br /&gt;
#include &amp;quot;MyTest.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
void ExpectPass()&lt;br /&gt;
{&lt;br /&gt;
    srNOTE_INFO(&amp;quot;this test should pass&amp;quot;);&lt;br /&gt;
    srEXPECT_EQ(2 + 2, 4); &lt;br /&gt;
}&lt;br /&gt;
void ExpectFail()&lt;br /&gt;
{&lt;br /&gt;
    srNOTE_INFO(&amp;quot;this test should fail&amp;quot;);&lt;br /&gt;
    srEXPECT_GT(2 * 3, 7); &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== C++ Only Features ==&lt;br /&gt;
&lt;br /&gt;
=== Use Operator &amp;lt;&amp;lt; to Augment Test Macros ===&lt;br /&gt;
&lt;br /&gt;
In C++ test code [[Test Point]], [[Test Log]] and [[Test Macros]] macros support adding to the annotation using the &amp;lt;&amp;lt; operator. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
srEXPECT_TRUE(a != b) &amp;lt;&amp;lt; &amp;quot;My custom message&amp;quot; &amp;lt;&amp;lt; &amp;quot; with more data &amp;quot; &amp;lt;&amp;lt; 1234;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As delivered, the macros will support stream input annotations for:&lt;br /&gt;
* all numeric types, &lt;br /&gt;
* C string (char* or wchar_t*), and &lt;br /&gt;
* types allowing implicit cast to numeric type or &amp;quot;C&amp;quot; string.&lt;br /&gt;
&lt;br /&gt;
=== Overloading the &amp;lt;&amp;lt; operator ===&lt;br /&gt;
&lt;br /&gt;
You can also overload the &amp;lt;&amp;lt; operator in order to annotate reports using your own custom type. An example is below.&lt;br /&gt;
&lt;br /&gt;
The following will compile and execute successfully given that the &amp;lt;&amp;lt; operator is overloaded as shown:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;srtest.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// MyCustomClass implementation&lt;br /&gt;
class MyCustomClass&lt;br /&gt;
{&lt;br /&gt;
public:&lt;br /&gt;
   MyCustomClass(int i) : m_int(i) {}&lt;br /&gt;
&lt;br /&gt;
private: &lt;br /&gt;
   int m_int; &lt;br /&gt;
   friend stride::Message&amp;amp; operator&amp;lt;&amp;lt;(stride::Message&amp;amp; ss, const MyCustomClass&amp;amp; obj);&lt;br /&gt;
}; &lt;br /&gt;
&lt;br /&gt;
stride::Message&amp;amp; operator&amp;lt;&amp;lt;(stride::Message&amp;amp; ss, const MyCustomClass&amp;amp; obj)&lt;br /&gt;
{&lt;br /&gt;
   ss &amp;lt;&amp;lt; obj.m_int;&lt;br /&gt;
   return ss;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void test()&lt;br /&gt;
{&lt;br /&gt;
    MyCustomClass custom(34); &lt;br /&gt;
&lt;br /&gt;
    srEXPECT_FALSE(true) &amp;lt;&amp;lt; custom;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ryanh</name></author>
	</entry>
	<entry>
		<id>https://www.stridewiki.com/index.php?title=Test_Macros&amp;diff=14468</id>
		<title>Test Macros</title>
		<link rel="alternate" type="text/html" href="https://www.stridewiki.com/index.php?title=Test_Macros&amp;diff=14468"/>
		<updated>2015-07-07T19:57:24Z</updated>

		<summary type="html">&lt;p&gt;Ryanh: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
The Stride implementation of [http://en.wikipedia.org/wiki/Assertion_(software_development) assertions] are provided with a set of Test Macros (declared in srtest.h) available for use within test methods. The macros are optional - you are not required to use them in your &#039;&#039;&#039;Test Units&#039;&#039;&#039;. They provide shortcuts for testing assertions and automatic report annotation in the case of failures.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example Test Macros&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;source  lang=cpp&amp;gt;&lt;br /&gt;
#include &amp;lt;mytest.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
void MyTest::CheckFoo() {&lt;br /&gt;
    ..  &lt;br /&gt;
    srEXPECT_EQ(foo(2 + 2), 4); &lt;br /&gt;
}&lt;br /&gt;
void MyTest::CheckBoo() {&lt;br /&gt;
    ..&lt;br /&gt;
    srEXPECT_GT(boo(3 * 3), 7); &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Guidelines ==&lt;br /&gt;
&lt;br /&gt;
There are three types of macros: &#039;&#039;&#039;EXPECT&#039;&#039;&#039;, &#039;&#039;&#039;ASSERT&#039;&#039;&#039;, and &#039;&#039;&#039;EXIT&#039;&#039;&#039; macros. They have slight but important differences in their behavior.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;srEXPECT_&#039;&#039;xx&#039;&#039;(&#039;&#039;&#039;&#039;&#039;condition&#039;&#039;&#039;&#039;&#039;)&#039;&#039;&#039; &lt;br /&gt;
* If the condition &amp;lt;u&amp;gt;does&amp;lt;/u&amp;gt; match the expectation, this macro:&lt;br /&gt;
** sets the current test case status to PASS&lt;br /&gt;
* If the condition &amp;lt;u&amp;gt;does not&amp;lt;/u&amp;gt; match the expectation, this macro:&lt;br /&gt;
** sets the current test case status to FAIL&lt;br /&gt;
** adds a comment to the current test case&#039;s results report which includes the condition as well as file and line number&lt;br /&gt;
** does not alter code execution  &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;srASSERT_&#039;&#039;xx&#039;&#039;(&#039;&#039;&#039;&#039;&#039;condition&#039;&#039;&#039;&#039;&#039;)&#039;&#039;&#039; &lt;br /&gt;
* If the condition &amp;lt;u&amp;gt;does&amp;lt;/u&amp;gt; match the assertion, this macro:&lt;br /&gt;
** sets the current test case status to PASS&lt;br /&gt;
* If the condition &amp;lt;u&amp;gt;does not&amp;lt;/u&amp;gt; match the expectation, this macro:&lt;br /&gt;
** sets the current test case status to FAIL &lt;br /&gt;
** adds a comment to the current test case&#039;s results report which includes the condition as well as file and line number&lt;br /&gt;
** &amp;lt;u&amp;gt;immediately returns&amp;lt;/u&amp;gt; from the current test function. The return specifies no value, therefore a function or method that uses &amp;lt;tt&amp;gt;srASSERT_xx&amp;lt;/tt&amp;gt; &amp;lt;u&amp;gt;should be declared to return &amp;lt;tt&amp;gt;void&amp;lt;/tt&amp;gt;&amp;lt;/u&amp;gt;. &amp;lt;i&amp;gt;In case when a test function is required to return other type then &amp;lt;tt&amp;gt;void&amp;lt;/tt&amp;gt;, a simple trick could be applied - in &amp;lt;b&amp;gt;C++ test code&amp;lt;/b&amp;gt; postpend any value of the required type using the &amp;lt;u&amp;gt;C/C++ &amp;lt;tt&amp;gt;comma&amp;lt;/tt&amp;gt; operator&amp;lt;/u&amp;gt; (e.g. &amp;lt;tt&amp;gt;srASSERT_TRUE(cond),1;&amp;lt;/tt&amp;gt;); in &amp;lt;b&amp;gt;C only test code&amp;lt;/b&amp;gt; postpend the value &amp;lt;u&amp;gt;space&amp;lt;/u&amp;gt; separated (e.g. &amp;lt;tt&amp;gt;srASSERT_TRUE(cond) 1;&amp;lt;/tt&amp;gt;).&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;srEXIT_&#039;&#039;xx&#039;&#039;(&#039;&#039;&#039;&#039;&#039;condition&#039;&#039;&#039;&#039;&#039;)&#039;&#039;&#039; &lt;br /&gt;
* The behavior and restrictions of the exit macros are identical to the &#039;&#039;&#039;ASSERT&#039;&#039;&#039; macros. &#039;&#039;&#039;EXIT&#039;&#039;&#039; macros differ only in that they cause the test unit to cease execution. That is, no subsequent test methods within the currently running test unit are executed once an EXIT macro has failed in its assertion. This macro is useful in test units that implement behavioral testing where each test methods depends on the successful completion of the preceding test method.&lt;br /&gt;
* If a teardown fixture is declared, and the srEXIT_xx() fires within a test method, the teardown method will be called.&lt;br /&gt;
* If srEXIT_xx() fires within a scl_test_cclass test unit, its de-init function will be called if declared.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note that the supplemental information is put into the test report only if the macro fails. For example &amp;lt;tt&amp;gt;srEXPECT_EQ(a, 10)&amp;lt;/tt&amp;gt;, if a equals 10, then no action is taken; if a is not equal to 10, then the normal srEXPECT actions are taken, and--in addition--the supplemental information is added to the failure record in the test report. The &#039;&#039;srEXIT_xx()&#039;&#039; macro does not support this feature. &lt;br /&gt;
&lt;br /&gt;
The following sections document the several types of testing macros that are provided by the Stride Framework. For simplicity, we refer to all the macros using a &#039;&#039;&#039;&#039;&#039;prefix&#039;&#039;&#039;&#039;&#039; tag - when using the macros in test code, the &#039;&#039;&#039;&#039;&#039;prefix&#039;&#039;&#039;&#039;&#039; should be replaced by one of the following: &#039;&#039;&#039;srEXPECT&#039;&#039;&#039;, &#039;&#039;&#039;srASSERT&#039;&#039;&#039;, or &#039;&#039;&#039;srEXIT&#039;&#039;&#039;, depending on how the test writer wants failures to be handled.&lt;br /&gt;
&lt;br /&gt;
== Boolean Macros ==&lt;br /&gt;
The boolean macros take a single condition expression, &#039;&#039;cond&#039;&#039;, that evaluates to an integral type or bool. &lt;br /&gt;
&lt;br /&gt;
The condition will be evaluated once. When a failure is detected, the report will be annotated. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;prettytable&amp;quot;&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; | &#039;&#039;&#039;Boolean&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
|- &lt;br /&gt;
! macro !! Pass if&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;&#039;&#039;prefix&#039;&#039;&#039;&#039;&#039;_TRUE(&#039;&#039;cond&#039;&#039;);&lt;br /&gt;
| &#039;&#039;cond&#039;&#039; is non-zero&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;&#039;&#039;prefix&#039;&#039;&#039;&#039;&#039;_FALSE(&#039;&#039;cond&#039;&#039;);&lt;br /&gt;
| &#039;&#039;cond&#039;&#039; is zero&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Example ====&lt;br /&gt;
&amp;lt;source lang=&#039;c&#039;&amp;gt;&lt;br /&gt;
int a = 5; &lt;br /&gt;
int b = 5; &lt;br /&gt;
srEXPECT_TRUE(a == b); &lt;br /&gt;
&lt;br /&gt;
srEXPECT_FALSE(2 &amp;lt; 1);&lt;br /&gt;
&lt;br /&gt;
srEXPECT_FALSE(a != b);&lt;br /&gt;
srEXPECT_TRUE(1 &amp;lt; 2); &lt;br /&gt;
srEXPECT_TRUE(1);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039; &#039;&#039;Hint:&#039;&#039; A simple way to add supplemental information to test failures&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the &#039;&#039;&#039;C++ compiler mode&#039;&#039;&#039; is enabled then the &#039;&#039;srEXPECT_xx()&#039;&#039; and &#039;&#039;srASSERT_xx()&#039;&#039; macros also support adding to a test&#039;s annotations using the &#039;&#039;&#039;&amp;lt;&amp;lt; operator&#039;&#039;&#039;. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
srEXPECT_TRUE(a == 10) &amp;lt;&amp;lt; &amp;quot;My custom message&amp;quot; &amp;lt;&amp;lt; &amp;quot; a equals: &amp;quot; &amp;lt;&amp;lt; a;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Comparison Macros ==&lt;br /&gt;
&lt;br /&gt;
Comparison macros take two operands and compare them using the indicated operator. &lt;br /&gt;
&lt;br /&gt;
The comparison macros will work for scalar types as well as C++ objects that have the corresponding comparison operator implemented.  &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;prettytable&amp;quot;&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; | &#039;&#039;&#039;Comparison&#039;&#039;&#039;&lt;br /&gt;
|- &lt;br /&gt;
! macro !! Pass if&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;&#039;&#039;prefix&#039;&#039;&#039;&#039;&#039;_EQ(&#039;&#039;val1&#039;&#039;, &#039;&#039;val2&#039;&#039;);&lt;br /&gt;
| &#039;&#039;val1&#039;&#039; == &#039;&#039;val2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;&#039;&#039;prefix&#039;&#039;&#039;&#039;&#039;_NE(&#039;&#039;val1&#039;&#039;, &#039;&#039;val2&#039;&#039;);&lt;br /&gt;
| &#039;&#039;val1&#039;&#039; != &#039;&#039;val2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;&#039;&#039;prefix&#039;&#039;&#039;&#039;&#039;_LT(&#039;&#039;val1&#039;&#039;, &#039;&#039;val2&#039;&#039;);&lt;br /&gt;
| &#039;&#039;val1&#039;&#039;&amp;lt;nowiki&amp;gt; &amp;lt; &amp;lt;/nowiki&amp;gt;&#039;&#039;val2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;&#039;&#039;prefix&#039;&#039;&#039;&#039;&#039;_LE(&#039;&#039;val1&#039;&#039;, &#039;&#039;val2&#039;&#039;);&lt;br /&gt;
| &#039;&#039;val1&#039;&#039;&amp;lt;nowiki&amp;gt; &amp;lt;= &amp;lt;/nowiki&amp;gt;&#039;&#039;val2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;&#039;&#039;prefix&#039;&#039;&#039;&#039;&#039;_GT(&#039;&#039;val1&#039;&#039;, &#039;&#039;val2&#039;&#039;);&lt;br /&gt;
| &#039;&#039;val1&#039;&#039; &amp;gt; &#039;&#039;val2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;&#039;&#039;prefix&#039;&#039;&#039;&#039;&#039;_GE(&#039;&#039;val1&#039;&#039;, &#039;&#039;val2&#039;&#039;);&lt;br /&gt;
| &#039;&#039;val1&#039;&#039; &amp;gt;= &#039;&#039;val2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Example ====&lt;br /&gt;
&amp;lt;source lang=&#039;c&#039;&amp;gt;&lt;br /&gt;
int a = 5; &lt;br /&gt;
int b = 5; &lt;br /&gt;
&lt;br /&gt;
srEXPECT_EQ( 4, 4 ); &lt;br /&gt;
srEXPECT_NE( 6, 7 );&lt;br /&gt;
srEXPECT_EQ( a, b ); &lt;br /&gt;
srEXPECT_GT( 2 , 1 );&lt;br /&gt;
srEXPECT_GE( 2 , 1 );&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== C String Comparison Macros ==&lt;br /&gt;
&lt;br /&gt;
C String Comparison Macros are intended only for use with C-style null terminated strings. The strings can be char or wchar_t based. &lt;br /&gt;
&lt;br /&gt;
Don&#039;t use these macros to compare C++ objects representing strings since such classes typically have overloaded comparison operators. The standard comparison macros should be used instead. &lt;br /&gt;
&lt;br /&gt;
* An empty string will appear in error message output as “”. A null string will appear as NULL with no surrounding quotes. Otherwise all output strings are quoted. &lt;br /&gt;
* The type of str1 and str2 must be compatible with &#039;&#039;const char*&#039;&#039; or &#039;&#039;const wchar_t*&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;prettytable&amp;quot;&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; | &#039;&#039;&#039;C-string comparison&#039;&#039;&#039;&lt;br /&gt;
|- &lt;br /&gt;
! macro !! Pass if&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;&#039;&#039;prefix&#039;&#039;&#039;&#039;&#039;_STREQ(&#039;&#039;str1&#039;&#039;, &#039;&#039;str2&#039;&#039;);&lt;br /&gt;
| &#039;&#039;str1&#039;&#039; and &#039;&#039;str2&#039;&#039; have the same content&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;&#039;&#039;prefix&#039;&#039;&#039;&#039;&#039;_STRNE(&#039;&#039;str1&#039;&#039;, &#039;&#039;str2&#039;&#039;);&lt;br /&gt;
| &#039;&#039;str1&#039;&#039; and &#039;&#039;str2&#039;&#039; have different content&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;&#039;&#039;prefix&#039;&#039;&#039;&#039;&#039;_STRCASEEQ(&#039;&#039;str1&#039;&#039;, &#039;&#039;str2&#039;&#039;);&lt;br /&gt;
| &#039;&#039;str1&#039;&#039; and &#039;&#039;str2&#039;&#039; have the same content, ignoring case.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;&#039;&#039;prefix&#039;&#039;&#039;&#039;&#039;_STRCASENE(&#039;&#039;str1&#039;&#039;, &#039;&#039;str2&#039;&#039;);&lt;br /&gt;
| &#039;&#039;str1&#039;&#039; and &#039;&#039;str2&#039;&#039; have different content, ignoring case.&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Example ====&lt;br /&gt;
&amp;lt;source lang=&#039;c&#039;&amp;gt;&lt;br /&gt;
const char* s1 = &amp;quot;This String is unique&amp;quot;; &lt;br /&gt;
const char* s2 = &amp;quot;This String has an equivalent&amp;quot;; &lt;br /&gt;
const char* s2Twin = &amp;quot;This String has an equivalent&amp;quot;; &lt;br /&gt;
const char* s2TwinNoCase = &amp;quot;this string has an equivalent&amp;quot;; &lt;br /&gt;
&lt;br /&gt;
srEXPECT_STREQ( s2, s2Twin); &lt;br /&gt;
srEXPECT_STREQ( s2, &amp;quot;This String has an equivalent&amp;quot;); &lt;br /&gt;
srEXPECT_STRCASEEQ(s2, s2TwinNoCase); &lt;br /&gt;
&lt;br /&gt;
srEXPECT_STRNE(s1, s2);  &lt;br /&gt;
srEXPECT_STRNE(s2, s2TwinNoCase); &lt;br /&gt;
srEXPECT_STRCASENE(s1, s2);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Predicate Macros ==&lt;br /&gt;
Predicate macros allow user control over the pass/fail decision making. &lt;br /&gt;
&lt;br /&gt;
A predicate is a function returning bool that is implemented by the user. Up to four arguments can also passed to the predicate through the macro.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;prettytable&amp;quot;&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; | &#039;&#039;&#039;Predicates&#039;&#039;&#039;&lt;br /&gt;
|- &lt;br /&gt;
! macro !! Pass if&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;&#039;&#039;prefix&#039;&#039;&#039;&#039;&#039;_PRED1(&#039;&#039;pred&#039;&#039;, &#039;&#039;val1&#039;&#039;)&lt;br /&gt;
| &#039;&#039;pred&#039;&#039;(&#039;&#039;val1&#039;&#039;) returns true&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;&#039;&#039;prefix&#039;&#039;&#039;&#039;&#039;_PRED2(&#039;&#039;pred&#039;&#039;, &#039;&#039;val1&#039;&#039;, &#039;&#039;val2&#039;&#039;)&lt;br /&gt;
| &#039;&#039;pred&#039;&#039;(&#039;&#039;val1&#039;&#039;, &#039;&#039;val2&#039;&#039;) returns true&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| …(up to arity of 4)&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Example ====&lt;br /&gt;
&amp;lt;source lang=&#039;c&#039;&amp;gt;&lt;br /&gt;
static int alwaysTrueOneArg(int i)&lt;br /&gt;
{&lt;br /&gt;
    return 1; &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
static int alwaysTrueTwoArgs(int i, int j)&lt;br /&gt;
{&lt;br /&gt;
    return 1;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
static void Pass()&lt;br /&gt;
{&lt;br /&gt;
    // examples of passing expectations using predicates.&lt;br /&gt;
&lt;br /&gt;
    srEXPECT_PRED1(alwaysTrueOneArg, 25); &lt;br /&gt;
    srEXPECT_PRED2(alwaysTrueTwoArgs, 100, 33); &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Floating Point Comparison Macros ==&lt;br /&gt;
Floating point macros are for comparing equivalence (or near equivalence) of floating point numbers. &lt;br /&gt;
&lt;br /&gt;
These macros are are very useful for dealing with floating point round-off effects. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;prettytable&amp;quot;&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; | &#039;&#039;&#039;Floating Point comparison&#039;&#039;&#039;&lt;br /&gt;
|- &lt;br /&gt;
! macro !! Pass if&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;&#039;&#039;prefix&#039;&#039;&#039;&#039;&#039;_NEAR(val1, val2, epsilon);&lt;br /&gt;
| The absolute value of the difference between val1 and val2 is less than or equal to epsilon.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Example ====&lt;br /&gt;
&amp;lt;source lang=&#039;c&#039;&amp;gt;&lt;br /&gt;
float x =           2.00005f;&lt;br /&gt;
float nearX =       2.00006f; &lt;br /&gt;
float nearXEpsilon = .000019f;&lt;br /&gt;
&lt;br /&gt;
double y =           1.2345; &lt;br /&gt;
double nearY =       1.23456; &lt;br /&gt;
double nearYEpsilon = .00019;&lt;br /&gt;
    &lt;br /&gt;
srEXPECT_NEAR(x, nearX, nearXEpsilon); &lt;br /&gt;
srEXPECT_NEAR(y, nearY, nearYEpsilon);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Exception Macros ==&lt;br /&gt;
Exception macros are used to ensure that expected exceptions are thrown. They are applicable to &amp;lt;u&amp;gt;C++ code only&amp;lt;/u&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
These macros require exception support from the target compiler. If the target compiler does not have exception support the macros cannot be used.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;prettytable&amp;quot;&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; | &#039;&#039;&#039;Exceptions&#039;&#039;&#039;&lt;br /&gt;
|- &lt;br /&gt;
! macro !! Pass if&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;&#039;&#039;prefix&#039;&#039;&#039;&#039;&#039;_THROW(statement, ex_type);&lt;br /&gt;
| &#039;&#039;statement&#039;&#039; throws an exception of type &#039;&#039;ex_type&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;&#039;&#039;prefix&#039;&#039;&#039;&#039;&#039;_THROW_ANY(&#039;&#039;statement&#039;&#039;);&lt;br /&gt;
| &#039;&#039;statement&#039;&#039; throws an exception (type not important)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;&#039;&#039;prefix&#039;&#039;&#039;&#039;&#039;_NO_THROW(&#039;&#039;statement&#039;&#039;);&lt;br /&gt;
| &#039;&#039;statement&#039;&#039; does not throw an exception&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===== Example =====&lt;br /&gt;
&amp;lt;source lang=&#039;cpp&#039;&amp;gt;&lt;br /&gt;
srEXPECT_THROW(throwStdException(), std::exception); &lt;br /&gt;
srEXPECT_THROW(throwInt(), int);&lt;br /&gt;
&lt;br /&gt;
srEXPECT_THROW_ANY(throwStdException()); &lt;br /&gt;
srEXPECT_THROW_ANY(throwInt()); &lt;br /&gt;
&lt;br /&gt;
srEXPECT_NO_THROW(doesntThrow()); &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Dynamic Test Case Macros ==&lt;br /&gt;
The macros presented so far assume that their actions are directed at the currently in-scope test case. However, test cases can be created dynamically using Stride&#039;s [Runtime Test Services]. &lt;br /&gt;
&lt;br /&gt;
In order to handle dynamic test cases, each of the macros requires another parameter which specifies the test case to report against. Other than this, these macros provide exactly equivalent functionality to the non-dynamic peer. The dynamic macros are listed below. All require a test case, value of type &#039;&#039;&#039;srTestCaseHandle_t&#039;&#039;&#039; from srtest.h, to be passed as the first parameter).&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;prettytable&amp;quot;&lt;br /&gt;
! macro &lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;1&amp;quot; | &#039;&#039;&#039;Boolean&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;&#039;&#039;prefix&#039;&#039;&#039;&#039;&#039;_TRUE_DYN(tc, &#039;&#039;cond&#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;&#039;&#039;prefix&#039;&#039;&#039;&#039;&#039;_FALSE_DYN(tc, &#039;&#039;cond&#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;1&amp;quot; | &#039;&#039;&#039;Comparison&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;&#039;&#039;prefix&#039;&#039;&#039;&#039;&#039;_EQ_DYN(tc, &#039;&#039;val1&#039;&#039;, &#039;&#039;val2&#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;&#039;&#039;prefix&#039;&#039;&#039;&#039;&#039;_NE_DYN(tc, &#039;&#039;val1&#039;&#039;, &#039;&#039;val2&#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;&#039;&#039;prefix&#039;&#039;&#039;&#039;&#039;_LT_DYN(tc, &#039;&#039;val1&#039;&#039;, &#039;&#039;val2&#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;&#039;&#039;prefix&#039;&#039;&#039;&#039;&#039;_LE_DYN(tc, &#039;&#039;val1&#039;&#039;, &#039;&#039;val2&#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;&#039;&#039;prefix&#039;&#039;&#039;&#039;&#039;_GT_DYN(tc, &#039;&#039;val1&#039;&#039;, &#039;&#039;val2&#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;&#039;&#039;prefix&#039;&#039;&#039;&#039;&#039;_GE_DYN(tc, &#039;&#039;val1&#039;&#039;, &#039;&#039;val2&#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;1&amp;quot; | &#039;&#039;&#039;C-string comparison&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;&#039;&#039;prefix&#039;&#039;&#039;&#039;&#039;_STREQ_DYN(tc, &#039;&#039;str1&#039;&#039;, &#039;&#039;str2&#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;&#039;&#039;prefix&#039;&#039;&#039;&#039;&#039;_STRNE_DYN(tc, &#039;&#039;str1&#039;&#039;, &#039;&#039;str2&#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;&#039;&#039;prefix&#039;&#039;&#039;&#039;&#039;_STRCASEEQ_DYN(tc, &#039;&#039;str1&#039;&#039;, &#039;&#039;str2&#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;&#039;&#039;prefix&#039;&#039;&#039;&#039;&#039;_STRCASENE_DYN(tc, &#039;&#039;str1&#039;&#039;, &#039;&#039;str2&#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;1&amp;quot; | &#039;&#039;&#039;Exceptions&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;&#039;&#039;prefix&#039;&#039;&#039;&#039;&#039;_THROW_DYN(statement, ex_type);&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;&#039;&#039;prefix&#039;&#039;&#039;&#039;&#039;_THROW_ANY_DYN(tc, &#039;&#039;statement&#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;&#039;&#039;prefix&#039;&#039;&#039;&#039;&#039;_NO_THROW_DYN(tc, &#039;&#039;statement&#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;1&amp;quot; | &#039;&#039;&#039;Predicates&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;&#039;&#039;prefix&#039;&#039;&#039;&#039;&#039;_PRED1_DYN(tc, &#039;&#039;pred&#039;&#039;, &#039;&#039;val1&#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;&#039;&#039;prefix&#039;&#039;&#039;&#039;&#039;_PRED2_DYN(tc, &#039;&#039;pred&#039;&#039;, &#039;&#039;vall&#039;&#039;, &#039;&#039;val2&#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| …(up to arity of 4)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;1&amp;quot; | &#039;&#039;&#039;Floating Point&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;&#039;&#039;prefix&#039;&#039;&#039;&#039;&#039;_NEAR_DYN(tc, &#039;&#039;val1&#039;&#039;, &#039;&#039;val2&#039;&#039;, &#039;&#039;epsilon&#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Ryanh</name></author>
	</entry>
	<entry>
		<id>https://www.stridewiki.com/index.php?title=Runtime_Test_Services&amp;diff=14467</id>
		<title>Runtime Test Services</title>
		<link rel="alternate" type="text/html" href="https://www.stridewiki.com/index.php?title=Runtime_Test_Services&amp;diff=14467"/>
		<updated>2015-07-07T19:54:07Z</updated>

		<summary type="html">&lt;p&gt;Ryanh: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
The Runtime Test Services (declared in &#039;&#039;&#039;srtest.h&#039;&#039;&#039;) are a set of APIs in the Stride Runtime that facilitate the writing of target based test code. These APIs make up an optional portion of the Stride Runtime and can be used to communicate additional information about tests to the host based reporting mechanism. These APIs also allow target test code to create additional test suites and test cases dynamically at runtime. &lt;br /&gt;
&lt;br /&gt;
There are two ways of accessing these APIs: through C-based functions, or through a C++ base class from which you may derive your C++ test class. These are discussed below in [[#C Test Functions|C Test Functions]], and [[#C++ Test Classes|C++ Test Classes]] sections below.&lt;br /&gt;
&lt;br /&gt;
= C Test Functions =&lt;br /&gt;
&lt;br /&gt;
The following C APIs are provided: &lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;[[#srTestGetParam|srTestGetParam]]&#039;&#039;&#039;: returns an input parameters value.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;[[#srTestSuiteAddCase|srTestSuiteAddCase]]&#039;&#039;&#039;: creates an additional test case at runtime.&lt;br /&gt;
*&#039;&#039;&#039;[[#srTestSuiteAddAnnotation|srTestSuiteAddAnnotation]]&#039;&#039;&#039;: creates a suite annotation at runtime. &lt;br /&gt;
*&#039;&#039;&#039;[[#srTestSuiteSetData|srTestSuiteSetData]]&#039;&#039;&#039;: associates a custom name|value. &lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;[[#srTestCaseSetStatus|srTestCaseSetStatus]]&#039;&#039;&#039;: explicitly sets the status for the specified test case.&lt;br /&gt;
*&#039;&#039;&#039;[[#srTestCaseAddAnnotation|srTestCaseAddAnnotation]]&#039;&#039;&#039;: creates a test case annotation at runtime. &lt;br /&gt;
*&#039;&#039;&#039;[[#srTestSuiteSetData|srTestSuiteSetData]]&#039;&#039;&#039;: associates a custom name|value pair with the specified test case. &lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;[[#srTestAnnotationAddComment|srTestAnnotationAddComment]]&#039;&#039;&#039;: adds a comment to the specified annotation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== srTestGetParam ==&lt;br /&gt;
The srTestGetParam() function is used to get the value of a named parameter as a string.&lt;br /&gt;
&amp;lt;source lang=c&amp;gt;&lt;br /&gt;
srWORD srTestGetParam(const srCHAR * szName, srCHAR * szValue, srDWORD dwSize, const srCHAR * szDefValue);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;align:left;&amp;quot;  &lt;br /&gt;
| &#039;&#039;&#039;Parameters&#039;&#039;&#039; &lt;br /&gt;
| &#039;&#039;&#039;Type&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| szName &lt;br /&gt;
| Input&lt;br /&gt;
| Pointer to a null-terminated string that represents the name of the parameter. Cannot be null.&lt;br /&gt;
|-&lt;br /&gt;
| szValue &lt;br /&gt;
| Output &lt;br /&gt;
| Pointer to a block of memory to store the value of the parameter with a maximum size of &amp;lt;i&amp;gt;dwSize&amp;lt;/i&amp;gt; chars&lt;br /&gt;
|-&lt;br /&gt;
| dwSize &lt;br /&gt;
| Input &lt;br /&gt;
| Size in chars of the buffer pointed to by &amp;lt;i&amp;gt;szValue&amp;lt;/i&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| szDefValue &lt;br /&gt;
| Input (optional) &lt;br /&gt;
| Pointer to a null-terminated string that represents a default value in case the parameter is not specified. By setting this value to srNULL (or omitting it), you can use &amp;lt;i&amp;gt;srTestGetParam()&amp;lt;/i&amp;gt; to test for the existence of a named parameter. If the named parameter doesn&#039;t exist, the function will return &amp;lt;i&amp;gt;srERR_HANDLE_INVALID&amp;lt;/i&amp;gt;.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;align:left;&amp;quot;&lt;br /&gt;
| &#039;&#039;&#039;Return Value&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039; Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| srOK &lt;br /&gt;
| Success&lt;br /&gt;
|-&lt;br /&gt;
| srERR &lt;br /&gt;
| Null or empty szName string passed in.&lt;br /&gt;
|-&lt;br /&gt;
| srERR_HANDLE_INVALID&lt;br /&gt;
| The named parameter is not found and &amp;lt;i&amp;gt;szDefValue&amp;lt;/i&amp;gt; is set to srNULL.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=c&amp;gt;&lt;br /&gt;
#include &amp;lt;srtest.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#define MAX_VALUE_LEN 128&lt;br /&gt;
void tfsuite_getParam(void)&lt;br /&gt;
{&lt;br /&gt;
  srCHAR szValue[MAX_VALUE_LEN] = {0};&lt;br /&gt;
&lt;br /&gt;
  srWORD wRet = srTestGetParam(&amp;quot;ParamName&amp;quot;, szValue, MAX_VALUE_LEN, &amp;quot;default value&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#ifdef _SCL&lt;br /&gt;
#pragma scl_test_flist(&amp;quot;testfunc&amp;quot;, tfsuite_getParam)&lt;br /&gt;
#endif&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== srTestGetParamLong ==&lt;br /&gt;
The srTestGetParamLong() function is used to get the value of a named parameter as a long.&lt;br /&gt;
&amp;lt;source lang=c&amp;gt;&lt;br /&gt;
srLONG srTestGetParamLong(const srCHAR * szName, srLONG lDefValue);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;align:left;&amp;quot;  &lt;br /&gt;
| &#039;&#039;&#039;Parameters&#039;&#039;&#039; &lt;br /&gt;
| &#039;&#039;&#039;Type&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| szName &lt;br /&gt;
| Input&lt;br /&gt;
| Pointer to a null-terminated string that represents the name of the parameter.&lt;br /&gt;
|-&lt;br /&gt;
| lDefValue&lt;br /&gt;
| Input &lt;br /&gt;
| Default value that is returned if the parameter is not found.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;align:left;&amp;quot;&lt;br /&gt;
| &#039;&#039;&#039;Return Value&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039; Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| srLONG&lt;br /&gt;
| Parameter value, or value specified by &amp;lt;i&amp;gt;lDefValue&amp;lt;/i&amp;gt; if parameter isn&#039;t found.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=c&amp;gt;&lt;br /&gt;
#include &amp;lt;srtest.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
void tfsuite_getParam(void)&lt;br /&gt;
{&lt;br /&gt;
  srLONG lVal = srTestGetParamLong(&amp;quot;ParamName&amp;quot;, -1);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#ifdef _SCL&lt;br /&gt;
#pragma scl_test_flist(&amp;quot;testfunc&amp;quot;, tfsuite_getParam)&lt;br /&gt;
#endif&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== srTestGetParamDouble ==&lt;br /&gt;
The srTestGetParamDouble() function is used to get the value of a named parameter as a double.&lt;br /&gt;
&amp;lt;source lang=c&amp;gt;&lt;br /&gt;
double srTestGetParamDouble(const srCHAR * szName, double dbDefValue);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;align:left;&amp;quot;  &lt;br /&gt;
| &#039;&#039;&#039;Parameters&#039;&#039;&#039; &lt;br /&gt;
| &#039;&#039;&#039;Type&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| szName &lt;br /&gt;
| Input&lt;br /&gt;
| Pointer to a null-terminated string that represents the name of the parameter.&lt;br /&gt;
|-&lt;br /&gt;
| dbDefValue&lt;br /&gt;
| Input &lt;br /&gt;
| Default value that is returned if the parameter is not found.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;align:left;&amp;quot;&lt;br /&gt;
| &#039;&#039;&#039;Return Value&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039; Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| double&lt;br /&gt;
| Parameter value, or value specified by &amp;lt;i&amp;gt;dbDefValue&amp;lt;/i&amp;gt; if parameter isn&#039;t found.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=c&amp;gt;&lt;br /&gt;
#include &amp;lt;srtest.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
void tfsuite_getParam(void)&lt;br /&gt;
{&lt;br /&gt;
  double dbVal = srTestGetParamDouble(&amp;quot;ParamName&amp;quot;, 0.5772156649);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#ifdef _SCL&lt;br /&gt;
#pragma scl_test_flist(&amp;quot;testfunc&amp;quot;, tfsuite_getParam)&lt;br /&gt;
#endif&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== srTestSuiteAddCase ==&lt;br /&gt;
The srTestSuiteAddCase() routine is used to add a new test case to the specified test suite.&lt;br /&gt;
&amp;lt;source lang=c&amp;gt;&lt;br /&gt;
srTestCaseHandle_t srTestSuiteAddCase(const srCHAR * szName, const srCHAR * szDescr)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;align:left;&amp;quot;  &lt;br /&gt;
| &#039;&#039;&#039;Parameters&#039;&#039;&#039; &lt;br /&gt;
| &#039;&#039;&#039;Type&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| szName &lt;br /&gt;
| Input &lt;br /&gt;
| Pointer to a null-terminated string that represents the name of the new test case. If null, the default host naming scheme will be used.&lt;br /&gt;
|-&lt;br /&gt;
| szDescr &lt;br /&gt;
| Input&lt;br /&gt;
| Pointer to a null-terminated string representing the description of the new test case. If null, description will be empty.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;align:left;&amp;quot;&lt;br /&gt;
| &#039;&#039;&#039;Return Value&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039; Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| srTestCaseHandle_t &lt;br /&gt;
| Handle of the newly created test case. srTEST_CASE_INVALID indicates failure to create a test case.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=c&amp;gt;&lt;br /&gt;
#include &amp;lt;srtest.h&amp;gt;&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
void tfsuite_addCase(void)&lt;br /&gt;
{&lt;br /&gt;
  for (int count = 0; count &amp;lt; 5; ++count)&lt;br /&gt;
  {&lt;br /&gt;
    char szName[25];&lt;br /&gt;
    sprintf(szName, &amp;quot;dynamic test case %d&amp;quot;, count);&lt;br /&gt;
    srTestCaseHandle_t test = srTestSuiteAddCase(szName, &amp;quot;this is a dynamic test case&amp;quot;);&lt;br /&gt;
    srTestCaseSetStatus(test, srTEST_PASS, 0); &lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#ifdef _SCL&lt;br /&gt;
#pragma scl_test_flist(&amp;quot;testfunc&amp;quot;, tfsuite_addCase)&lt;br /&gt;
#endif&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== srTestSuiteAddAnnotation ==&lt;br /&gt;
The srTestSuiteAddAnnotation() routine is used to add a new annotation to the specified test suite.&lt;br /&gt;
&amp;lt;source lang=c&amp;gt;&lt;br /&gt;
srTestAnnotationHandle_t srTestSuiteAddAnnotation(srTestAnnotationLevel_e eLevel,&lt;br /&gt;
                                                  const srCHAR * szName, &lt;br /&gt;
                                                  const srCHAR * szFmtDescr, ...)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;align:left;&amp;quot;  &lt;br /&gt;
| &#039;&#039;&#039;Parameters&#039;&#039;&#039; &lt;br /&gt;
| &#039;&#039;&#039;Type&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| eLevel&lt;br /&gt;
| Input &lt;br /&gt;
| Annotation level. &lt;br /&gt;
&lt;br /&gt;
* srTEST_ANNOTATION_LEVEL_TRACE,&lt;br /&gt;
* srTEST_ANNOTATION_LEVEL_DEBUG,&lt;br /&gt;
* srTEST_ANNOTATION_LEVEL_INFO,&lt;br /&gt;
* srTEST_ANNOTATION_LEVEL_WARN,&lt;br /&gt;
* srTEST_ANNOTATION_LEVEL_ERROR,&lt;br /&gt;
* srTEST_ANNOTATION_LEVEL_FATAL&lt;br /&gt;
|-&lt;br /&gt;
| szName &lt;br /&gt;
| Input &lt;br /&gt;
| Pointer to a null-terminated string representing the name of the new annotation. If null, the default host naming scheme will be used.&lt;br /&gt;
|-&lt;br /&gt;
| szFmtDescr&lt;br /&gt;
| Input &lt;br /&gt;
| Pointer to a null-terminated string representing the description of the new annotation. Cannot be null.&lt;br /&gt;
|-&lt;br /&gt;
| ... &lt;br /&gt;
| Input (Optional)&lt;br /&gt;
| Variable argument list to format szFmtDescr.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;align:left;&amp;quot;&lt;br /&gt;
| &#039;&#039;&#039;Return Value&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039; Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| srTestAnnotationHandle_t &lt;br /&gt;
| Handle of the newly created test annotation. srTEST_ANNOTATION_INVALID indicates failure to create a test annotation.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=c&amp;gt;&lt;br /&gt;
#include &amp;lt;srtest.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
void tfsuite_addAnnotation(void) &lt;br /&gt;
{&lt;br /&gt;
  for (int count = 0; count &amp;lt; 5; ++count)&lt;br /&gt;
  {&lt;br /&gt;
    char szName[25];&lt;br /&gt;
    sprintf(szName, &amp;quot;annotation %d&amp;quot;, count);&lt;br /&gt;
    srTestAnnotationHandle_t annot = &lt;br /&gt;
                     srTestSuiteAddAnnotation(srTEST_ANNOTATION_LEVEL_ERROR,&lt;br /&gt;
                                              szName,&lt;br /&gt;
                                              &amp;quot;description of annotation&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#ifdef _SCL&lt;br /&gt;
#pragma scl_test_flist(&amp;quot;testfunc&amp;quot;, tfsuite_addAnnotation)&lt;br /&gt;
#endif&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== srTestSuiteSetData ==&lt;br /&gt;
The srTestSuiteSetData() routine is used to associate a custom name|value pair with a test suite.&lt;br /&gt;
&amp;lt;source lang=c&amp;gt;&lt;br /&gt;
srWORD srTestSuiteSetData(const srCHAR * szName, const srCHAR * szFmtValue, ...)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;align:left;&amp;quot;  &lt;br /&gt;
| &#039;&#039;&#039;Parameters&#039;&#039;&#039; &lt;br /&gt;
| &#039;&#039;&#039;Type&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| szName &lt;br /&gt;
| Input&lt;br /&gt;
| Pointer to a null-terminated string representing the name of the custom pair. Cannot be null.&lt;br /&gt;
|-&lt;br /&gt;
| szFmtValue&lt;br /&gt;
| Input &lt;br /&gt;
| Pointer to a null-terminated string representing the value of the custom pair. Cannot be null.&lt;br /&gt;
|-&lt;br /&gt;
| ... &lt;br /&gt;
| Input (Optional)&lt;br /&gt;
| Variable argument list to format szFmtValue.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;align:left;&amp;quot;&lt;br /&gt;
| &#039;&#039;&#039;Return Value&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039; Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| srWORD &lt;br /&gt;
| srOK on success, srERR_HANDLE_INVALID on invalid handle.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=c&amp;gt;&lt;br /&gt;
#include &amp;lt;srtest.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
void tfcase_setData(void)&lt;br /&gt;
{&lt;br /&gt;
  srTestSuiteSetData(&amp;quot;MyName&amp;quot;, &amp;quot;my value&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#ifdef _SCL&lt;br /&gt;
#pragma scl_test_flist(&amp;quot;testfunc&amp;quot;, tfcase_setData)&lt;br /&gt;
#endif&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== srTestCaseSetStatus ==&lt;br /&gt;
The srTestCaseSetStatus() routine is used to set the result of test case.&lt;br /&gt;
&amp;lt;source lang=c&amp;gt;&lt;br /&gt;
srWORD srTestCaseSetStatus(srTestCaseHandle_t tTestCase, srTestStatus_e eStatus, srDWORD dwDuration)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;align:left;&amp;quot;  &lt;br /&gt;
| &#039;&#039;&#039;Parameters&#039;&#039;&#039; &lt;br /&gt;
| &#039;&#039;&#039;Type&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| tTestCase &lt;br /&gt;
| Input&lt;br /&gt;
| Handle to a test case. srTEST_CASE_DEFAULT can be used for the default test case.&lt;br /&gt;
|-&lt;br /&gt;
| eStatus &lt;br /&gt;
| Input &lt;br /&gt;
| Result of the test. Possible values are:&lt;br /&gt;
* &#039;&#039;&#039;srTEST_FAIL&#039;&#039;&#039;&lt;br /&gt;
* &#039;&#039;&#039;srTEST_PASS&#039;&#039;&#039;&lt;br /&gt;
* &#039;&#039;&#039;srTEST_NOTINUSE&#039;&#039;&#039;&lt;br /&gt;
* &#039;&#039;&#039;srTEST_INPROGRESS&#039;&#039;&#039;&lt;br /&gt;
* &#039;&#039;&#039;srTEST_DONE&#039;&#039;&#039; - applicable to dynamic cases - sets the status to &#039;&#039;&#039;pass&#039;&#039;&#039; unless already set to &#039;&#039;&#039;fail&#039;&#039;&#039; or &#039;&#039;&#039;not-in-use&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| dwDuration &lt;br /&gt;
| Input &lt;br /&gt;
| The duration of the test in clock ticks. Using &amp;quot;0&amp;quot; allows the Stride Runtime (Intercept Module) to set the time automatically.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;align:left;&amp;quot;&lt;br /&gt;
| &#039;&#039;&#039;Return Value&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039; Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| srWORD &lt;br /&gt;
| srOK on success, srERR_HANDLE_INVALID on invalid handle.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=c&amp;gt;&lt;br /&gt;
#include &amp;lt;srtest.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
void tfcase_setStatus(void)&lt;br /&gt;
{&lt;br /&gt;
  srTestCaseSetStatus(srTEST_CASE_DEFAULT, srTEST_PASS, 0);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#ifdef _SCL&lt;br /&gt;
#pragma scl_test_flist(&amp;quot;testfunc&amp;quot;, tfcase_setStatus)&lt;br /&gt;
#endif&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== srTestCaseSetStatusEx ==&lt;br /&gt;
The srTestCaseSetStatusEx() routine is used to set the result of test case and allow specification of an extendedFailureCode.&lt;br /&gt;
&amp;lt;source lang=c&amp;gt;&lt;br /&gt;
srWORD srTestCaseSetStatus(srTestCaseHandle_t tTestCase, srTestStatus_e eStatus, srDWORD dwDuration, srLONG lExtendedFailureCode)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;align:left;&amp;quot;  &lt;br /&gt;
| &#039;&#039;&#039;Parameters&#039;&#039;&#039; &lt;br /&gt;
| &#039;&#039;&#039;Type&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| tTestCase &lt;br /&gt;
| Input&lt;br /&gt;
| Handle to a test case. srTEST_CASE_DEFAULT can be used for the default test case.&lt;br /&gt;
|-&lt;br /&gt;
| eStatus &lt;br /&gt;
| Input &lt;br /&gt;
| Result of the test.&lt;br /&gt;
|-&lt;br /&gt;
| dwDuration &lt;br /&gt;
| Input &lt;br /&gt;
| The duration of the test in clock ticks. Using &amp;quot;0&amp;quot; allows the Stride Runtime (Intercept Module) to set the time automatically.&lt;br /&gt;
|-&lt;br /&gt;
| lExtendedFailureCode &lt;br /&gt;
| Input &lt;br /&gt;
| The Stride framework uses the extendedFailureCode to capture the numeric results of test method when the test method fails via a numeric (non-void, nonbool) return type.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;align:left;&amp;quot;&lt;br /&gt;
| &#039;&#039;&#039;Return Value&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039; Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| srWORD &lt;br /&gt;
| srOK on success, srERR_HANDLE_INVALID on invalid handle.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=c&amp;gt;&lt;br /&gt;
#include &amp;lt;srtest.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
void tfcase_setStatusEx(void)&lt;br /&gt;
{&lt;br /&gt;
  srTestCaseSetStatusEx(srTEST_CASE_DEFAULT, srTEST_FAIL, 0, -5);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#ifdef _SCL&lt;br /&gt;
#pragma scl_test_flist(&amp;quot;testfunc&amp;quot;, tfcase_setStatusEx)&lt;br /&gt;
#endif&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== srTestCaseAddAnnotation ==&lt;br /&gt;
The srTestCaseAddAnnotation() routine is used to add a new annotation to the specified test case.&lt;br /&gt;
&amp;lt;source lang=c&amp;gt;&lt;br /&gt;
srTestAnnotationHandle_t srTestCaseAddAnnotation(rTestCaseHandle_t tTestCase, srTestAnnotationLevel_e eLevel, const srCHAR * szName, const srCHAR * szFmtDescr, ...)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;align:left;&amp;quot;  &lt;br /&gt;
| &#039;&#039;&#039;Parameters&#039;&#039;&#039; &lt;br /&gt;
| &#039;&#039;&#039;Type&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| tTestCase &lt;br /&gt;
| Input&lt;br /&gt;
| Handle to the parent test case to which new test annotation is to be added. srTEST_CASE_DEFAULT can be used for the default test case.&lt;br /&gt;
|-&lt;br /&gt;
| eLevel&lt;br /&gt;
| Input &lt;br /&gt;
| Annotation level. &lt;br /&gt;
&lt;br /&gt;
* srTEST_ANNOTATION_LEVEL_TRACE,&lt;br /&gt;
* srTEST_ANNOTATION_LEVEL_DEBUG,&lt;br /&gt;
* srTEST_ANNOTATION_LEVEL_INFO,&lt;br /&gt;
* srTEST_ANNOTATION_LEVEL_WARN,&lt;br /&gt;
* srTEST_ANNOTATION_LEVEL_ERROR,&lt;br /&gt;
* srTEST_ANNOTATION_LEVEL_FATAL&lt;br /&gt;
|-&lt;br /&gt;
| szName &lt;br /&gt;
| Input &lt;br /&gt;
| Pointer to a null-terminated string representing the name of the new annotation. If null, the default host naming scheme will be used.&lt;br /&gt;
|-&lt;br /&gt;
| szFmtDescr&lt;br /&gt;
| Input &lt;br /&gt;
| Pointer to a null-terminated string representing the description of the new annotation. Cannot be null.&lt;br /&gt;
|-&lt;br /&gt;
| ... &lt;br /&gt;
| Input (Optional)&lt;br /&gt;
| Variable argument list to format szFmtDescr.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;align:left;&amp;quot;&lt;br /&gt;
| &#039;&#039;&#039;Return Value&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039; Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| srTestAnnotationHandle_t &lt;br /&gt;
| Handle of the newly created test annotation. srTEST_ANNOTATION_INVALID indicates failure to create a test annotation.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=c&amp;gt;&lt;br /&gt;
#include &amp;lt;srtest.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
void tfcase_addAnnotation(void) &lt;br /&gt;
{&lt;br /&gt;
  for (int count = 0; count &amp;lt; 5; ++count)&lt;br /&gt;
  {&lt;br /&gt;
    char szName[25];&lt;br /&gt;
    sprintf(szName, &amp;quot;annotation %d&amp;quot;, count);&lt;br /&gt;
    srTestAnnotationHandle_t annot = &lt;br /&gt;
                     srTestCaseAddAnnotation(srTEST_CASE_DEFAULT,&lt;br /&gt;
                                             srTEST_ANNOTATION_LEVEL_ERROR,&lt;br /&gt;
                                             szName,&lt;br /&gt;
                                             &amp;quot;description of annotation&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#ifdef _SCL&lt;br /&gt;
#pragma scl_test_flist(&amp;quot;testfunc&amp;quot;, tfcase_addAnnotation)&lt;br /&gt;
#endif&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== srTestCaseSetData ==&lt;br /&gt;
The srTestCaseSetData() routine is used to associate a custom name|value pair with a test case.&lt;br /&gt;
&amp;lt;source lang=c&amp;gt;&lt;br /&gt;
srWORD srTestCaseSetData(srTestCaseHandle_t tTestCase, const srCHAR * szName, const srCHAR * szFmtValue, ...);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;align:left;&amp;quot;  &lt;br /&gt;
| &#039;&#039;&#039;Parameters&#039;&#039;&#039; &lt;br /&gt;
| &#039;&#039;&#039;Type&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| tTestCase &lt;br /&gt;
| Input&lt;br /&gt;
| Handle to a test case. srTEST_CASE_DEFAULT can be used for the default test case.&lt;br /&gt;
|-&lt;br /&gt;
| szName&lt;br /&gt;
| Input&lt;br /&gt;
| Pointer to a null-terminated string representing the name of the custom pair. Cannot be null.&lt;br /&gt;
|-&lt;br /&gt;
| szFmtValue &lt;br /&gt;
| Input &lt;br /&gt;
| Pointer to a null-terminated string representing the value of the custom pair. Cannot be null.&lt;br /&gt;
|-&lt;br /&gt;
| ... &lt;br /&gt;
| Input (Optional)&lt;br /&gt;
| Variable argument list to format szFmtValue.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;align:left;&amp;quot;&lt;br /&gt;
| &#039;&#039;&#039;Return Value&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039; Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| srWORD &lt;br /&gt;
| srOK on success, srERR_HANDLE_INVALID on invalid handle.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=c&amp;gt;&lt;br /&gt;
#include &amp;lt;srtest.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
void tfcase_setData(void)&lt;br /&gt;
{&lt;br /&gt;
  srTestCaseSetData(srTEST_CASE_DEFAULT, &amp;quot;MyName&amp;quot;, &amp;quot;my value&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#ifdef _SCL&lt;br /&gt;
#pragma scl_test_flist(&amp;quot;testfunc&amp;quot;, tfcase_setData)&lt;br /&gt;
#endif&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== srTestAnnotationAddComment ==&lt;br /&gt;
The srTestAnnotationAddComment() routine is used to add a comment (aka a log) to a test annotation.&lt;br /&gt;
&amp;lt;source lang=c&amp;gt;&lt;br /&gt;
srWORD srTestAnnotationAddComment(srTestAnnotationHandle_t tTestAnnotation, const srCHAR * szLabel, const srCHAR * szFmtComment, ...)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;align:left;&amp;quot;  &lt;br /&gt;
| &#039;&#039;&#039;Parameters&#039;&#039;&#039; &lt;br /&gt;
| &#039;&#039;&#039;Type&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| tTestAnnotation&lt;br /&gt;
| Input&lt;br /&gt;
| Handle to a test annotation.&lt;br /&gt;
|-&lt;br /&gt;
| szLabel&lt;br /&gt;
| Input &lt;br /&gt;
| Pointer to a null-terminated string for the label. If null, the default label will be applied.&lt;br /&gt;
|-&lt;br /&gt;
| szFmtComment &lt;br /&gt;
| Input &lt;br /&gt;
| Pointer to a null-terminated string representing the new comment. Cannot be null.&lt;br /&gt;
|-&lt;br /&gt;
| ... &lt;br /&gt;
| Input (Optional)&lt;br /&gt;
| Variable argument list to format szFmtComment.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;align:left;&amp;quot;&lt;br /&gt;
| &#039;&#039;&#039;Return Value&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039; Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| srWORD &lt;br /&gt;
| srOK on success, srERR on null string or invalid formatted string, srERR_HANDLE_INVALID on invalid handle, srERR_STR_TRUNCATED on truncated string.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=c&amp;gt;&lt;br /&gt;
#include &amp;lt;srtest.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
void tfsuiteAnnotation_addComment(void) &lt;br /&gt;
{&lt;br /&gt;
  srTestAnnotationHandle_t annot = &lt;br /&gt;
                           srTestSuiteAddAnnotation(srTEST_ANNOTATION_LEVEL_ERROR,&lt;br /&gt;
                                                    &amp;quot;annot&amp;quot;,&lt;br /&gt;
                                                    &amp;quot;annot description&amp;quot;);&lt;br /&gt;
  srTestAnnotationAddComment(annot,&lt;br /&gt;
                             srNULL,&lt;br /&gt;
                             &amp;quot;this comment should print %s&amp;quot;, &amp;quot;A STRING&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#ifdef _SCL&lt;br /&gt;
#pragma scl_test_flist(&amp;quot;testfunc&amp;quot;, tfsuiteAnnotation_addComment)&lt;br /&gt;
#endif&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= C++ Test Classes =&lt;br /&gt;
The Runtime Test Services C APIs work equally well from C test functions and C++ test classes. If, however, you are using C++ it might be more convinient for you to derive your C++ test classes from the Runtime Test Services C++ base class, &#039;&#039;srTest&#039;&#039;. That way you will have access to a set of simpler to use C++ classes. &lt;br /&gt;
&lt;br /&gt;
The following C++ classes are provided: &lt;br /&gt;
* &#039;&#039;&#039;[[#class srTest|class srTest]]&#039;&#039;&#039; - base test class&lt;br /&gt;
* &#039;&#039;&#039;[[#class srTestCase|class srTestCase]]&#039;&#039;&#039; - represents a test case&lt;br /&gt;
* &#039;&#039;&#039;[[#class srTestAnnotation|class srTestAnnotation]]&#039;&#039;&#039; - represents a test annotation&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== class srTest ==&lt;br /&gt;
The srTest class provides one member object &#039;&#039;testCase&#039;&#039; of [[#class srTestCase|class srTestCase]] and the folowing methods:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== method GetParam ===&lt;br /&gt;
This overload of the GetParam() method is used to get the value of a named parameter as a string.&lt;br /&gt;
&amp;lt;source lang=cpp&amp;gt;&lt;br /&gt;
static srWORD GetParam(const srCHAR * name, srCHAR * value, srDWORD size, const srCHAR * defval = srNULL)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;align:left;&amp;quot;  &lt;br /&gt;
| &#039;&#039;&#039;Parameters&#039;&#039;&#039; &lt;br /&gt;
| &#039;&#039;&#039;Type&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| name &lt;br /&gt;
| Input&lt;br /&gt;
| Pointer to a null-terminated string that represents the name of the parameter. Cannot be null.&lt;br /&gt;
|-&lt;br /&gt;
| value &lt;br /&gt;
| Output &lt;br /&gt;
| Pointer to a block of memory to store the value of the parameter with a maximum size of &amp;lt;i&amp;gt;size&amp;lt;/i&amp;gt; chars&lt;br /&gt;
|-&lt;br /&gt;
| size &lt;br /&gt;
| Input &lt;br /&gt;
| Size in chars of the buffer pointed to by &amp;lt;i&amp;gt;value&amp;lt;/i&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| defvalue &lt;br /&gt;
| Input (optional) &lt;br /&gt;
| Pointer to a null-terminated string that represents a default value in case the parameter is not specified. By setting this value to srNULL (or omitting it), you can use &amp;lt;i&amp;gt;GetParam()&amp;lt;/i&amp;gt; to test for the existence of a named parameter. If the named parameter doesn&#039;t exist, the function will return &amp;lt;i&amp;gt;srERR_HANDLE_INVALID&amp;lt;/i&amp;gt;.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;align:left;&amp;quot;&lt;br /&gt;
| &#039;&#039;&#039;Return Value&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039; Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| srWORD &lt;br /&gt;
| srOK on success, error otherwise.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=cpp&amp;gt;&lt;br /&gt;
#include &amp;lt;srtest.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
class srtest_class : public stride::srTest&lt;br /&gt;
{&lt;br /&gt;
public:&lt;br /&gt;
  void getParam()&lt;br /&gt;
  {&lt;br /&gt;
    GetParam(&amp;quot;ParamName&amp;quot;, szValue, MAX_VALUE_LEN, &amp;quot;default value&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
#ifdef _SCL&lt;br /&gt;
#pragma scl_test_class(srtest_class)&lt;br /&gt;
#endif&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== method GetParam ===&lt;br /&gt;
This overload of the GetParam() method is used to get the value of a named parameter as a long.&lt;br /&gt;
&amp;lt;source lang=cpp&amp;gt;&lt;br /&gt;
static long GetParam(const srCHAR * name, srLONG defval = 0)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;align:left;&amp;quot;  &lt;br /&gt;
| &#039;&#039;&#039;Parameters&#039;&#039;&#039; &lt;br /&gt;
| &#039;&#039;&#039;Type&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| name &lt;br /&gt;
| Input&lt;br /&gt;
| Pointer to a null-terminated string that represents the name of the parameter.&lt;br /&gt;
|-&lt;br /&gt;
| defvalue&lt;br /&gt;
| Input &lt;br /&gt;
| Default value that is returned if the parameter is not found.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;align:left;&amp;quot;&lt;br /&gt;
| &#039;&#039;&#039;Return Value&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039; Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| srLONG&lt;br /&gt;
| Parameter value, or value specified by &amp;lt;i&amp;gt;defvalue&amp;lt;/i&amp;gt; if parameter isn&#039;t found.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=cpp&amp;gt;&lt;br /&gt;
#include &amp;lt;srtest.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
class srtest_class : public stride::srTest&lt;br /&gt;
{&lt;br /&gt;
public:&lt;br /&gt;
  void getParam()&lt;br /&gt;
  {&lt;br /&gt;
    srLONG lValue = GetParam(&amp;quot;ParamName&amp;quot;, -1);&lt;br /&gt;
  }&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
#ifdef _SCL&lt;br /&gt;
#pragma scl_test_class(srtest_class)&lt;br /&gt;
#endif&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== method GetParam ===&lt;br /&gt;
This overload of the GetParam() method is used to get the value of a named parameter as a double.&lt;br /&gt;
&amp;lt;source lang=cpp&amp;gt;&lt;br /&gt;
static double GetParam(const srCHAR * name, const double&amp;amp; defval)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;align:left;&amp;quot;  &lt;br /&gt;
| &#039;&#039;&#039;Parameters&#039;&#039;&#039; &lt;br /&gt;
| &#039;&#039;&#039;Type&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| name &lt;br /&gt;
| Input&lt;br /&gt;
| Pointer to a null-terminated string that represents the name of the parameter.&lt;br /&gt;
|-&lt;br /&gt;
| defvalue&lt;br /&gt;
| Input &lt;br /&gt;
| Default value that is returned if the parameter is not found.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;align:left;&amp;quot;&lt;br /&gt;
| &#039;&#039;&#039;Return Value&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039; Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| double&lt;br /&gt;
| Parameter value, or value specified by &amp;lt;i&amp;gt;defvalue&amp;lt;/i&amp;gt; if parameter isn&#039;t found.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=cpp&amp;gt;&lt;br /&gt;
#include &amp;lt;srtest.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
class srtest_class : public stride::srTest&lt;br /&gt;
{&lt;br /&gt;
public:&lt;br /&gt;
  void getParam()&lt;br /&gt;
  {&lt;br /&gt;
    double dbVal = GetParam(&amp;quot;ParamName&amp;quot;,  0.5772156649);&lt;br /&gt;
  }&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
#ifdef _SCL&lt;br /&gt;
#pragma scl_test_class(srtest_class)&lt;br /&gt;
#endif&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== method AddCase ===&lt;br /&gt;
The AddCase method is used to add a new test case to the test suite.&lt;br /&gt;
&amp;lt;source lang=cpp&amp;gt;&lt;br /&gt;
srTestCase AddCase(const srCHAR * name, const srCHAR * descr = srNULL)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;align:left;&amp;quot;  &lt;br /&gt;
| &#039;&#039;&#039;Parameters&#039;&#039;&#039; &lt;br /&gt;
| &#039;&#039;&#039;Type&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|- &lt;br /&gt;
| name &lt;br /&gt;
| Input&lt;br /&gt;
| Pointer to null-terminated string that represents the name of the new test case. If empty, the default host naming scheme will be used.&lt;br /&gt;
|- &lt;br /&gt;
| descr &lt;br /&gt;
| Input (Optional)&lt;br /&gt;
| Pointer to null-terminated string representing the description of the new test case. If empty, description will be blank.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;align:left;&amp;quot;&lt;br /&gt;
| &#039;&#039;&#039;Return Value&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039; Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| srTestCase &lt;br /&gt;
| Newly created test case instance.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;source lang=cpp&amp;gt;&lt;br /&gt;
#include &amp;lt;srtest.h&amp;gt;&lt;br /&gt;
#include &amp;lt;sstream&amp;gt;&lt;br /&gt;
&lt;br /&gt;
class srtest_class : public stride::srTest&lt;br /&gt;
{&lt;br /&gt;
public:&lt;br /&gt;
  void suiteAddSuite()&lt;br /&gt;
  {&lt;br /&gt;
    const std::string prefix(&amp;quot;dynamic test case &amp;quot;);&lt;br /&gt;
    for (int count = 0; count &amp;lt; 5; ++count)&lt;br /&gt;
    {&lt;br /&gt;
      std::stringstream strm;&lt;br /&gt;
      strm &amp;lt;&amp;lt; prefix &amp;lt;&amp;lt; count;&lt;br /&gt;
      stride::srTestCase tc = AddCase(strm.str().c_str());&lt;br /&gt;
      tc.SetStatus(srTEST_PASS);&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
#ifdef _SCL&lt;br /&gt;
#pragma scl_test_class(srtest_class)&lt;br /&gt;
#endif&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== method AddAnnotation ===&lt;br /&gt;
The AddAnnotation method is used to add a new test annotation to the test suite.&lt;br /&gt;
&amp;lt;source lang=cpp&amp;gt;&lt;br /&gt;
srTestAnnotation AddAnnotation(srTestAnnotationLevel_e level, const srCHAR * name, const srCHAR * descr, ...)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;align:left;&amp;quot;  &lt;br /&gt;
| &#039;&#039;&#039;Parameters&#039;&#039;&#039; &lt;br /&gt;
| &#039;&#039;&#039;Type&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|- &lt;br /&gt;
| level&lt;br /&gt;
| Input&lt;br /&gt;
| Annotation level. &lt;br /&gt;
&lt;br /&gt;
* srTEST_ANNOTATION_LEVEL_TRACE,&lt;br /&gt;
* srTEST_ANNOTATION_LEVEL_DEBUG,&lt;br /&gt;
* srTEST_ANNOTATION_LEVEL_INFO,&lt;br /&gt;
* srTEST_ANNOTATION_LEVEL_WARN,&lt;br /&gt;
* srTEST_ANNOTATION_LEVEL_ERROR,&lt;br /&gt;
* srTEST_ANNOTATION_LEVEL_FATAL&lt;br /&gt;
|- &lt;br /&gt;
| name &lt;br /&gt;
| Input &lt;br /&gt;
| Pointer to null-terminated string that represents the name of the new annotation. If empty, the default host naming scheme will be used.&lt;br /&gt;
|- &lt;br /&gt;
| descr&lt;br /&gt;
| Input &lt;br /&gt;
| Pointer to null-terminated string representing the description of the new annotation. Cannot be null.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;align:left;&amp;quot;&lt;br /&gt;
| &#039;&#039;&#039;Return Value&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039; Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| srTestAnnotation&lt;br /&gt;
| Newly created annotation instance.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=cpp&amp;gt;&lt;br /&gt;
#include &amp;lt;srtest.h&amp;gt;&lt;br /&gt;
#include &amp;lt;sstream&amp;gt;&lt;br /&gt;
&lt;br /&gt;
class srtest_class : public stride::srTest&lt;br /&gt;
{&lt;br /&gt;
public:&lt;br /&gt;
  void suiteAddAnnotation()&lt;br /&gt;
  {&lt;br /&gt;
    for (int count = 0; count &amp;lt; 5; ++count)&lt;br /&gt;
    {&lt;br /&gt;
      std::stringstream strmName;&lt;br /&gt;
      std::stringstream strmDescr;&lt;br /&gt;
      strmName &amp;lt;&amp;lt; &amp;quot;annotation &amp;quot; &amp;lt;&amp;lt; count;&lt;br /&gt;
      strmDescr &amp;lt;&amp;lt; &amp;quot;description of annotation &amp;quot; &amp;lt;&amp;lt; count;&lt;br /&gt;
      stride::srTestAnnotation ta = AddAnnotation(srTEST_ANNOTATION_LEVEL_INFO,&lt;br /&gt;
                                                  strmName.str().c_str(),&lt;br /&gt;
                                                  strmDescr.str().c_str());&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
#ifdef _SCL&lt;br /&gt;
#pragma scl_test_class(srtest_class)&lt;br /&gt;
#endif&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== method SetData ===&lt;br /&gt;
The SetData method is used to associate a custom name|value pair with the test suite.&lt;br /&gt;
&amp;lt;source lang=cpp&amp;gt;&lt;br /&gt;
srWORD SetData(const srCHAR * name, const srCHAR * value, ...)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;align:left;&amp;quot;  &lt;br /&gt;
| &#039;&#039;&#039;Parameters&#039;&#039;&#039; &lt;br /&gt;
| &#039;&#039;&#039;Type&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|- &lt;br /&gt;
| name &lt;br /&gt;
| Input&lt;br /&gt;
| Pointer to a null-terminated string representing the name of the custom pair. Cannot be null.&lt;br /&gt;
|- &lt;br /&gt;
| value&lt;br /&gt;
| Input&lt;br /&gt;
| Pointer to a null-terminated string representing the value of the custom pair. Cannot be null.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;align:left;&amp;quot;&lt;br /&gt;
| &#039;&#039;&#039;Return Value&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039; Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| srWORD &lt;br /&gt;
| srOK on success, srERR_HANDLE_INVALID on invalid handle.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;source lang=cpp&amp;gt;&lt;br /&gt;
#include &amp;lt;srtest.h&amp;gt;&lt;br /&gt;
#include &amp;lt;sstream&amp;gt;&lt;br /&gt;
&lt;br /&gt;
class srtest_class : public stride::srTest&lt;br /&gt;
{&lt;br /&gt;
public:&lt;br /&gt;
  void suiteSetData()&lt;br /&gt;
  {&lt;br /&gt;
      SetData(&amp;quot;MyName&amp;quot;, &amp;quot;my value&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
#ifdef _SCL&lt;br /&gt;
#pragma scl_test_class(srtest_class)&lt;br /&gt;
#endif&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== class srTestCase ==&lt;br /&gt;
The srTestCase class provides the following methods:&lt;br /&gt;
&lt;br /&gt;
=== method SetStatus ===&lt;br /&gt;
The SetStatus method is used to set the result of the default test case.&lt;br /&gt;
&amp;lt;source lang=cpp&amp;gt;&lt;br /&gt;
srWORD SetStatus(srTestStatus_e status, srDWORD duration = 0)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;align:left;&amp;quot;  &lt;br /&gt;
| &#039;&#039;&#039;Parameters&#039;&#039;&#039; &lt;br /&gt;
| &#039;&#039;&#039;Type&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|- &lt;br /&gt;
| status &lt;br /&gt;
| Input &lt;br /&gt;
| Result of the test. Possible values are:&lt;br /&gt;
* &#039;&#039;&#039;srTEST_FAIL&#039;&#039;&#039;&lt;br /&gt;
* &#039;&#039;&#039;srTEST_PASS&#039;&#039;&#039;&lt;br /&gt;
* &#039;&#039;&#039;srTEST_NOTINUSE&#039;&#039;&#039;&lt;br /&gt;
* &#039;&#039;&#039;srTEST_INPROGRESS&#039;&#039;&#039;&lt;br /&gt;
* &#039;&#039;&#039;srTEST_DONE&#039;&#039;&#039; - applicable to dynamic cases - sets the status to &#039;&#039;&#039;pass&#039;&#039;&#039; unless already set to &#039;&#039;&#039;fail&#039;&#039;&#039; or &#039;&#039;&#039;not-in-use&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| duration &lt;br /&gt;
| Input (Optional)&lt;br /&gt;
| The duration of the test in clock ticks. The default is 0.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;align:left;&amp;quot;&lt;br /&gt;
| &#039;&#039;&#039;Return Value&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039; Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| srWORD &lt;br /&gt;
| srOK on success, srERR_HANDLE_INVALID on invalid handle.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=cpp&amp;gt;&lt;br /&gt;
#include &amp;lt;srtest.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
class srtest_class : public stride::srTest&lt;br /&gt;
{&lt;br /&gt;
public:&lt;br /&gt;
  void caseSetStatus()&lt;br /&gt;
  {&lt;br /&gt;
    testCase.SetStatus(srTEST_NOTINUSE);&lt;br /&gt;
  }&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
#ifdef _SCL&lt;br /&gt;
#pragma scl_test_class(srtest_class)&lt;br /&gt;
#endif&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== method AddAnnotation ===&lt;br /&gt;
The AddAnnotation method is used to add a new test annotation to the test case.&lt;br /&gt;
&amp;lt;source lang=cpp&amp;gt;&lt;br /&gt;
srTestAnnotation AddAnnotation(srTestAnnotationLevel_e level, const srCHAR * name, const srCHAR * descr, ...)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;align:left;&amp;quot;  &lt;br /&gt;
| &#039;&#039;&#039;Parameters&#039;&#039;&#039; &lt;br /&gt;
| &#039;&#039;&#039;Type&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|- &lt;br /&gt;
| level&lt;br /&gt;
| Input&lt;br /&gt;
| Annotation level. &lt;br /&gt;
&lt;br /&gt;
* srTEST_ANNOTATION_LEVEL_TRACE,&lt;br /&gt;
* srTEST_ANNOTATION_LEVEL_DEBUG,&lt;br /&gt;
* srTEST_ANNOTATION_LEVEL_INFO,&lt;br /&gt;
* srTEST_ANNOTATION_LEVEL_WARN,&lt;br /&gt;
* srTEST_ANNOTATION_LEVEL_ERROR,&lt;br /&gt;
* srTEST_ANNOTATION_LEVEL_FATAL&lt;br /&gt;
|- &lt;br /&gt;
| name&lt;br /&gt;
| Input&lt;br /&gt;
| Pointer to null-terminated string that represents the name of the new annotation. If null, the default host naming scheme will be used.&lt;br /&gt;
|- &lt;br /&gt;
| descr&lt;br /&gt;
| Input&lt;br /&gt;
| Pointer to null-terminated string representing the description of the new annotation. Cannot be null.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;align:left;&amp;quot;&lt;br /&gt;
| &#039;&#039;&#039;Return Value&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039; Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| srTestAnnotation&lt;br /&gt;
| Newly created annotation instance.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=cpp&amp;gt;&lt;br /&gt;
#include &amp;lt;srtest.h&amp;gt;&lt;br /&gt;
#include &amp;lt;sstream&amp;gt;&lt;br /&gt;
&lt;br /&gt;
class srtest_class : public stride::srTest&lt;br /&gt;
{&lt;br /&gt;
public:&lt;br /&gt;
  void caseAddAnnotation()&lt;br /&gt;
  {&lt;br /&gt;
    for (int count = 0; count &amp;lt; 5; ++count)&lt;br /&gt;
    {&lt;br /&gt;
      std::stringstream strmName;&lt;br /&gt;
      std::stringstream strmDescr;&lt;br /&gt;
      strmName &amp;lt;&amp;lt; &amp;quot;annotation &amp;quot; &amp;lt;&amp;lt; count;&lt;br /&gt;
      strmDescr &amp;lt;&amp;lt; &amp;quot;description of annotation &amp;quot; &amp;lt;&amp;lt; count;&lt;br /&gt;
      stride::srTestAnnotation ta = &lt;br /&gt;
                 testCase.AddAnnotation(srTEST_ANNOTATION_LEVEL_INFO,&lt;br /&gt;
                                         strmName.str().c_str(),&lt;br /&gt;
                                         strmDescr.str().c_str());&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
#ifdef _SCL&lt;br /&gt;
#pragma scl_test_class(srtest_class)&lt;br /&gt;
#endif&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== method SetData ===&lt;br /&gt;
The SetData method is used to associate a custom name|value pair with the test case.&lt;br /&gt;
&amp;lt;source lang=cpp&amp;gt;&lt;br /&gt;
srWORD SetData(const srCHAR * name, const srCHAR * value, ...)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;align:left;&amp;quot;  &lt;br /&gt;
| &#039;&#039;&#039;Parameters&#039;&#039;&#039; &lt;br /&gt;
| &#039;&#039;&#039;Type&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|- &lt;br /&gt;
| name&lt;br /&gt;
| Input &lt;br /&gt;
| Pointer to a null-terminated string representing the name of the custom pair. Cannot be null.&lt;br /&gt;
|- &lt;br /&gt;
| value&lt;br /&gt;
| Input &lt;br /&gt;
| Pointer to a null-terminated string representing the value of the custom pair. Cannot be null.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;align:left;&amp;quot;&lt;br /&gt;
| &#039;&#039;&#039;Return Value&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039; Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| srWORD &lt;br /&gt;
| srOK on success, srERR_HANDLE_INVALID on invalid handle.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=cpp&amp;gt;&lt;br /&gt;
#include &amp;lt;srtest.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
class srtest_class : public stride::srTest&lt;br /&gt;
{&lt;br /&gt;
public:&lt;br /&gt;
  void caseSetData()&lt;br /&gt;
  {&lt;br /&gt;
    testCase.SetData(&amp;quot;MyName&amp;quot;, &amp;quot;my value&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
#ifdef _SCL&lt;br /&gt;
#pragma scl_test_class(srtest_class)&lt;br /&gt;
#endif&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== class srTestAnnotation ==&lt;br /&gt;
The srTestAnnotation class provides the following methods:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== method AddComment ===&lt;br /&gt;
The AddComment method is used to add a comment to the test annotation.&lt;br /&gt;
&amp;lt;source lang=cpp&amp;gt;&lt;br /&gt;
srWORD AddComment(const srCHAR * label, const srCHAR * comment, ...)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;align:left;&amp;quot;  &lt;br /&gt;
| &#039;&#039;&#039;Parameters&#039;&#039;&#039; &lt;br /&gt;
| &#039;&#039;&#039;Type&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|- &lt;br /&gt;
| label&lt;br /&gt;
| Input &lt;br /&gt;
| Pointer to null-terminated string for the label. If null, the default label will be applied.&lt;br /&gt;
|- &lt;br /&gt;
| comment&lt;br /&gt;
| Input &lt;br /&gt;
| Pointer to null-terminated string representing the new comment. Cannot be empty.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;align:left;&amp;quot;&lt;br /&gt;
| &#039;&#039;&#039;Return Value&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039; Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| srWORD &lt;br /&gt;
| srOK on success, srERR on null string or invalid formatted string, srERR_HANDLE_INVALID on invalid handle, srERR_STR_TRUNCATED on truncated string.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=cpp&amp;gt;&lt;br /&gt;
#include &amp;lt;srtest.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
class srtest_class : public stride::srTest&lt;br /&gt;
{&lt;br /&gt;
public:&lt;br /&gt;
  void suiteAnnotationAddComment()&lt;br /&gt;
  {&lt;br /&gt;
    stride::srTestAnnotation ta = &lt;br /&gt;
                 testSuite.AddAnnotation(srTEST_ANNOTATION_LEVEL_INFO,&lt;br /&gt;
                                         &amp;quot;annot&amp;quot;,&lt;br /&gt;
                                         &amp;quot;annot description&amp;quot;);&lt;br /&gt;
    ta.AddComment(&amp;quot;this comment on annotation should print %s&amp;quot;, &amp;quot;A STRING&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
#ifdef _SCL&lt;br /&gt;
#pragma scl_test_class(srtest_class)&lt;br /&gt;
#endif&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ryanh</name></author>
	</entry>
	<entry>
		<id>https://www.stridewiki.com/index.php?title=Runtime_Test_Services&amp;diff=14466</id>
		<title>Runtime Test Services</title>
		<link rel="alternate" type="text/html" href="https://www.stridewiki.com/index.php?title=Runtime_Test_Services&amp;diff=14466"/>
		<updated>2015-07-07T19:49:08Z</updated>

		<summary type="html">&lt;p&gt;Ryanh: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
The Runtime Test Services (declared in &#039;&#039;&#039;srtest.h&#039;&#039;&#039;) are a set of APIs in the STRIDE Runtime that facilitate the writing of target based test code. These APIs make up an optional portion of the Stride Runtime and can be used to communicate additional information about tests to the host based reporting mechanism. These APIs also allow target test code to create additional test suites and test cases dynamically at runtime. &lt;br /&gt;
&lt;br /&gt;
There are two ways of accessing these APIs: through C-based functions, or through a C++ base class from which you may derive your C++ test class. These are discussed below in [[#C Test Functions|C Test Functions]], and [[#C++ Test Classes|C++ Test Classes]] sections below.&lt;br /&gt;
&lt;br /&gt;
= C Test Functions =&lt;br /&gt;
&lt;br /&gt;
The following C APIs are provided: &lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;[[#srTestGetParam|srTestGetParam]]&#039;&#039;&#039;: returns an input parameters value.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;[[#srTestSuiteAddCase|srTestSuiteAddCase]]&#039;&#039;&#039;: creates an additional test case at runtime.&lt;br /&gt;
*&#039;&#039;&#039;[[#srTestSuiteAddAnnotation|srTestSuiteAddAnnotation]]&#039;&#039;&#039;: creates a suite annotation at runtime. &lt;br /&gt;
*&#039;&#039;&#039;[[#srTestSuiteSetData|srTestSuiteSetData]]&#039;&#039;&#039;: associates a custom name|value. &lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;[[#srTestCaseSetStatus|srTestCaseSetStatus]]&#039;&#039;&#039;: explicitly sets the status for the specified test case.&lt;br /&gt;
*&#039;&#039;&#039;[[#srTestCaseAddAnnotation|srTestCaseAddAnnotation]]&#039;&#039;&#039;: creates a test case annotation at runtime. &lt;br /&gt;
*&#039;&#039;&#039;[[#srTestSuiteSetData|srTestSuiteSetData]]&#039;&#039;&#039;: associates a custom name|value pair with the specified test case. &lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;[[#srTestAnnotationAddComment|srTestAnnotationAddComment]]&#039;&#039;&#039;: adds a comment to the specified annotation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== srTestGetParam ==&lt;br /&gt;
The srTestGetParam() function is used to get the value of a named parameter as a string.&lt;br /&gt;
&amp;lt;source lang=c&amp;gt;&lt;br /&gt;
srWORD srTestGetParam(const srCHAR * szName, srCHAR * szValue, srDWORD dwSize, const srCHAR * szDefValue);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;align:left;&amp;quot;  &lt;br /&gt;
| &#039;&#039;&#039;Parameters&#039;&#039;&#039; &lt;br /&gt;
| &#039;&#039;&#039;Type&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| szName &lt;br /&gt;
| Input&lt;br /&gt;
| Pointer to a null-terminated string that represents the name of the parameter. Cannot be null.&lt;br /&gt;
|-&lt;br /&gt;
| szValue &lt;br /&gt;
| Output &lt;br /&gt;
| Pointer to a block of memory to store the value of the parameter with a maximum size of &amp;lt;i&amp;gt;dwSize&amp;lt;/i&amp;gt; chars&lt;br /&gt;
|-&lt;br /&gt;
| dwSize &lt;br /&gt;
| Input &lt;br /&gt;
| Size in chars of the buffer pointed to by &amp;lt;i&amp;gt;szValue&amp;lt;/i&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| szDefValue &lt;br /&gt;
| Input (optional) &lt;br /&gt;
| Pointer to a null-terminated string that represents a default value in case the parameter is not specified. By setting this value to srNULL (or omitting it), you can use &amp;lt;i&amp;gt;srTestGetParam()&amp;lt;/i&amp;gt; to test for the existence of a named parameter. If the named parameter doesn&#039;t exist, the function will return &amp;lt;i&amp;gt;srERR_HANDLE_INVALID&amp;lt;/i&amp;gt;.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;align:left;&amp;quot;&lt;br /&gt;
| &#039;&#039;&#039;Return Value&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039; Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| srOK &lt;br /&gt;
| Success&lt;br /&gt;
|-&lt;br /&gt;
| srERR &lt;br /&gt;
| Null or empty szName string passed in.&lt;br /&gt;
|-&lt;br /&gt;
| srERR_HANDLE_INVALID&lt;br /&gt;
| The named parameter is not found and &amp;lt;i&amp;gt;szDefValue&amp;lt;/i&amp;gt; is set to srNULL.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=c&amp;gt;&lt;br /&gt;
#include &amp;lt;srtest.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#define MAX_VALUE_LEN 128&lt;br /&gt;
void tfsuite_getParam(void)&lt;br /&gt;
{&lt;br /&gt;
  srCHAR szValue[MAX_VALUE_LEN] = {0};&lt;br /&gt;
&lt;br /&gt;
  srWORD wRet = srTestGetParam(&amp;quot;ParamName&amp;quot;, szValue, MAX_VALUE_LEN, &amp;quot;default value&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#ifdef _SCL&lt;br /&gt;
#pragma scl_test_flist(&amp;quot;testfunc&amp;quot;, tfsuite_getParam)&lt;br /&gt;
#endif&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== srTestGetParamLong ==&lt;br /&gt;
The srTestGetParamLong() function is used to get the value of a named parameter as a long.&lt;br /&gt;
&amp;lt;source lang=c&amp;gt;&lt;br /&gt;
srLONG srTestGetParamLong(const srCHAR * szName, srLONG lDefValue);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;align:left;&amp;quot;  &lt;br /&gt;
| &#039;&#039;&#039;Parameters&#039;&#039;&#039; &lt;br /&gt;
| &#039;&#039;&#039;Type&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| szName &lt;br /&gt;
| Input&lt;br /&gt;
| Pointer to a null-terminated string that represents the name of the parameter.&lt;br /&gt;
|-&lt;br /&gt;
| lDefValue&lt;br /&gt;
| Input &lt;br /&gt;
| Default value that is returned if the parameter is not found.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;align:left;&amp;quot;&lt;br /&gt;
| &#039;&#039;&#039;Return Value&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039; Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| srLONG&lt;br /&gt;
| Parameter value, or value specified by &amp;lt;i&amp;gt;lDefValue&amp;lt;/i&amp;gt; if parameter isn&#039;t found.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=c&amp;gt;&lt;br /&gt;
#include &amp;lt;srtest.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
void tfsuite_getParam(void)&lt;br /&gt;
{&lt;br /&gt;
  srLONG lVal = srTestGetParamLong(&amp;quot;ParamName&amp;quot;, -1);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#ifdef _SCL&lt;br /&gt;
#pragma scl_test_flist(&amp;quot;testfunc&amp;quot;, tfsuite_getParam)&lt;br /&gt;
#endif&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== srTestGetParamDouble ==&lt;br /&gt;
The srTestGetParamDouble() function is used to get the value of a named parameter as a double.&lt;br /&gt;
&amp;lt;source lang=c&amp;gt;&lt;br /&gt;
double srTestGetParamDouble(const srCHAR * szName, double dbDefValue);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;align:left;&amp;quot;  &lt;br /&gt;
| &#039;&#039;&#039;Parameters&#039;&#039;&#039; &lt;br /&gt;
| &#039;&#039;&#039;Type&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| szName &lt;br /&gt;
| Input&lt;br /&gt;
| Pointer to a null-terminated string that represents the name of the parameter.&lt;br /&gt;
|-&lt;br /&gt;
| dbDefValue&lt;br /&gt;
| Input &lt;br /&gt;
| Default value that is returned if the parameter is not found.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;align:left;&amp;quot;&lt;br /&gt;
| &#039;&#039;&#039;Return Value&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039; Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| double&lt;br /&gt;
| Parameter value, or value specified by &amp;lt;i&amp;gt;dbDefValue&amp;lt;/i&amp;gt; if parameter isn&#039;t found.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=c&amp;gt;&lt;br /&gt;
#include &amp;lt;srtest.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
void tfsuite_getParam(void)&lt;br /&gt;
{&lt;br /&gt;
  double dbVal = srTestGetParamDouble(&amp;quot;ParamName&amp;quot;, 0.5772156649);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#ifdef _SCL&lt;br /&gt;
#pragma scl_test_flist(&amp;quot;testfunc&amp;quot;, tfsuite_getParam)&lt;br /&gt;
#endif&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== srTestSuiteAddCase ==&lt;br /&gt;
The srTestSuiteAddCase() routine is used to add a new test case to the specified test suite.&lt;br /&gt;
&amp;lt;source lang=c&amp;gt;&lt;br /&gt;
srTestCaseHandle_t srTestSuiteAddCase(const srCHAR * szName, const srCHAR * szDescr)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;align:left;&amp;quot;  &lt;br /&gt;
| &#039;&#039;&#039;Parameters&#039;&#039;&#039; &lt;br /&gt;
| &#039;&#039;&#039;Type&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| szName &lt;br /&gt;
| Input &lt;br /&gt;
| Pointer to a null-terminated string that represents the name of the new test case. If null, the default host naming scheme will be used.&lt;br /&gt;
|-&lt;br /&gt;
| szDescr &lt;br /&gt;
| Input&lt;br /&gt;
| Pointer to a null-terminated string representing the description of the new test case. If null, description will be empty.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;align:left;&amp;quot;&lt;br /&gt;
| &#039;&#039;&#039;Return Value&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039; Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| srTestCaseHandle_t &lt;br /&gt;
| Handle of the newly created test case. srTEST_CASE_INVALID indicates failure to create a test case.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=c&amp;gt;&lt;br /&gt;
#include &amp;lt;srtest.h&amp;gt;&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
void tfsuite_addCase(void)&lt;br /&gt;
{&lt;br /&gt;
  for (int count = 0; count &amp;lt; 5; ++count)&lt;br /&gt;
  {&lt;br /&gt;
    char szName[25];&lt;br /&gt;
    sprintf(szName, &amp;quot;dynamic test case %d&amp;quot;, count);&lt;br /&gt;
    srTestCaseHandle_t test = srTestSuiteAddCase(szName, &amp;quot;this is a dynamic test case&amp;quot;);&lt;br /&gt;
    srTestCaseSetStatus(test, srTEST_PASS, 0); &lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#ifdef _SCL&lt;br /&gt;
#pragma scl_test_flist(&amp;quot;testfunc&amp;quot;, tfsuite_addCase)&lt;br /&gt;
#endif&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== srTestSuiteAddAnnotation ==&lt;br /&gt;
The srTestSuiteAddAnnotation() routine is used to add a new annotation to the specified test suite.&lt;br /&gt;
&amp;lt;source lang=c&amp;gt;&lt;br /&gt;
srTestAnnotationHandle_t srTestSuiteAddAnnotation(srTestAnnotationLevel_e eLevel,&lt;br /&gt;
                                                  const srCHAR * szName, &lt;br /&gt;
                                                  const srCHAR * szFmtDescr, ...)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;align:left;&amp;quot;  &lt;br /&gt;
| &#039;&#039;&#039;Parameters&#039;&#039;&#039; &lt;br /&gt;
| &#039;&#039;&#039;Type&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| eLevel&lt;br /&gt;
| Input &lt;br /&gt;
| Annotation level. &lt;br /&gt;
&lt;br /&gt;
* srTEST_ANNOTATION_LEVEL_TRACE,&lt;br /&gt;
* srTEST_ANNOTATION_LEVEL_DEBUG,&lt;br /&gt;
* srTEST_ANNOTATION_LEVEL_INFO,&lt;br /&gt;
* srTEST_ANNOTATION_LEVEL_WARN,&lt;br /&gt;
* srTEST_ANNOTATION_LEVEL_ERROR,&lt;br /&gt;
* srTEST_ANNOTATION_LEVEL_FATAL&lt;br /&gt;
|-&lt;br /&gt;
| szName &lt;br /&gt;
| Input &lt;br /&gt;
| Pointer to a null-terminated string representing the name of the new annotation. If null, the default host naming scheme will be used.&lt;br /&gt;
|-&lt;br /&gt;
| szFmtDescr&lt;br /&gt;
| Input &lt;br /&gt;
| Pointer to a null-terminated string representing the description of the new annotation. Cannot be null.&lt;br /&gt;
|-&lt;br /&gt;
| ... &lt;br /&gt;
| Input (Optional)&lt;br /&gt;
| Variable argument list to format szFmtDescr.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;align:left;&amp;quot;&lt;br /&gt;
| &#039;&#039;&#039;Return Value&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039; Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| srTestAnnotationHandle_t &lt;br /&gt;
| Handle of the newly created test annotation. srTEST_ANNOTATION_INVALID indicates failure to create a test annotation.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=c&amp;gt;&lt;br /&gt;
#include &amp;lt;srtest.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
void tfsuite_addAnnotation(void) &lt;br /&gt;
{&lt;br /&gt;
  for (int count = 0; count &amp;lt; 5; ++count)&lt;br /&gt;
  {&lt;br /&gt;
    char szName[25];&lt;br /&gt;
    sprintf(szName, &amp;quot;annotation %d&amp;quot;, count);&lt;br /&gt;
    srTestAnnotationHandle_t annot = &lt;br /&gt;
                     srTestSuiteAddAnnotation(srTEST_ANNOTATION_LEVEL_ERROR,&lt;br /&gt;
                                              szName,&lt;br /&gt;
                                              &amp;quot;description of annotation&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#ifdef _SCL&lt;br /&gt;
#pragma scl_test_flist(&amp;quot;testfunc&amp;quot;, tfsuite_addAnnotation)&lt;br /&gt;
#endif&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== srTestSuiteSetData ==&lt;br /&gt;
The srTestSuiteSetData() routine is used to associate a custom name|value pair with a test suite.&lt;br /&gt;
&amp;lt;source lang=c&amp;gt;&lt;br /&gt;
srWORD srTestSuiteSetData(const srCHAR * szName, const srCHAR * szFmtValue, ...)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;align:left;&amp;quot;  &lt;br /&gt;
| &#039;&#039;&#039;Parameters&#039;&#039;&#039; &lt;br /&gt;
| &#039;&#039;&#039;Type&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| szName &lt;br /&gt;
| Input&lt;br /&gt;
| Pointer to a null-terminated string representing the name of the custom pair. Cannot be null.&lt;br /&gt;
|-&lt;br /&gt;
| szFmtValue&lt;br /&gt;
| Input &lt;br /&gt;
| Pointer to a null-terminated string representing the value of the custom pair. Cannot be null.&lt;br /&gt;
|-&lt;br /&gt;
| ... &lt;br /&gt;
| Input (Optional)&lt;br /&gt;
| Variable argument list to format szFmtValue.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;align:left;&amp;quot;&lt;br /&gt;
| &#039;&#039;&#039;Return Value&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039; Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| srWORD &lt;br /&gt;
| srOK on success, srERR_HANDLE_INVALID on invalid handle.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=c&amp;gt;&lt;br /&gt;
#include &amp;lt;srtest.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
void tfcase_setData(void)&lt;br /&gt;
{&lt;br /&gt;
  srTestSuiteSetData(&amp;quot;MyName&amp;quot;, &amp;quot;my value&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#ifdef _SCL&lt;br /&gt;
#pragma scl_test_flist(&amp;quot;testfunc&amp;quot;, tfcase_setData)&lt;br /&gt;
#endif&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== srTestCaseSetStatus ==&lt;br /&gt;
The srTestCaseSetStatus() routine is used to set the result of test case.&lt;br /&gt;
&amp;lt;source lang=c&amp;gt;&lt;br /&gt;
srWORD srTestCaseSetStatus(srTestCaseHandle_t tTestCase, srTestStatus_e eStatus, srDWORD dwDuration)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;align:left;&amp;quot;  &lt;br /&gt;
| &#039;&#039;&#039;Parameters&#039;&#039;&#039; &lt;br /&gt;
| &#039;&#039;&#039;Type&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| tTestCase &lt;br /&gt;
| Input&lt;br /&gt;
| Handle to a test case. srTEST_CASE_DEFAULT can be used for the default test case.&lt;br /&gt;
|-&lt;br /&gt;
| eStatus &lt;br /&gt;
| Input &lt;br /&gt;
| Result of the test. Possible values are:&lt;br /&gt;
* &#039;&#039;&#039;srTEST_FAIL&#039;&#039;&#039;&lt;br /&gt;
* &#039;&#039;&#039;srTEST_PASS&#039;&#039;&#039;&lt;br /&gt;
* &#039;&#039;&#039;srTEST_NOTINUSE&#039;&#039;&#039;&lt;br /&gt;
* &#039;&#039;&#039;srTEST_INPROGRESS&#039;&#039;&#039;&lt;br /&gt;
* &#039;&#039;&#039;srTEST_DONE&#039;&#039;&#039; - applicable to dynamic cases - sets the status to &#039;&#039;&#039;pass&#039;&#039;&#039; unless already set to &#039;&#039;&#039;fail&#039;&#039;&#039; or &#039;&#039;&#039;not-in-use&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| dwDuration &lt;br /&gt;
| Input &lt;br /&gt;
| The duration of the test in clock ticks. Using &amp;quot;0&amp;quot; allows the STRIDE Runtime (Intercept Module) to set the time automatically.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;align:left;&amp;quot;&lt;br /&gt;
| &#039;&#039;&#039;Return Value&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039; Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| srWORD &lt;br /&gt;
| srOK on success, srERR_HANDLE_INVALID on invalid handle.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=c&amp;gt;&lt;br /&gt;
#include &amp;lt;srtest.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
void tfcase_setStatus(void)&lt;br /&gt;
{&lt;br /&gt;
  srTestCaseSetStatus(srTEST_CASE_DEFAULT, srTEST_PASS, 0);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#ifdef _SCL&lt;br /&gt;
#pragma scl_test_flist(&amp;quot;testfunc&amp;quot;, tfcase_setStatus)&lt;br /&gt;
#endif&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== srTestCaseSetStatusEx ==&lt;br /&gt;
The srTestCaseSetStatusEx() routine is used to set the result of test case and allow specification of an extendedFailureCode.&lt;br /&gt;
&amp;lt;source lang=c&amp;gt;&lt;br /&gt;
srWORD srTestCaseSetStatus(srTestCaseHandle_t tTestCase, srTestStatus_e eStatus, srDWORD dwDuration, srLONG lExtendedFailureCode)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;align:left;&amp;quot;  &lt;br /&gt;
| &#039;&#039;&#039;Parameters&#039;&#039;&#039; &lt;br /&gt;
| &#039;&#039;&#039;Type&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| tTestCase &lt;br /&gt;
| Input&lt;br /&gt;
| Handle to a test case. srTEST_CASE_DEFAULT can be used for the default test case.&lt;br /&gt;
|-&lt;br /&gt;
| eStatus &lt;br /&gt;
| Input &lt;br /&gt;
| Result of the test.&lt;br /&gt;
|-&lt;br /&gt;
| dwDuration &lt;br /&gt;
| Input &lt;br /&gt;
| The duration of the test in clock ticks. Using &amp;quot;0&amp;quot; allows the STRIDE Runtime (Intercept Module) to set the time automatically.&lt;br /&gt;
|-&lt;br /&gt;
| lExtendedFailureCode &lt;br /&gt;
| Input &lt;br /&gt;
| The Stride framework uses the extendedFailureCode to capture the numeric results of test method when the test method fails via a numeric (non-void, nonbool) return type.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;align:left;&amp;quot;&lt;br /&gt;
| &#039;&#039;&#039;Return Value&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039; Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| srWORD &lt;br /&gt;
| srOK on success, srERR_HANDLE_INVALID on invalid handle.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=c&amp;gt;&lt;br /&gt;
#include &amp;lt;srtest.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
void tfcase_setStatusEx(void)&lt;br /&gt;
{&lt;br /&gt;
  srTestCaseSetStatusEx(srTEST_CASE_DEFAULT, srTEST_FAIL, 0, -5);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#ifdef _SCL&lt;br /&gt;
#pragma scl_test_flist(&amp;quot;testfunc&amp;quot;, tfcase_setStatusEx)&lt;br /&gt;
#endif&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== srTestCaseAddAnnotation ==&lt;br /&gt;
The srTestCaseAddAnnotation() routine is used to add a new annotation to the specified test case.&lt;br /&gt;
&amp;lt;source lang=c&amp;gt;&lt;br /&gt;
srTestAnnotationHandle_t srTestCaseAddAnnotation(rTestCaseHandle_t tTestCase, srTestAnnotationLevel_e eLevel, const srCHAR * szName, const srCHAR * szFmtDescr, ...)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;align:left;&amp;quot;  &lt;br /&gt;
| &#039;&#039;&#039;Parameters&#039;&#039;&#039; &lt;br /&gt;
| &#039;&#039;&#039;Type&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| tTestCase &lt;br /&gt;
| Input&lt;br /&gt;
| Handle to the parent test case to which new test annotation is to be added. srTEST_CASE_DEFAULT can be used for the default test case.&lt;br /&gt;
|-&lt;br /&gt;
| eLevel&lt;br /&gt;
| Input &lt;br /&gt;
| Annotation level. &lt;br /&gt;
&lt;br /&gt;
* srTEST_ANNOTATION_LEVEL_TRACE,&lt;br /&gt;
* srTEST_ANNOTATION_LEVEL_DEBUG,&lt;br /&gt;
* srTEST_ANNOTATION_LEVEL_INFO,&lt;br /&gt;
* srTEST_ANNOTATION_LEVEL_WARN,&lt;br /&gt;
* srTEST_ANNOTATION_LEVEL_ERROR,&lt;br /&gt;
* srTEST_ANNOTATION_LEVEL_FATAL&lt;br /&gt;
|-&lt;br /&gt;
| szName &lt;br /&gt;
| Input &lt;br /&gt;
| Pointer to a null-terminated string representing the name of the new annotation. If null, the default host naming scheme will be used.&lt;br /&gt;
|-&lt;br /&gt;
| szFmtDescr&lt;br /&gt;
| Input &lt;br /&gt;
| Pointer to a null-terminated string representing the description of the new annotation. Cannot be null.&lt;br /&gt;
|-&lt;br /&gt;
| ... &lt;br /&gt;
| Input (Optional)&lt;br /&gt;
| Variable argument list to format szFmtDescr.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;align:left;&amp;quot;&lt;br /&gt;
| &#039;&#039;&#039;Return Value&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039; Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| srTestAnnotationHandle_t &lt;br /&gt;
| Handle of the newly created test annotation. srTEST_ANNOTATION_INVALID indicates failure to create a test annotation.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=c&amp;gt;&lt;br /&gt;
#include &amp;lt;srtest.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
void tfcase_addAnnotation(void) &lt;br /&gt;
{&lt;br /&gt;
  for (int count = 0; count &amp;lt; 5; ++count)&lt;br /&gt;
  {&lt;br /&gt;
    char szName[25];&lt;br /&gt;
    sprintf(szName, &amp;quot;annotation %d&amp;quot;, count);&lt;br /&gt;
    srTestAnnotationHandle_t annot = &lt;br /&gt;
                     srTestCaseAddAnnotation(srTEST_CASE_DEFAULT,&lt;br /&gt;
                                             srTEST_ANNOTATION_LEVEL_ERROR,&lt;br /&gt;
                                             szName,&lt;br /&gt;
                                             &amp;quot;description of annotation&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#ifdef _SCL&lt;br /&gt;
#pragma scl_test_flist(&amp;quot;testfunc&amp;quot;, tfcase_addAnnotation)&lt;br /&gt;
#endif&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== srTestCaseSetData ==&lt;br /&gt;
The srTestCaseSetData() routine is used to associate a custom name|value pair with a test case.&lt;br /&gt;
&amp;lt;source lang=c&amp;gt;&lt;br /&gt;
srWORD srTestCaseSetData(srTestCaseHandle_t tTestCase, const srCHAR * szName, const srCHAR * szFmtValue, ...);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;align:left;&amp;quot;  &lt;br /&gt;
| &#039;&#039;&#039;Parameters&#039;&#039;&#039; &lt;br /&gt;
| &#039;&#039;&#039;Type&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| tTestCase &lt;br /&gt;
| Input&lt;br /&gt;
| Handle to a test case. srTEST_CASE_DEFAULT can be used for the default test case.&lt;br /&gt;
|-&lt;br /&gt;
| szName&lt;br /&gt;
| Input&lt;br /&gt;
| Pointer to a null-terminated string representing the name of the custom pair. Cannot be null.&lt;br /&gt;
|-&lt;br /&gt;
| szFmtValue &lt;br /&gt;
| Input &lt;br /&gt;
| Pointer to a null-terminated string representing the value of the custom pair. Cannot be null.&lt;br /&gt;
|-&lt;br /&gt;
| ... &lt;br /&gt;
| Input (Optional)&lt;br /&gt;
| Variable argument list to format szFmtValue.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;align:left;&amp;quot;&lt;br /&gt;
| &#039;&#039;&#039;Return Value&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039; Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| srWORD &lt;br /&gt;
| srOK on success, srERR_HANDLE_INVALID on invalid handle.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=c&amp;gt;&lt;br /&gt;
#include &amp;lt;srtest.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
void tfcase_setData(void)&lt;br /&gt;
{&lt;br /&gt;
  srTestCaseSetData(srTEST_CASE_DEFAULT, &amp;quot;MyName&amp;quot;, &amp;quot;my value&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#ifdef _SCL&lt;br /&gt;
#pragma scl_test_flist(&amp;quot;testfunc&amp;quot;, tfcase_setData)&lt;br /&gt;
#endif&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== srTestAnnotationAddComment ==&lt;br /&gt;
The srTestAnnotationAddComment() routine is used to add a comment (aka a log) to a test annotation.&lt;br /&gt;
&amp;lt;source lang=c&amp;gt;&lt;br /&gt;
srWORD srTestAnnotationAddComment(srTestAnnotationHandle_t tTestAnnotation, const srCHAR * szLabel, const srCHAR * szFmtComment, ...)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;align:left;&amp;quot;  &lt;br /&gt;
| &#039;&#039;&#039;Parameters&#039;&#039;&#039; &lt;br /&gt;
| &#039;&#039;&#039;Type&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| tTestAnnotation&lt;br /&gt;
| Input&lt;br /&gt;
| Handle to a test annotation.&lt;br /&gt;
|-&lt;br /&gt;
| szLabel&lt;br /&gt;
| Input &lt;br /&gt;
| Pointer to a null-terminated string for the label. If null, the default label will be applied.&lt;br /&gt;
|-&lt;br /&gt;
| szFmtComment &lt;br /&gt;
| Input &lt;br /&gt;
| Pointer to a null-terminated string representing the new comment. Cannot be null.&lt;br /&gt;
|-&lt;br /&gt;
| ... &lt;br /&gt;
| Input (Optional)&lt;br /&gt;
| Variable argument list to format szFmtComment.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;align:left;&amp;quot;&lt;br /&gt;
| &#039;&#039;&#039;Return Value&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039; Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| srWORD &lt;br /&gt;
| srOK on success, srERR on null string or invalid formatted string, srERR_HANDLE_INVALID on invalid handle, srERR_STR_TRUNCATED on truncated string.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=c&amp;gt;&lt;br /&gt;
#include &amp;lt;srtest.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
void tfsuiteAnnotation_addComment(void) &lt;br /&gt;
{&lt;br /&gt;
  srTestAnnotationHandle_t annot = &lt;br /&gt;
                           srTestSuiteAddAnnotation(srTEST_ANNOTATION_LEVEL_ERROR,&lt;br /&gt;
                                                    &amp;quot;annot&amp;quot;,&lt;br /&gt;
                                                    &amp;quot;annot description&amp;quot;);&lt;br /&gt;
  srTestAnnotationAddComment(annot,&lt;br /&gt;
                             srNULL,&lt;br /&gt;
                             &amp;quot;this comment should print %s&amp;quot;, &amp;quot;A STRING&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#ifdef _SCL&lt;br /&gt;
#pragma scl_test_flist(&amp;quot;testfunc&amp;quot;, tfsuiteAnnotation_addComment)&lt;br /&gt;
#endif&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= C++ Test Classes =&lt;br /&gt;
The Runtime Test Services C APIs work equally well from C test functions and C++ test classes. If, however, you are using C++ it might be more convinient for you to derive your C++ test classes from the Runtime Test Services C++ base class, &#039;&#039;srTest&#039;&#039;. That way you will have access to a set of simpler to use C++ classes. &lt;br /&gt;
&lt;br /&gt;
The following C++ classes are provided: &lt;br /&gt;
* &#039;&#039;&#039;[[#class srTest|class srTest]]&#039;&#039;&#039; - base test class&lt;br /&gt;
* &#039;&#039;&#039;[[#class srTestCase|class srTestCase]]&#039;&#039;&#039; - represents a test case&lt;br /&gt;
* &#039;&#039;&#039;[[#class srTestAnnotation|class srTestAnnotation]]&#039;&#039;&#039; - represents a test annotation&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== class srTest ==&lt;br /&gt;
The srTest class provides one member object &#039;&#039;testCase&#039;&#039; of [[#class srTestCase|class srTestCase]] and the folowing methods:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== method GetParam ===&lt;br /&gt;
This overload of the GetParam() method is used to get the value of a named parameter as a string.&lt;br /&gt;
&amp;lt;source lang=cpp&amp;gt;&lt;br /&gt;
static srWORD GetParam(const srCHAR * name, srCHAR * value, srDWORD size, const srCHAR * defval = srNULL)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;align:left;&amp;quot;  &lt;br /&gt;
| &#039;&#039;&#039;Parameters&#039;&#039;&#039; &lt;br /&gt;
| &#039;&#039;&#039;Type&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| name &lt;br /&gt;
| Input&lt;br /&gt;
| Pointer to a null-terminated string that represents the name of the parameter. Cannot be null.&lt;br /&gt;
|-&lt;br /&gt;
| value &lt;br /&gt;
| Output &lt;br /&gt;
| Pointer to a block of memory to store the value of the parameter with a maximum size of &amp;lt;i&amp;gt;size&amp;lt;/i&amp;gt; chars&lt;br /&gt;
|-&lt;br /&gt;
| size &lt;br /&gt;
| Input &lt;br /&gt;
| Size in chars of the buffer pointed to by &amp;lt;i&amp;gt;value&amp;lt;/i&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| defvalue &lt;br /&gt;
| Input (optional) &lt;br /&gt;
| Pointer to a null-terminated string that represents a default value in case the parameter is not specified. By setting this value to srNULL (or omitting it), you can use &amp;lt;i&amp;gt;GetParam()&amp;lt;/i&amp;gt; to test for the existence of a named parameter. If the named parameter doesn&#039;t exist, the function will return &amp;lt;i&amp;gt;srERR_HANDLE_INVALID&amp;lt;/i&amp;gt;.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;align:left;&amp;quot;&lt;br /&gt;
| &#039;&#039;&#039;Return Value&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039; Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| srWORD &lt;br /&gt;
| srOK on success, error otherwise.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=cpp&amp;gt;&lt;br /&gt;
#include &amp;lt;srtest.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
class srtest_class : public stride::srTest&lt;br /&gt;
{&lt;br /&gt;
public:&lt;br /&gt;
  void getParam()&lt;br /&gt;
  {&lt;br /&gt;
    GetParam(&amp;quot;ParamName&amp;quot;, szValue, MAX_VALUE_LEN, &amp;quot;default value&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
#ifdef _SCL&lt;br /&gt;
#pragma scl_test_class(srtest_class)&lt;br /&gt;
#endif&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== method GetParam ===&lt;br /&gt;
This overload of the GetParam() method is used to get the value of a named parameter as a long.&lt;br /&gt;
&amp;lt;source lang=cpp&amp;gt;&lt;br /&gt;
static long GetParam(const srCHAR * name, srLONG defval = 0)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;align:left;&amp;quot;  &lt;br /&gt;
| &#039;&#039;&#039;Parameters&#039;&#039;&#039; &lt;br /&gt;
| &#039;&#039;&#039;Type&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| name &lt;br /&gt;
| Input&lt;br /&gt;
| Pointer to a null-terminated string that represents the name of the parameter.&lt;br /&gt;
|-&lt;br /&gt;
| defvalue&lt;br /&gt;
| Input &lt;br /&gt;
| Default value that is returned if the parameter is not found.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;align:left;&amp;quot;&lt;br /&gt;
| &#039;&#039;&#039;Return Value&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039; Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| srLONG&lt;br /&gt;
| Parameter value, or value specified by &amp;lt;i&amp;gt;defvalue&amp;lt;/i&amp;gt; if parameter isn&#039;t found.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=cpp&amp;gt;&lt;br /&gt;
#include &amp;lt;srtest.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
class srtest_class : public stride::srTest&lt;br /&gt;
{&lt;br /&gt;
public:&lt;br /&gt;
  void getParam()&lt;br /&gt;
  {&lt;br /&gt;
    srLONG lValue = GetParam(&amp;quot;ParamName&amp;quot;, -1);&lt;br /&gt;
  }&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
#ifdef _SCL&lt;br /&gt;
#pragma scl_test_class(srtest_class)&lt;br /&gt;
#endif&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== method GetParam ===&lt;br /&gt;
This overload of the GetParam() method is used to get the value of a named parameter as a double.&lt;br /&gt;
&amp;lt;source lang=cpp&amp;gt;&lt;br /&gt;
static double GetParam(const srCHAR * name, const double&amp;amp; defval)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;align:left;&amp;quot;  &lt;br /&gt;
| &#039;&#039;&#039;Parameters&#039;&#039;&#039; &lt;br /&gt;
| &#039;&#039;&#039;Type&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| name &lt;br /&gt;
| Input&lt;br /&gt;
| Pointer to a null-terminated string that represents the name of the parameter.&lt;br /&gt;
|-&lt;br /&gt;
| defvalue&lt;br /&gt;
| Input &lt;br /&gt;
| Default value that is returned if the parameter is not found.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;align:left;&amp;quot;&lt;br /&gt;
| &#039;&#039;&#039;Return Value&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039; Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| double&lt;br /&gt;
| Parameter value, or value specified by &amp;lt;i&amp;gt;defvalue&amp;lt;/i&amp;gt; if parameter isn&#039;t found.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=cpp&amp;gt;&lt;br /&gt;
#include &amp;lt;srtest.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
class srtest_class : public stride::srTest&lt;br /&gt;
{&lt;br /&gt;
public:&lt;br /&gt;
  void getParam()&lt;br /&gt;
  {&lt;br /&gt;
    double dbVal = GetParam(&amp;quot;ParamName&amp;quot;,  0.5772156649);&lt;br /&gt;
  }&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
#ifdef _SCL&lt;br /&gt;
#pragma scl_test_class(srtest_class)&lt;br /&gt;
#endif&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== method AddCase ===&lt;br /&gt;
The AddCase method is used to add a new test case to the test suite.&lt;br /&gt;
&amp;lt;source lang=cpp&amp;gt;&lt;br /&gt;
srTestCase AddCase(const srCHAR * name, const srCHAR * descr = srNULL)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;align:left;&amp;quot;  &lt;br /&gt;
| &#039;&#039;&#039;Parameters&#039;&#039;&#039; &lt;br /&gt;
| &#039;&#039;&#039;Type&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|- &lt;br /&gt;
| name &lt;br /&gt;
| Input&lt;br /&gt;
| Pointer to null-terminated string that represents the name of the new test case. If empty, the default host naming scheme will be used.&lt;br /&gt;
|- &lt;br /&gt;
| descr &lt;br /&gt;
| Input (Optional)&lt;br /&gt;
| Pointer to null-terminated string representing the description of the new test case. If empty, description will be blank.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;align:left;&amp;quot;&lt;br /&gt;
| &#039;&#039;&#039;Return Value&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039; Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| srTestCase &lt;br /&gt;
| Newly created test case instance.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;source lang=cpp&amp;gt;&lt;br /&gt;
#include &amp;lt;srtest.h&amp;gt;&lt;br /&gt;
#include &amp;lt;sstream&amp;gt;&lt;br /&gt;
&lt;br /&gt;
class srtest_class : public stride::srTest&lt;br /&gt;
{&lt;br /&gt;
public:&lt;br /&gt;
  void suiteAddSuite()&lt;br /&gt;
  {&lt;br /&gt;
    const std::string prefix(&amp;quot;dynamic test case &amp;quot;);&lt;br /&gt;
    for (int count = 0; count &amp;lt; 5; ++count)&lt;br /&gt;
    {&lt;br /&gt;
      std::stringstream strm;&lt;br /&gt;
      strm &amp;lt;&amp;lt; prefix &amp;lt;&amp;lt; count;&lt;br /&gt;
      stride::srTestCase tc = AddCase(strm.str().c_str());&lt;br /&gt;
      tc.SetStatus(srTEST_PASS);&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
#ifdef _SCL&lt;br /&gt;
#pragma scl_test_class(srtest_class)&lt;br /&gt;
#endif&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== method AddAnnotation ===&lt;br /&gt;
The AddAnnotation method is used to add a new test annotation to the test suite.&lt;br /&gt;
&amp;lt;source lang=cpp&amp;gt;&lt;br /&gt;
srTestAnnotation AddAnnotation(srTestAnnotationLevel_e level, const srCHAR * name, const srCHAR * descr, ...)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;align:left;&amp;quot;  &lt;br /&gt;
| &#039;&#039;&#039;Parameters&#039;&#039;&#039; &lt;br /&gt;
| &#039;&#039;&#039;Type&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|- &lt;br /&gt;
| level&lt;br /&gt;
| Input&lt;br /&gt;
| Annotation level. &lt;br /&gt;
&lt;br /&gt;
* srTEST_ANNOTATION_LEVEL_TRACE,&lt;br /&gt;
* srTEST_ANNOTATION_LEVEL_DEBUG,&lt;br /&gt;
* srTEST_ANNOTATION_LEVEL_INFO,&lt;br /&gt;
* srTEST_ANNOTATION_LEVEL_WARN,&lt;br /&gt;
* srTEST_ANNOTATION_LEVEL_ERROR,&lt;br /&gt;
* srTEST_ANNOTATION_LEVEL_FATAL&lt;br /&gt;
|- &lt;br /&gt;
| name &lt;br /&gt;
| Input &lt;br /&gt;
| Pointer to null-terminated string that represents the name of the new annotation. If empty, the default host naming scheme will be used.&lt;br /&gt;
|- &lt;br /&gt;
| descr&lt;br /&gt;
| Input &lt;br /&gt;
| Pointer to null-terminated string representing the description of the new annotation. Cannot be null.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;align:left;&amp;quot;&lt;br /&gt;
| &#039;&#039;&#039;Return Value&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039; Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| srTestAnnotation&lt;br /&gt;
| Newly created annotation instance.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=cpp&amp;gt;&lt;br /&gt;
#include &amp;lt;srtest.h&amp;gt;&lt;br /&gt;
#include &amp;lt;sstream&amp;gt;&lt;br /&gt;
&lt;br /&gt;
class srtest_class : public stride::srTest&lt;br /&gt;
{&lt;br /&gt;
public:&lt;br /&gt;
  void suiteAddAnnotation()&lt;br /&gt;
  {&lt;br /&gt;
    for (int count = 0; count &amp;lt; 5; ++count)&lt;br /&gt;
    {&lt;br /&gt;
      std::stringstream strmName;&lt;br /&gt;
      std::stringstream strmDescr;&lt;br /&gt;
      strmName &amp;lt;&amp;lt; &amp;quot;annotation &amp;quot; &amp;lt;&amp;lt; count;&lt;br /&gt;
      strmDescr &amp;lt;&amp;lt; &amp;quot;description of annotation &amp;quot; &amp;lt;&amp;lt; count;&lt;br /&gt;
      stride::srTestAnnotation ta = AddAnnotation(srTEST_ANNOTATION_LEVEL_INFO,&lt;br /&gt;
                                                  strmName.str().c_str(),&lt;br /&gt;
                                                  strmDescr.str().c_str());&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
#ifdef _SCL&lt;br /&gt;
#pragma scl_test_class(srtest_class)&lt;br /&gt;
#endif&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== method SetData ===&lt;br /&gt;
The SetData method is used to associate a custom name|value pair with the test suite.&lt;br /&gt;
&amp;lt;source lang=cpp&amp;gt;&lt;br /&gt;
srWORD SetData(const srCHAR * name, const srCHAR * value, ...)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;align:left;&amp;quot;  &lt;br /&gt;
| &#039;&#039;&#039;Parameters&#039;&#039;&#039; &lt;br /&gt;
| &#039;&#039;&#039;Type&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|- &lt;br /&gt;
| name &lt;br /&gt;
| Input&lt;br /&gt;
| Pointer to a null-terminated string representing the name of the custom pair. Cannot be null.&lt;br /&gt;
|- &lt;br /&gt;
| value&lt;br /&gt;
| Input&lt;br /&gt;
| Pointer to a null-terminated string representing the value of the custom pair. Cannot be null.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;align:left;&amp;quot;&lt;br /&gt;
| &#039;&#039;&#039;Return Value&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039; Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| srWORD &lt;br /&gt;
| srOK on success, srERR_HANDLE_INVALID on invalid handle.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;source lang=cpp&amp;gt;&lt;br /&gt;
#include &amp;lt;srtest.h&amp;gt;&lt;br /&gt;
#include &amp;lt;sstream&amp;gt;&lt;br /&gt;
&lt;br /&gt;
class srtest_class : public stride::srTest&lt;br /&gt;
{&lt;br /&gt;
public:&lt;br /&gt;
  void suiteSetData()&lt;br /&gt;
  {&lt;br /&gt;
      SetData(&amp;quot;MyName&amp;quot;, &amp;quot;my value&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
#ifdef _SCL&lt;br /&gt;
#pragma scl_test_class(srtest_class)&lt;br /&gt;
#endif&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== class srTestCase ==&lt;br /&gt;
The srTestCase class provides the following methods:&lt;br /&gt;
&lt;br /&gt;
=== method SetStatus ===&lt;br /&gt;
The SetStatus method is used to set the result of the default test case.&lt;br /&gt;
&amp;lt;source lang=cpp&amp;gt;&lt;br /&gt;
srWORD SetStatus(srTestStatus_e status, srDWORD duration = 0)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;align:left;&amp;quot;  &lt;br /&gt;
| &#039;&#039;&#039;Parameters&#039;&#039;&#039; &lt;br /&gt;
| &#039;&#039;&#039;Type&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|- &lt;br /&gt;
| status &lt;br /&gt;
| Input &lt;br /&gt;
| Result of the test. Possible values are:&lt;br /&gt;
* &#039;&#039;&#039;srTEST_FAIL&#039;&#039;&#039;&lt;br /&gt;
* &#039;&#039;&#039;srTEST_PASS&#039;&#039;&#039;&lt;br /&gt;
* &#039;&#039;&#039;srTEST_NOTINUSE&#039;&#039;&#039;&lt;br /&gt;
* &#039;&#039;&#039;srTEST_INPROGRESS&#039;&#039;&#039;&lt;br /&gt;
* &#039;&#039;&#039;srTEST_DONE&#039;&#039;&#039; - applicable to dynamic cases - sets the status to &#039;&#039;&#039;pass&#039;&#039;&#039; unless already set to &#039;&#039;&#039;fail&#039;&#039;&#039; or &#039;&#039;&#039;not-in-use&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| duration &lt;br /&gt;
| Input (Optional)&lt;br /&gt;
| The duration of the test in clock ticks. The default is 0.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;align:left;&amp;quot;&lt;br /&gt;
| &#039;&#039;&#039;Return Value&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039; Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| srWORD &lt;br /&gt;
| srOK on success, srERR_HANDLE_INVALID on invalid handle.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=cpp&amp;gt;&lt;br /&gt;
#include &amp;lt;srtest.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
class srtest_class : public stride::srTest&lt;br /&gt;
{&lt;br /&gt;
public:&lt;br /&gt;
  void caseSetStatus()&lt;br /&gt;
  {&lt;br /&gt;
    testCase.SetStatus(srTEST_NOTINUSE);&lt;br /&gt;
  }&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
#ifdef _SCL&lt;br /&gt;
#pragma scl_test_class(srtest_class)&lt;br /&gt;
#endif&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== method AddAnnotation ===&lt;br /&gt;
The AddAnnotation method is used to add a new test annotation to the test case.&lt;br /&gt;
&amp;lt;source lang=cpp&amp;gt;&lt;br /&gt;
srTestAnnotation AddAnnotation(srTestAnnotationLevel_e level, const srCHAR * name, const srCHAR * descr, ...)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;align:left;&amp;quot;  &lt;br /&gt;
| &#039;&#039;&#039;Parameters&#039;&#039;&#039; &lt;br /&gt;
| &#039;&#039;&#039;Type&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|- &lt;br /&gt;
| level&lt;br /&gt;
| Input&lt;br /&gt;
| Annotation level. &lt;br /&gt;
&lt;br /&gt;
* srTEST_ANNOTATION_LEVEL_TRACE,&lt;br /&gt;
* srTEST_ANNOTATION_LEVEL_DEBUG,&lt;br /&gt;
* srTEST_ANNOTATION_LEVEL_INFO,&lt;br /&gt;
* srTEST_ANNOTATION_LEVEL_WARN,&lt;br /&gt;
* srTEST_ANNOTATION_LEVEL_ERROR,&lt;br /&gt;
* srTEST_ANNOTATION_LEVEL_FATAL&lt;br /&gt;
|- &lt;br /&gt;
| name&lt;br /&gt;
| Input&lt;br /&gt;
| Pointer to null-terminated string that represents the name of the new annotation. If null, the default host naming scheme will be used.&lt;br /&gt;
|- &lt;br /&gt;
| descr&lt;br /&gt;
| Input&lt;br /&gt;
| Pointer to null-terminated string representing the description of the new annotation. Cannot be null.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;align:left;&amp;quot;&lt;br /&gt;
| &#039;&#039;&#039;Return Value&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039; Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| srTestAnnotation&lt;br /&gt;
| Newly created annotation instance.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=cpp&amp;gt;&lt;br /&gt;
#include &amp;lt;srtest.h&amp;gt;&lt;br /&gt;
#include &amp;lt;sstream&amp;gt;&lt;br /&gt;
&lt;br /&gt;
class srtest_class : public stride::srTest&lt;br /&gt;
{&lt;br /&gt;
public:&lt;br /&gt;
  void caseAddAnnotation()&lt;br /&gt;
  {&lt;br /&gt;
    for (int count = 0; count &amp;lt; 5; ++count)&lt;br /&gt;
    {&lt;br /&gt;
      std::stringstream strmName;&lt;br /&gt;
      std::stringstream strmDescr;&lt;br /&gt;
      strmName &amp;lt;&amp;lt; &amp;quot;annotation &amp;quot; &amp;lt;&amp;lt; count;&lt;br /&gt;
      strmDescr &amp;lt;&amp;lt; &amp;quot;description of annotation &amp;quot; &amp;lt;&amp;lt; count;&lt;br /&gt;
      stride::srTestAnnotation ta = &lt;br /&gt;
                 testCase.AddAnnotation(srTEST_ANNOTATION_LEVEL_INFO,&lt;br /&gt;
                                         strmName.str().c_str(),&lt;br /&gt;
                                         strmDescr.str().c_str());&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
#ifdef _SCL&lt;br /&gt;
#pragma scl_test_class(srtest_class)&lt;br /&gt;
#endif&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== method SetData ===&lt;br /&gt;
The SetData method is used to associate a custom name|value pair with the test case.&lt;br /&gt;
&amp;lt;source lang=cpp&amp;gt;&lt;br /&gt;
srWORD SetData(const srCHAR * name, const srCHAR * value, ...)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;align:left;&amp;quot;  &lt;br /&gt;
| &#039;&#039;&#039;Parameters&#039;&#039;&#039; &lt;br /&gt;
| &#039;&#039;&#039;Type&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|- &lt;br /&gt;
| name&lt;br /&gt;
| Input &lt;br /&gt;
| Pointer to a null-terminated string representing the name of the custom pair. Cannot be null.&lt;br /&gt;
|- &lt;br /&gt;
| value&lt;br /&gt;
| Input &lt;br /&gt;
| Pointer to a null-terminated string representing the value of the custom pair. Cannot be null.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;align:left;&amp;quot;&lt;br /&gt;
| &#039;&#039;&#039;Return Value&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039; Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| srWORD &lt;br /&gt;
| srOK on success, srERR_HANDLE_INVALID on invalid handle.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=cpp&amp;gt;&lt;br /&gt;
#include &amp;lt;srtest.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
class srtest_class : public stride::srTest&lt;br /&gt;
{&lt;br /&gt;
public:&lt;br /&gt;
  void caseSetData()&lt;br /&gt;
  {&lt;br /&gt;
    testCase.SetData(&amp;quot;MyName&amp;quot;, &amp;quot;my value&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
#ifdef _SCL&lt;br /&gt;
#pragma scl_test_class(srtest_class)&lt;br /&gt;
#endif&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== class srTestAnnotation ==&lt;br /&gt;
The srTestAnnotation class provides the following methods:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== method AddComment ===&lt;br /&gt;
The AddComment method is used to add a comment to the test annotation.&lt;br /&gt;
&amp;lt;source lang=cpp&amp;gt;&lt;br /&gt;
srWORD AddComment(const srCHAR * label, const srCHAR * comment, ...)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;align:left;&amp;quot;  &lt;br /&gt;
| &#039;&#039;&#039;Parameters&#039;&#039;&#039; &lt;br /&gt;
| &#039;&#039;&#039;Type&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|- &lt;br /&gt;
| label&lt;br /&gt;
| Input &lt;br /&gt;
| Pointer to null-terminated string for the label. If null, the default label will be applied.&lt;br /&gt;
|- &lt;br /&gt;
| comment&lt;br /&gt;
| Input &lt;br /&gt;
| Pointer to null-terminated string representing the new comment. Cannot be empty.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;align:left;&amp;quot;&lt;br /&gt;
| &#039;&#039;&#039;Return Value&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039; Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| srWORD &lt;br /&gt;
| srOK on success, srERR on null string or invalid formatted string, srERR_HANDLE_INVALID on invalid handle, srERR_STR_TRUNCATED on truncated string.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=cpp&amp;gt;&lt;br /&gt;
#include &amp;lt;srtest.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
class srtest_class : public stride::srTest&lt;br /&gt;
{&lt;br /&gt;
public:&lt;br /&gt;
  void suiteAnnotationAddComment()&lt;br /&gt;
  {&lt;br /&gt;
    stride::srTestAnnotation ta = &lt;br /&gt;
                 testSuite.AddAnnotation(srTEST_ANNOTATION_LEVEL_INFO,&lt;br /&gt;
                                         &amp;quot;annot&amp;quot;,&lt;br /&gt;
                                         &amp;quot;annot description&amp;quot;);&lt;br /&gt;
    ta.AddComment(&amp;quot;this comment on annotation should print %s&amp;quot;, &amp;quot;A STRING&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
#ifdef _SCL&lt;br /&gt;
#pragma scl_test_class(srtest_class)&lt;br /&gt;
#endif&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ryanh</name></author>
	</entry>
	<entry>
		<id>https://www.stridewiki.com/index.php?title=Notes&amp;diff=14451</id>
		<title>Notes</title>
		<link rel="alternate" type="text/html" href="https://www.stridewiki.com/index.php?title=Notes&amp;diff=14451"/>
		<updated>2015-07-07T16:37:50Z</updated>

		<summary type="html">&lt;p&gt;Ryanh: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
Note macros provide a simple means to add annotations attached to the currently executing test case. These annotations are added to the test report with a level of either &#039;&#039;Error&#039;&#039;, &#039;&#039;Warning&#039;&#039;, or &#039;&#039;Info&#039;&#039; according to the macro that is used. The message also includes the file and line number. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example usage of Notes&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;source lang=&#039;c&#039;&amp;gt;&lt;br /&gt;
srNOTE_INFO(&amp;quot;This is an info message with format string %s and %s.&amp;quot;, &amp;quot;this&amp;quot;, &amp;quot;that&amp;quot;);&lt;br /&gt;
srNOTE_WARN(&amp;quot;This is a warning message with format string %d.&amp;quot;, 123);&lt;br /&gt;
srNOTE_ERROR(&amp;quot;This is an error message.&amp;quot;);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Syntax ==&lt;br /&gt;
The &#039;&#039;message&#039;&#039; is a pointer to a null-terminated format string&lt;br /&gt;
&lt;br /&gt;
  srNOTE_INFO(&#039;&#039;message&#039;&#039;, ...)&lt;br /&gt;
  srNOTE_WARN(&#039;&#039;message&#039;&#039;, ...)&lt;br /&gt;
  srNOTE_ERRO(&#039;&#039;message&#039;&#039;, ...)&lt;br /&gt;
&lt;br /&gt;
* versions of these log macros also exist for use with dynamically generated test cases. To use these macros, just append &#039;&#039;&#039;_DYN&#039;&#039;&#039; to the macro names shown above and then pass the explicit &#039;&#039;testCaseHandle_t&#039;&#039; item as the first argument to the macros.&lt;br /&gt;
* The maximum length of the message string approximately 1000 characters. If the maximum length is exceeded, the message string is truncated.&lt;/div&gt;</summary>
		<author><name>Ryanh</name></author>
	</entry>
	<entry>
		<id>https://www.stridewiki.com/index.php?title=Test_Macros&amp;diff=14450</id>
		<title>Test Macros</title>
		<link rel="alternate" type="text/html" href="https://www.stridewiki.com/index.php?title=Test_Macros&amp;diff=14450"/>
		<updated>2015-07-07T16:35:08Z</updated>

		<summary type="html">&lt;p&gt;Ryanh: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
The Stride implementation of [http://en.wikipedia.org/wiki/Assertion_(software_development) assertions] are provided with a set of Test Macros (declared in srtest.h) available for use within test methods. The macros are optional - you are not required to use them in your &#039;&#039;&#039;Test Units&#039;&#039;&#039;. They provide shortcuts for testing assertions and automatic report annotation in the case of failures.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example Test Macros&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;source  lang=cpp&amp;gt;&lt;br /&gt;
#include &amp;lt;mytest.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
void MyTest::CheckFoo() {&lt;br /&gt;
    ..  &lt;br /&gt;
    srEXPECT_EQ(foo(2 + 2), 4); &lt;br /&gt;
}&lt;br /&gt;
void MyTest::CheckBoo() {&lt;br /&gt;
    ..&lt;br /&gt;
    srEXPECT_GT(boo(3 * 3), 7); &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Guidelines ==&lt;br /&gt;
&lt;br /&gt;
There are three types of macros: &#039;&#039;&#039;EXPECT&#039;&#039;&#039;, &#039;&#039;&#039;ASSERT&#039;&#039;&#039;, and &#039;&#039;&#039;EXIT&#039;&#039;&#039; macros. They have slight but important differences in their behavior.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;srEXPECT_&#039;&#039;xx&#039;&#039;(&#039;&#039;&#039;&#039;&#039;condition&#039;&#039;&#039;&#039;&#039;)&#039;&#039;&#039; &lt;br /&gt;
* If the condition &amp;lt;u&amp;gt;does&amp;lt;/u&amp;gt; match the expectation, this macro:&lt;br /&gt;
** sets the current test case status to PASS&lt;br /&gt;
* If the condition &amp;lt;u&amp;gt;does not&amp;lt;/u&amp;gt; match the expectation, this macro:&lt;br /&gt;
** sets the current test case status to FAIL&lt;br /&gt;
** adds a comment to the current test case&#039;s results report which includes the condition as well as file and line number&lt;br /&gt;
** does not alter code execution  &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;srASSERT_&#039;&#039;xx&#039;&#039;(&#039;&#039;&#039;&#039;&#039;condition&#039;&#039;&#039;&#039;&#039;)&#039;&#039;&#039; &lt;br /&gt;
* If the condition &amp;lt;u&amp;gt;does&amp;lt;/u&amp;gt; match the assertion, this macro:&lt;br /&gt;
** sets the current test case status to PASS&lt;br /&gt;
* If the condition &amp;lt;u&amp;gt;does not&amp;lt;/u&amp;gt; match the expectation, this macro:&lt;br /&gt;
** sets the current test case status to FAIL &lt;br /&gt;
** adds a comment to the current test case&#039;s results report which includes the condition as well as file and line number&lt;br /&gt;
** &amp;lt;u&amp;gt;immediately returns&amp;lt;/u&amp;gt; from the current test function. The return specifies no value, therefore a function or method that uses &amp;lt;tt&amp;gt;srASSERT_xx&amp;lt;/tt&amp;gt; &amp;lt;u&amp;gt;should be declared to return &amp;lt;tt&amp;gt;void&amp;lt;/tt&amp;gt;&amp;lt;/u&amp;gt;. &amp;lt;i&amp;gt;In case when a test function is required to return other type then &amp;lt;tt&amp;gt;void&amp;lt;/tt&amp;gt;, a simple trick could be applied - in &amp;lt;b&amp;gt;C++ test code&amp;lt;/b&amp;gt; postpend any value of the required type using the &amp;lt;u&amp;gt;C/C++ &amp;lt;tt&amp;gt;comma&amp;lt;/tt&amp;gt; operator&amp;lt;/u&amp;gt; (e.g. &amp;lt;tt&amp;gt;srASSERT_TRUE(cond),1;&amp;lt;/tt&amp;gt;); in &amp;lt;b&amp;gt;C only test code&amp;lt;/b&amp;gt; postpend the value &amp;lt;u&amp;gt;space&amp;lt;/u&amp;gt; separated (e.g. &amp;lt;tt&amp;gt;srASSERT_TRUE(cond) 1;&amp;lt;/tt&amp;gt;).&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;srEXIT_&#039;&#039;xx&#039;&#039;(&#039;&#039;&#039;&#039;&#039;condition&#039;&#039;&#039;&#039;&#039;)&#039;&#039;&#039; &lt;br /&gt;
* The behavior and restrictions of the exit macros are identical to the &#039;&#039;&#039;ASSERT&#039;&#039;&#039; macros. &#039;&#039;&#039;EXIT&#039;&#039;&#039; macros differ only in that they cause the test unit to cease execution. That is, no subsequent test methods within the currently running test unit are executed once an EXIT macro has failed in its assertion. This macro is useful in test units that implement behavioral testing where each test methods depends on the successful completion of the preceding test method.&lt;br /&gt;
* If a teardown fixture is declared, and the srEXIT_xx() fires within a test method, the teardown method will be called.&lt;br /&gt;
* If srEXIT_xx() fires within a scl_test_cclass test unit, its de-init function will be called if declared.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note that the supplemental information is put into the test report only if the macro fails. For example &amp;lt;tt&amp;gt;srEXPECT_EQ(a, 10)&amp;lt;/tt&amp;gt;, if a equals 10, then no action is taken; if a is not equal to 10, then the normal srEXPECT actions are taken, and--in addition--the supplemental information is added to the failure record in the test report. The &#039;&#039;srEXIT_xx()&#039;&#039; macro does not support this feature. &lt;br /&gt;
&lt;br /&gt;
The following sections document the several types of testing macros that are provided by the STRIDE Framework. For simplicity, we refer to all the macros using a &#039;&#039;&#039;&#039;&#039;prefix&#039;&#039;&#039;&#039;&#039; tag - when using the macros in test code, the &#039;&#039;&#039;&#039;&#039;prefix&#039;&#039;&#039;&#039;&#039; should be replaced by one of the following: &#039;&#039;&#039;srEXPECT&#039;&#039;&#039;, &#039;&#039;&#039;srASSERT&#039;&#039;&#039;, or &#039;&#039;&#039;srEXIT&#039;&#039;&#039;, depending on how the test writer wants failures to be handled.&lt;br /&gt;
&lt;br /&gt;
== Boolean Macros ==&lt;br /&gt;
The boolean macros take a single condition expression, &#039;&#039;cond&#039;&#039;, that evaluates to an integral type or bool. &lt;br /&gt;
&lt;br /&gt;
The condition will be evaluated once. When a failure is detected, the report will be annotated. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;prettytable&amp;quot;&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; | &#039;&#039;&#039;Boolean&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
|- &lt;br /&gt;
! macro !! Pass if&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;&#039;&#039;prefix&#039;&#039;&#039;&#039;&#039;_TRUE(&#039;&#039;cond&#039;&#039;);&lt;br /&gt;
| &#039;&#039;cond&#039;&#039; is non-zero&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;&#039;&#039;prefix&#039;&#039;&#039;&#039;&#039;_FALSE(&#039;&#039;cond&#039;&#039;);&lt;br /&gt;
| &#039;&#039;cond&#039;&#039; is zero&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Example ====&lt;br /&gt;
&amp;lt;source lang=&#039;c&#039;&amp;gt;&lt;br /&gt;
int a = 5; &lt;br /&gt;
int b = 5; &lt;br /&gt;
srEXPECT_TRUE(a == b); &lt;br /&gt;
&lt;br /&gt;
srEXPECT_FALSE(2 &amp;lt; 1);&lt;br /&gt;
&lt;br /&gt;
srEXPECT_FALSE(a != b);&lt;br /&gt;
srEXPECT_TRUE(1 &amp;lt; 2); &lt;br /&gt;
srEXPECT_TRUE(1);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039; &#039;&#039;Hint:&#039;&#039; A simple way to add supplemental information to test failures&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the &#039;&#039;&#039;C++ compiler mode&#039;&#039;&#039; is enabled then the &#039;&#039;srEXPECT_xx()&#039;&#039; and &#039;&#039;srASSERT_xx()&#039;&#039; macros also support adding to a test&#039;s annotations using the &#039;&#039;&#039;&amp;lt;&amp;lt; operator&#039;&#039;&#039;. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
srEXPECT_TRUE(a == 10) &amp;lt;&amp;lt; &amp;quot;My custom message&amp;quot; &amp;lt;&amp;lt; &amp;quot; a equals: &amp;quot; &amp;lt;&amp;lt; a;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Comparison Macros ==&lt;br /&gt;
&lt;br /&gt;
Comparison macros take two operands and compare them using the indicated operator. &lt;br /&gt;
&lt;br /&gt;
The comparison macros will work for scalar types as well as C++ objects that have the corresponding comparison operator implemented.  &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;prettytable&amp;quot;&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; | &#039;&#039;&#039;Comparison&#039;&#039;&#039;&lt;br /&gt;
|- &lt;br /&gt;
! macro !! Pass if&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;&#039;&#039;prefix&#039;&#039;&#039;&#039;&#039;_EQ(&#039;&#039;val1&#039;&#039;, &#039;&#039;val2&#039;&#039;);&lt;br /&gt;
| &#039;&#039;val1&#039;&#039; == &#039;&#039;val2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;&#039;&#039;prefix&#039;&#039;&#039;&#039;&#039;_NE(&#039;&#039;val1&#039;&#039;, &#039;&#039;val2&#039;&#039;);&lt;br /&gt;
| &#039;&#039;val1&#039;&#039; != &#039;&#039;val2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;&#039;&#039;prefix&#039;&#039;&#039;&#039;&#039;_LT(&#039;&#039;val1&#039;&#039;, &#039;&#039;val2&#039;&#039;);&lt;br /&gt;
| &#039;&#039;val1&#039;&#039;&amp;lt;nowiki&amp;gt; &amp;lt; &amp;lt;/nowiki&amp;gt;&#039;&#039;val2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;&#039;&#039;prefix&#039;&#039;&#039;&#039;&#039;_LE(&#039;&#039;val1&#039;&#039;, &#039;&#039;val2&#039;&#039;);&lt;br /&gt;
| &#039;&#039;val1&#039;&#039;&amp;lt;nowiki&amp;gt; &amp;lt;= &amp;lt;/nowiki&amp;gt;&#039;&#039;val2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;&#039;&#039;prefix&#039;&#039;&#039;&#039;&#039;_GT(&#039;&#039;val1&#039;&#039;, &#039;&#039;val2&#039;&#039;);&lt;br /&gt;
| &#039;&#039;val1&#039;&#039; &amp;gt; &#039;&#039;val2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;&#039;&#039;prefix&#039;&#039;&#039;&#039;&#039;_GE(&#039;&#039;val1&#039;&#039;, &#039;&#039;val2&#039;&#039;);&lt;br /&gt;
| &#039;&#039;val1&#039;&#039; &amp;gt;= &#039;&#039;val2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Example ====&lt;br /&gt;
&amp;lt;source lang=&#039;c&#039;&amp;gt;&lt;br /&gt;
int a = 5; &lt;br /&gt;
int b = 5; &lt;br /&gt;
&lt;br /&gt;
srEXPECT_EQ( 4, 4 ); &lt;br /&gt;
srEXPECT_NE( 6, 7 );&lt;br /&gt;
srEXPECT_EQ( a, b ); &lt;br /&gt;
srEXPECT_GT( 2 , 1 );&lt;br /&gt;
srEXPECT_GE( 2 , 1 );&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== C String Comparison Macros ==&lt;br /&gt;
&lt;br /&gt;
C String Comparison Macros are intended only for use with C-style null terminated strings. The strings can be char or wchar_t based. &lt;br /&gt;
&lt;br /&gt;
Don&#039;t use these macros to compare C++ objects representing strings since such classes typically have overloaded comparison operators. The standard comparison macros should be used instead. &lt;br /&gt;
&lt;br /&gt;
* An empty string will appear in error message output as “”. A null string will appear as NULL with no surrounding quotes. Otherwise all output strings are quoted. &lt;br /&gt;
* The type of str1 and str2 must be compatible with &#039;&#039;const char*&#039;&#039; or &#039;&#039;const wchar_t*&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;prettytable&amp;quot;&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; | &#039;&#039;&#039;C-string comparison&#039;&#039;&#039;&lt;br /&gt;
|- &lt;br /&gt;
! macro !! Pass if&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;&#039;&#039;prefix&#039;&#039;&#039;&#039;&#039;_STREQ(&#039;&#039;str1&#039;&#039;, &#039;&#039;str2&#039;&#039;);&lt;br /&gt;
| &#039;&#039;str1&#039;&#039; and &#039;&#039;str2&#039;&#039; have the same content&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;&#039;&#039;prefix&#039;&#039;&#039;&#039;&#039;_STRNE(&#039;&#039;str1&#039;&#039;, &#039;&#039;str2&#039;&#039;);&lt;br /&gt;
| &#039;&#039;str1&#039;&#039; and &#039;&#039;str2&#039;&#039; have different content&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;&#039;&#039;prefix&#039;&#039;&#039;&#039;&#039;_STRCASEEQ(&#039;&#039;str1&#039;&#039;, &#039;&#039;str2&#039;&#039;);&lt;br /&gt;
| &#039;&#039;str1&#039;&#039; and &#039;&#039;str2&#039;&#039; have the same content, ignoring case.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;&#039;&#039;prefix&#039;&#039;&#039;&#039;&#039;_STRCASENE(&#039;&#039;str1&#039;&#039;, &#039;&#039;str2&#039;&#039;);&lt;br /&gt;
| &#039;&#039;str1&#039;&#039; and &#039;&#039;str2&#039;&#039; have different content, ignoring case.&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Example ====&lt;br /&gt;
&amp;lt;source lang=&#039;c&#039;&amp;gt;&lt;br /&gt;
const char* s1 = &amp;quot;This String is unique&amp;quot;; &lt;br /&gt;
const char* s2 = &amp;quot;This String has an equivalent&amp;quot;; &lt;br /&gt;
const char* s2Twin = &amp;quot;This String has an equivalent&amp;quot;; &lt;br /&gt;
const char* s2TwinNoCase = &amp;quot;this string has an equivalent&amp;quot;; &lt;br /&gt;
&lt;br /&gt;
srEXPECT_STREQ( s2, s2Twin); &lt;br /&gt;
srEXPECT_STREQ( s2, &amp;quot;This String has an equivalent&amp;quot;); &lt;br /&gt;
srEXPECT_STRCASEEQ(s2, s2TwinNoCase); &lt;br /&gt;
&lt;br /&gt;
srEXPECT_STRNE(s1, s2);  &lt;br /&gt;
srEXPECT_STRNE(s2, s2TwinNoCase); &lt;br /&gt;
srEXPECT_STRCASENE(s1, s2);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Predicate Macros ==&lt;br /&gt;
Predicate macros allow user control over the pass/fail decision making. &lt;br /&gt;
&lt;br /&gt;
A predicate is a function returning bool that is implemented by the user. Up to four arguments can also passed to the predicate through the macro.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;prettytable&amp;quot;&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; | &#039;&#039;&#039;Predicates&#039;&#039;&#039;&lt;br /&gt;
|- &lt;br /&gt;
! macro !! Pass if&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;&#039;&#039;prefix&#039;&#039;&#039;&#039;&#039;_PRED1(&#039;&#039;pred&#039;&#039;, &#039;&#039;val1&#039;&#039;)&lt;br /&gt;
| &#039;&#039;pred&#039;&#039;(&#039;&#039;val1&#039;&#039;) returns true&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;&#039;&#039;prefix&#039;&#039;&#039;&#039;&#039;_PRED2(&#039;&#039;pred&#039;&#039;, &#039;&#039;val1&#039;&#039;, &#039;&#039;val2&#039;&#039;)&lt;br /&gt;
| &#039;&#039;pred&#039;&#039;(&#039;&#039;val1&#039;&#039;, &#039;&#039;val2&#039;&#039;) returns true&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| …(up to arity of 4)&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Example ====&lt;br /&gt;
&amp;lt;source lang=&#039;c&#039;&amp;gt;&lt;br /&gt;
static int alwaysTrueOneArg(int i)&lt;br /&gt;
{&lt;br /&gt;
    return 1; &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
static int alwaysTrueTwoArgs(int i, int j)&lt;br /&gt;
{&lt;br /&gt;
    return 1;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
static void Pass()&lt;br /&gt;
{&lt;br /&gt;
    // examples of passing expectations using predicates.&lt;br /&gt;
&lt;br /&gt;
    srEXPECT_PRED1(alwaysTrueOneArg, 25); &lt;br /&gt;
    srEXPECT_PRED2(alwaysTrueTwoArgs, 100, 33); &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Floating Point Comparison Macros ==&lt;br /&gt;
Floating point macros are for comparing equivalence (or near equivalence) of floating point numbers. &lt;br /&gt;
&lt;br /&gt;
These macros are are very useful for dealing with floating point round-off effects. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;prettytable&amp;quot;&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; | &#039;&#039;&#039;Floating Point comparison&#039;&#039;&#039;&lt;br /&gt;
|- &lt;br /&gt;
! macro !! Pass if&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;&#039;&#039;prefix&#039;&#039;&#039;&#039;&#039;_NEAR(val1, val2, epsilon);&lt;br /&gt;
| The absolute value of the difference between val1 and val2 is less than or equal to epsilon.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Example ====&lt;br /&gt;
&amp;lt;source lang=&#039;c&#039;&amp;gt;&lt;br /&gt;
float x =           2.00005f;&lt;br /&gt;
float nearX =       2.00006f; &lt;br /&gt;
float nearXEpsilon = .000019f;&lt;br /&gt;
&lt;br /&gt;
double y =           1.2345; &lt;br /&gt;
double nearY =       1.23456; &lt;br /&gt;
double nearYEpsilon = .00019;&lt;br /&gt;
    &lt;br /&gt;
srEXPECT_NEAR(x, nearX, nearXEpsilon); &lt;br /&gt;
srEXPECT_NEAR(y, nearY, nearYEpsilon);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Exception Macros ==&lt;br /&gt;
Exception macros are used to ensure that expected exceptions are thrown. They are applicable to &amp;lt;u&amp;gt;C++ code only&amp;lt;/u&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
These macros require exception support from the target compiler. If the target compiler does not have exception support the macros cannot be used.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;prettytable&amp;quot;&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; | &#039;&#039;&#039;Exceptions&#039;&#039;&#039;&lt;br /&gt;
|- &lt;br /&gt;
! macro !! Pass if&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;&#039;&#039;prefix&#039;&#039;&#039;&#039;&#039;_THROW(statement, ex_type);&lt;br /&gt;
| &#039;&#039;statement&#039;&#039; throws an exception of type &#039;&#039;ex_type&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;&#039;&#039;prefix&#039;&#039;&#039;&#039;&#039;_THROW_ANY(&#039;&#039;statement&#039;&#039;);&lt;br /&gt;
| &#039;&#039;statement&#039;&#039; throws an exception (type not important)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;&#039;&#039;prefix&#039;&#039;&#039;&#039;&#039;_NO_THROW(&#039;&#039;statement&#039;&#039;);&lt;br /&gt;
| &#039;&#039;statement&#039;&#039; does not throw an exception&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===== Example =====&lt;br /&gt;
&amp;lt;source lang=&#039;cpp&#039;&amp;gt;&lt;br /&gt;
srEXPECT_THROW(throwStdException(), std::exception); &lt;br /&gt;
srEXPECT_THROW(throwInt(), int);&lt;br /&gt;
&lt;br /&gt;
srEXPECT_THROW_ANY(throwStdException()); &lt;br /&gt;
srEXPECT_THROW_ANY(throwInt()); &lt;br /&gt;
&lt;br /&gt;
srEXPECT_NO_THROW(doesntThrow()); &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Dynamic Test Case Macros ==&lt;br /&gt;
The macros presented so far assume that their actions are directed at the currenly in-scope test case. However, test cases can be created dynamically using STRIDE&#039;s [Runtime Test Services]. &lt;br /&gt;
&lt;br /&gt;
In order to handle dynamic test cases, each of the macros requires another parameter which specifies the test case to report against. Other than this, these macros provide exactly equivalent functionality to the non-dynamic peer. The dynamic macros are listed below. All require a test case, value of type &#039;&#039;&#039;srTestCaseHandle_t&#039;&#039;&#039; from srtest.h, to be passed as the first parameter).&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;prettytable&amp;quot;&lt;br /&gt;
! macro &lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;1&amp;quot; | &#039;&#039;&#039;Boolean&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;&#039;&#039;prefix&#039;&#039;&#039;&#039;&#039;_TRUE_DYN(tc, &#039;&#039;cond&#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;&#039;&#039;prefix&#039;&#039;&#039;&#039;&#039;_FALSE_DYN(tc, &#039;&#039;cond&#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;1&amp;quot; | &#039;&#039;&#039;Comparison&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;&#039;&#039;prefix&#039;&#039;&#039;&#039;&#039;_EQ_DYN(tc, &#039;&#039;val1&#039;&#039;, &#039;&#039;val2&#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;&#039;&#039;prefix&#039;&#039;&#039;&#039;&#039;_NE_DYN(tc, &#039;&#039;val1&#039;&#039;, &#039;&#039;val2&#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;&#039;&#039;prefix&#039;&#039;&#039;&#039;&#039;_LT_DYN(tc, &#039;&#039;val1&#039;&#039;, &#039;&#039;val2&#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;&#039;&#039;prefix&#039;&#039;&#039;&#039;&#039;_LE_DYN(tc, &#039;&#039;val1&#039;&#039;, &#039;&#039;val2&#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;&#039;&#039;prefix&#039;&#039;&#039;&#039;&#039;_GT_DYN(tc, &#039;&#039;val1&#039;&#039;, &#039;&#039;val2&#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;&#039;&#039;prefix&#039;&#039;&#039;&#039;&#039;_GE_DYN(tc, &#039;&#039;val1&#039;&#039;, &#039;&#039;val2&#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;1&amp;quot; | &#039;&#039;&#039;C-string comparison&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;&#039;&#039;prefix&#039;&#039;&#039;&#039;&#039;_STREQ_DYN(tc, &#039;&#039;str1&#039;&#039;, &#039;&#039;str2&#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;&#039;&#039;prefix&#039;&#039;&#039;&#039;&#039;_STRNE_DYN(tc, &#039;&#039;str1&#039;&#039;, &#039;&#039;str2&#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;&#039;&#039;prefix&#039;&#039;&#039;&#039;&#039;_STRCASEEQ_DYN(tc, &#039;&#039;str1&#039;&#039;, &#039;&#039;str2&#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;&#039;&#039;prefix&#039;&#039;&#039;&#039;&#039;_STRCASENE_DYN(tc, &#039;&#039;str1&#039;&#039;, &#039;&#039;str2&#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;1&amp;quot; | &#039;&#039;&#039;Exceptions&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;&#039;&#039;prefix&#039;&#039;&#039;&#039;&#039;_THROW_DYN(statement, ex_type);&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;&#039;&#039;prefix&#039;&#039;&#039;&#039;&#039;_THROW_ANY_DYN(tc, &#039;&#039;statement&#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;&#039;&#039;prefix&#039;&#039;&#039;&#039;&#039;_NO_THROW_DYN(tc, &#039;&#039;statement&#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;1&amp;quot; | &#039;&#039;&#039;Predicates&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;&#039;&#039;prefix&#039;&#039;&#039;&#039;&#039;_PRED1_DYN(tc, &#039;&#039;pred&#039;&#039;, &#039;&#039;val1&#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;&#039;&#039;prefix&#039;&#039;&#039;&#039;&#039;_PRED2_DYN(tc, &#039;&#039;pred&#039;&#039;, &#039;&#039;vall&#039;&#039;, &#039;&#039;val2&#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| …(up to arity of 4)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;1&amp;quot; | &#039;&#039;&#039;Floating Point&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;&#039;&#039;prefix&#039;&#039;&#039;&#039;&#039;_NEAR_DYN(tc, &#039;&#039;val1&#039;&#039;, &#039;&#039;val2&#039;&#039;, &#039;&#039;epsilon&#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Ryanh</name></author>
	</entry>
	<entry>
		<id>https://www.stridewiki.com/index.php?title=Test_Pragmas&amp;diff=14445</id>
		<title>Test Pragmas</title>
		<link rel="alternate" type="text/html" href="https://www.stridewiki.com/index.php?title=Test_Pragmas&amp;diff=14445"/>
		<updated>2015-07-07T16:15:19Z</updated>

		<summary type="html">&lt;p&gt;Ryanh: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
Test Unit [http://en.wikipedia.org/wiki/Directive_(programming) pragmas] are a set of compiler directives that allow annotations within C and C++ source files that are meaningful to the Stride Build Tools but &#039;&#039;&#039;ignored&#039;&#039;&#039; by standard C/C++ compilers. During the build process the [[Build Tools]] generates an [[Intercept Module]] that provides [http://en.wikipedia.org/wiki/Test_harness harnessing] for the tests. Refer to the following header file that contains the &#039;&#039;scl_test_class&#039;&#039; pragma.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Header file&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;source  lang=cpp&amp;gt;&lt;br /&gt;
#include &amp;lt;srtest.h&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
class MyTest : public stride::srTest {&lt;br /&gt;
public: &lt;br /&gt;
    void CheckFoo();&lt;br /&gt;
    void CheckBoo();&lt;br /&gt;
};&lt;br /&gt;
#pragma scl_test_class(MyTest)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= scl_test_class =&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;scl_test_class&#039;&#039; pragma is used to declare a C++ class as a &#039;&#039;&#039;Test Unit&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== Syntax ===&lt;br /&gt;
&lt;br /&gt;
 #pragma scl_test_class(class-name)&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;align:left;&amp;quot;  &lt;br /&gt;
| &#039;&#039;&#039;Parameters&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039;Type&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;class-name&#039;&#039;&lt;br /&gt;
| Identifier&lt;br /&gt;
| The name of the test unit. This must be the name of an existing C++ class or a struct.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Notes ===&lt;br /&gt;
* This pragma requires the compilation language to be C++. If the compilation language is not C++ and this pragma is encountered, then an error is issued and this pragma is ignored.&lt;br /&gt;
&lt;br /&gt;
* The test class identified:&lt;br /&gt;
** must have single public constructor - default or explicit.&lt;br /&gt;
** must not be a templated class&lt;br /&gt;
** must not be a nested class&lt;br /&gt;
** must not be a pure virtual class&lt;br /&gt;
** must have one or more member functions that is suitable as a test method. For a member function to be a test method it:&lt;br /&gt;
*** must be declared within the test class (a method that is inherited from a base class cannot be a test method)&lt;br /&gt;
*** must be declared with public access&lt;br /&gt;
*** must have a return type of bool, an integral type (signed or unsigned long, int, short, char) or void.&lt;br /&gt;
*** must have an empty parameter list - declared as f() or f(void).&lt;br /&gt;
*** must not be a templatized function&lt;br /&gt;
*** must not be an overloaded operator&lt;br /&gt;
*** must not be a static member.&lt;br /&gt;
&lt;br /&gt;
* Optionally if desired a set of setup/teardown fixtures could be applied.&lt;br /&gt;
&lt;br /&gt;
* Optionally if desired the public constructor may have arguments (they must all be of [http://en.wikipedia.org/wiki/Null-terminated_string C-string] and numeric types).&lt;br /&gt;
&lt;br /&gt;
=== Examples ===&lt;br /&gt;
&amp;lt;source lang=cpp&amp;gt;&lt;br /&gt;
#include &amp;lt;srtest.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
class MyOtherTest : public stride::srTest&lt;br /&gt;
{&lt;br /&gt;
public:&lt;br /&gt;
  // Declaring a constructor for an scl_test_class is optional, but&lt;br /&gt;
  // if a constructor is declared all arguments must be of plain old data (POD) type.&lt;br /&gt;
  MyOtherTest(int i, const char* s);&lt;br /&gt;
&lt;br /&gt;
  void CheckItOut();&lt;br /&gt;
};&lt;br /&gt;
#ifdef _SCL    &lt;br /&gt;
#pragma scl_test_class(MyOtherTest)&lt;br /&gt;
#endif&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= scl_test_cclass =&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;scl_test_cclass&#039;&#039; pragma is used to declare a &amp;quot;C&amp;quot; language struct (class) to be captured as a &#039;&#039;&#039;Test Unit&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
=== Syntax ===&lt;br /&gt;
&lt;br /&gt;
 #pragma scl_test_cclass(cclass-name, init-function-name { , deinit-function-name })&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;align:left;&amp;quot;  &lt;br /&gt;
| width=&amp;quot;180&amp;quot; | &#039;&#039;&#039;Parameters&#039;&#039;&#039;&lt;br /&gt;
| width=&amp;quot;60&amp;quot; | &#039;&#039;&#039;Type&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;cclass-name&#039;&#039;&lt;br /&gt;
| Identifier&lt;br /&gt;
| The name of the test unit. This is must be the name of an existing struct in C/C++ or a class in C++.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;init-function-name&#039;&#039;&lt;br /&gt;
| Identifier&lt;br /&gt;
| The initialization function name. This is synonymous with a class constructor. There must be a prior user-declared function with this name. The first parameter must be a pointer to cclass-name. Additional parameters are left up to the user&#039;s implementation.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;deinit-function-name (optional)&#039;&#039;&lt;br /&gt;
| Identifier&lt;br /&gt;
| The deinitialization function name. This is synonymous with a class destructor. If declared, there must be a user-declared function with this name. The first parameter must be a pointer to cclass-name. Additional parameters are left up to the user&#039;s implementation.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Notes ===&lt;br /&gt;
* The cclass-name identified:&lt;br /&gt;
** may not appear as a specifier of a prior pragma.&lt;br /&gt;
** must be a struct in C.&lt;br /&gt;
** must be either a struct or class in C++.&lt;br /&gt;
** must be [http://en.wikipedia.org/wiki/Plain_Old_Data_Structures POD] type.&lt;br /&gt;
** must not be a template class.&lt;br /&gt;
** must not be a nested class.&lt;br /&gt;
** must contain at least one member function pointer with a prototype that:&lt;br /&gt;
*** returns integral type: void, int, or bool (bool accepted only for C++). &lt;br /&gt;
*** has a first parameter that is a pointer to cclass-name.&lt;br /&gt;
&lt;br /&gt;
* The init-function-name identified:&lt;br /&gt;
** must be declared prior to this pragma&#039;s declaration.&lt;br /&gt;
** must not have been used in any prior or subsequent SCL pragma.&lt;br /&gt;
** must have its first parameter declared as a pointer to the identified cclass.&lt;br /&gt;
** optionally if desired it may have additional parameters (they must all be of [http://en.wikipedia.org/wiki/Null-terminated_string C-string] and numeric types). &lt;br /&gt;
&lt;br /&gt;
* The deinit-function-name:&lt;br /&gt;
** is optional.&lt;br /&gt;
** must be declared prior to this pragma&#039;s declaration if it appears in pragma.&lt;br /&gt;
** must not have been used in any prior or subsequent SCL pragma.&lt;br /&gt;
** must have its first parameter declared as a pointer to the identified class.&lt;br /&gt;
&lt;br /&gt;
* Optionally if desired a set of setup/teardown fixtures could be applied.&lt;br /&gt;
&lt;br /&gt;
=== Examples ===&lt;br /&gt;
&amp;lt;source lang=c&amp;gt;&lt;br /&gt;
#include &amp;lt;srtest.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
typedef struct CClass_Basic_Simple {&lt;br /&gt;
  int   (*pf_TestMethod)(struct CClass_Basic_Simple* pcc);&lt;br /&gt;
} CClass_Basic_Simple;&lt;br /&gt;
&lt;br /&gt;
#ifdef __cplusplus&lt;br /&gt;
extern &amp;quot;C&amp;quot; {&lt;br /&gt;
#endif&lt;br /&gt;
void CClass_Basic_Simple_init(struct CClass_Basic_Simple* pcc);&lt;br /&gt;
#ifdef __cplusplus&lt;br /&gt;
}&lt;br /&gt;
#endif&lt;br /&gt;
&lt;br /&gt;
#ifdef _SCL&lt;br /&gt;
#pragma scl_test_cclass(CClass_Basic_Simple, CClass_Basic_Simple_init)&lt;br /&gt;
#endif&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= scl_test_flist =&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;scl_test_flist&#039;&#039; pragma is used to declare a list of external functions as a &#039;&#039;&#039;Test Unit&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
=== Syntax ===&lt;br /&gt;
&lt;br /&gt;
 #pragma scl_test_flist(test-unit-name, function-1, function-2..n)&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;align:left;&amp;quot;  &lt;br /&gt;
| &#039;&#039;&#039;Parameters&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039;Type&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;test-unit-name&#039;&#039;&lt;br /&gt;
| String&lt;br /&gt;
| The name of the test unit. A special &#039;&#039;&#039;identifier&#039;&#039;&#039; with that name will be synthesized into which the list of external functions will be assembled. &lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Note:&#039;&#039;&#039; this string may not contain a space.&#039;&#039;&lt;br /&gt;
|- &lt;br /&gt;
| &#039;&#039;function-1&#039;&#039;&lt;br /&gt;
| Identifier&lt;br /&gt;
| Name of the first external function to be captured.&lt;br /&gt;
|- &lt;br /&gt;
| &#039;&#039;function-2..n [Optional]&#039;&#039;&lt;br /&gt;
| Identifier&lt;br /&gt;
| Optional names of second and subsequent external functions to be captured.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Notes ===&lt;br /&gt;
&lt;br /&gt;
* The external functions must meet the following conditions:&lt;br /&gt;
** Their parameter lists must be empty (void).&lt;br /&gt;
** They cannot be overloaded.&lt;br /&gt;
** They cannot be overloaded operators.&lt;br /&gt;
** They may not be template functions.&lt;br /&gt;
** They may throw exceptions when compiled in CPP mode.&lt;br /&gt;
** They cannot have been previously captured with the &#039;&#039;scl_function&#039;&#039; pragram or the &#039;&#039;scl_test_flist&#039;&#039; pragma. &lt;br /&gt;
** They cannot be &#039;&#039;public static class methods&#039;&#039;. &lt;br /&gt;
** They must return a pass/fail result. The return type may be declared void or an integer type (bool is acceptable in C++ mode). If void is the return type, any calls to the test function default to successful.&lt;br /&gt;
&lt;br /&gt;
* Once an external function has been captured with scl_test_flist, that function may not then be captured again with the &#039;&#039;scl_function&#039;&#039; pragma, or the &#039;&#039;scl_test_flist&#039;&#039; pragma, or used with any other qualification pragmas.&lt;br /&gt;
* Use of this pragma requires an include of &#039;&#039;srtest.h&#039;&#039;.&lt;br /&gt;
* The test-unit-name may not have been specified with a prior scl_test_flist pragma.&lt;br /&gt;
* The test-unit-name may not be the name of an existing routine.&lt;br /&gt;
* Optionally if desired a set of setup/teardown fixtures could be applied.&lt;br /&gt;
&lt;br /&gt;
=== Examples ===&lt;br /&gt;
&amp;lt;source lang=c&amp;gt;&lt;br /&gt;
#include &amp;lt;srtest.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#ifdef __cplusplus&lt;br /&gt;
extern &amp;quot;C&amp;quot; {&lt;br /&gt;
#endif&lt;br /&gt;
&lt;br /&gt;
int test1();&lt;br /&gt;
int test2();&lt;br /&gt;
&lt;br /&gt;
#ifdef __cplusplus&lt;br /&gt;
}&lt;br /&gt;
#endif&lt;br /&gt;
 &lt;br /&gt;
#ifdef _SCL&lt;br /&gt;
#pragma scl_test_flist(&amp;quot;Foo&amp;quot;, test1, test2)&lt;br /&gt;
#endif&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= scl_test_setup =&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;scl_test_setup&#039;&#039; pragma declares a member method to be a setup fixture for an existing &#039;&#039;&#039;Test Unit&#039;&#039;&#039;. The setup method will be called before the execution of each test method.&lt;br /&gt;
&lt;br /&gt;
=== Syntax ===&lt;br /&gt;
&lt;br /&gt;
 #pragma scl_test_setup(test-unit-name, function-name)&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;align:left;&amp;quot;  &lt;br /&gt;
| &#039;&#039;&#039;Parameters&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039;Type&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;test-unit-name&#039;&#039;&lt;br /&gt;
| Identifier&lt;br /&gt;
| Name of a captured test unit.&lt;br /&gt;
|- &lt;br /&gt;
| &#039;&#039;function-name&#039;&#039;&lt;br /&gt;
| Identifier&lt;br /&gt;
| Name of a member function of the test unit to be used as a setup fixture. &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Notes ===&lt;br /&gt;
* This pragma identifies the setup fixture of an existing test unit, i.e. either a class with &#039;&#039;scl_test_class&#039;&#039; applied to it, a set of functions with &#039;&#039;scl_test_flist&#039;&#039; applied to it, or a C struct with &#039;&#039;scl_test_cclass&#039;&#039; applied to it.&lt;br /&gt;
* There may be only one setup fixture per test unit.&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
&amp;lt;source lang=cpp&amp;gt;&lt;br /&gt;
#include &amp;lt;srtest.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
class MyTest {&lt;br /&gt;
public:&lt;br /&gt;
  void FooSetup();&lt;br /&gt;
  void CheckFoo();&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
#ifdef _SCL&lt;br /&gt;
#pragma scl_test_class(MyTest)&lt;br /&gt;
#pragma scl_test_setup(MyTest, FooSetup)&lt;br /&gt;
#endif&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= scl_test_teardown =&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;scl_test_teardown&#039;&#039; pragma declares a member method to be a teardown fixture for an existing &#039;&#039;&#039;Test Unit&#039;&#039;&#039;. The teardown method will be called after the execution of each test method.&lt;br /&gt;
&lt;br /&gt;
=== Syntax ===&lt;br /&gt;
&lt;br /&gt;
 #pragma scl_test_teardown(test-unit-name, function-name)&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;align:left;&amp;quot;  &lt;br /&gt;
| &#039;&#039;&#039;Parameters&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039;Type&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;test-unit-name&#039;&#039;&lt;br /&gt;
| Identifier&lt;br /&gt;
| Name of a captured test unit.&lt;br /&gt;
|- &lt;br /&gt;
| &#039;&#039;function-name&#039;&#039;&lt;br /&gt;
| Identifier&lt;br /&gt;
| Name of a member function of the test unit to be used as a teardown fixture. &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Notes ===&lt;br /&gt;
* This pragma identifies the setup fixture of an existing test unit, i.e. either a class with &#039;&#039;scl_test_class&#039;&#039; applied to it, a set of functions with &#039;&#039;scl_test_flist&#039;&#039; applied to it, or a C struct with &#039;&#039;scl_test_cclass&#039;&#039; applied to it.&lt;br /&gt;
* There may be only one teardown fixture per test unit.&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
&amp;lt;source lang=cpp&amp;gt;&lt;br /&gt;
class MyTest {&lt;br /&gt;
public:&lt;br /&gt;
  void FooSetup();&lt;br /&gt;
  void FooTeardown();&lt;br /&gt;
  void CheckFoo();&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
#ifdef _SCL&lt;br /&gt;
#pragma scl_test_class(MyTest)&lt;br /&gt;
#pragma scl_test_setup(MyTest, FooSetup)&lt;br /&gt;
#pragma scl_test_teardown(MyTest, FooTeardown)&lt;br /&gt;
#endif&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ryanh</name></author>
	</entry>
	<entry>
		<id>https://www.stridewiki.com/index.php?title=Test_Unit&amp;diff=14443</id>
		<title>Test Unit</title>
		<link rel="alternate" type="text/html" href="https://www.stridewiki.com/index.php?title=Test_Unit&amp;diff=14443"/>
		<updated>2015-07-07T16:00:46Z</updated>

		<summary type="html">&lt;p&gt;Ryanh: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
&#039;&#039;&#039;Stride&#039;&#039;&#039; groups similar test cases into a single &#039;&#039;runnable&#039;&#039; package called a &#039;&#039;&#039;Test Unit&#039;&#039;&#039; (also known as a &#039;&#039;&#039;Test Suite&#039;&#039;&#039;). These tests are written in C and C++ which are compiled and linked with your software and run, when called, on your target platform. They are suitable for both developer unit testing as well as end-to-end integration testing. An external [[Stride Runner]] is provided which controls the execution of &#039;&#039;&#039;Test Units&#039;&#039;&#039; and publishes test results to the local file system and optionally to [http://www.testspace.com Testspace]. The following is an example of the structure of a &#039;&#039;&#039;Test Unit&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Declare tests&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;source  lang=cpp&amp;gt;&lt;br /&gt;
#include &amp;lt;srtest.h&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
class MyTest : public stride::srTest {&lt;br /&gt;
public: &lt;br /&gt;
    void CheckFoo();&lt;br /&gt;
    void CheckBoo();&lt;br /&gt;
};&lt;br /&gt;
#pragma scl_test_class(MyTest)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Write tests&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;source  lang=cpp&amp;gt;&lt;br /&gt;
#include &amp;lt;mytest.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
void MyTest::CheckFoo() {&lt;br /&gt;
    ..  &lt;br /&gt;
    srEXPECT_EQ(foo(2 + 2), 4); &lt;br /&gt;
}&lt;br /&gt;
void MyTest::CheckBoo() {&lt;br /&gt;
    ..&lt;br /&gt;
    srEXPECT_GT(boo(3 * 3), 7); &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Test Unit ==&lt;br /&gt;
A single &#039;&#039;&#039;Test Unit&#039;&#039;&#039; is a set of &#039;&#039;&#039;Test Methods&#039;&#039;&#039; that always run together as an &#039;&#039;&#039;executable unit&#039;&#039;&#039;. Test Methods are the &#039;&#039;&#039;test cases&#039;&#039;&#039;  that comprise a Test Unit. Each Test Method  by default maps to a single Test Case in the results. When relying on  this default behavior of Test Methods, we refer to these methods as &#039;&#039;static Test Cases&#039;&#039;. A less common technique is  to create and add a Test Case dynamically at runtime to an existing  Suite via the [[Runtime_Test_Services#method_AddCase|Test Services]].  We refer to these as &#039;&#039;dynamic  Test Cases&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Individual test cases are  implemented as test methods or functions which follow a four-phase testing pattern:&lt;br /&gt;
&lt;br /&gt;
# Setting up a  test fixture (optional)&lt;br /&gt;
# Exercising the Software Under Test (SUT)&lt;br /&gt;
# Verifying  that the expected outcome has occurred &lt;br /&gt;
# Tearing down  the test fixture (optional)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Test fixturing&#039;&#039;&#039; refers to the &#039;&#039;Setup&#039;&#039; and &#039;&#039;Teardown&#039;&#039;   phases of the testing.&lt;br /&gt;
&lt;br /&gt;
In the &#039;&#039;&#039;Setup&#039;&#039;&#039;   phase, we put all of the things into place that are required in order to run a test and expect a particular outcome. This includes things   like:&lt;br /&gt;
* Acquiring resources such as memory,   hardware, etc.&lt;br /&gt;
* Setting up required states such as input   files in place, memory filled with a pattern, dependencies initialized,   etc.&lt;br /&gt;
&lt;br /&gt;
In the &#039;&#039;&#039;Tear down&#039;&#039;&#039;   phase, we clean up the fixturing we did in the Setup phase, leaving  the  system in a state that is ready to be used by the next test.&lt;br /&gt;
&lt;br /&gt;
== Packaging ==&lt;br /&gt;
&lt;br /&gt;
Individual functions or methods,  which typically implement a single test case are grouped into one or  more Test Units which are executed as atomic entities.&lt;br /&gt;
&lt;br /&gt;
Grouping  of individual tests into a Test Unit can be accomplished in any of three  ways:&lt;br /&gt;
&lt;br /&gt;
* A Test Unit can be comprised of the public member functions of a &#039;&#039;&#039;C++  class&#039;&#039;&#039;, &lt;br /&gt;
* A Test Unit  can be comprised of a set of &#039;&#039;&#039;C functions&#039;&#039;&#039;,  &lt;br /&gt;
* A Test Unit can be comprised of C functions pointed to by members of a &#039;&#039;&#039;C struct&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The following  table compares the three packaging variants. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &amp;lt;big&amp;gt;&#039;&#039;&#039;&#039;&#039;Comparison of Test Unit Packaging&#039;&#039;&#039;&#039;&#039;&amp;lt;/big&amp;gt;&lt;br /&gt;
! Test Unit  Type!! Advantages !! Disadvantages !! scl pragma &lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
&#039;&#039;&#039;C++ class&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Test_Unit#C++ Class|Example code]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|&lt;br /&gt;
* Simple and easy to use&lt;br /&gt;
* Can be used with target code that is all C, all C++, or a mix&lt;br /&gt;
* Test utility methods can be encapsulated as test class members or members of a parent class&lt;br /&gt;
* Could be [[Parameterized_Test_Units | parametrized]] via constructor arguments&lt;br /&gt;
* Provides convenient syntax for augmenting report annotation (operator &amp;lt;tt&amp;gt;&amp;lt;&amp;lt;&amp;lt;/tt&amp;gt;)&lt;br /&gt;
| &lt;br /&gt;
* Requires a C++ build environment &lt;br /&gt;
| &amp;lt;tt&amp;gt;scl_test_class&amp;lt;/tt&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
&#039;&#039;&#039;C class&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Test_Unit#C  Class|Example code]]&lt;br /&gt;
&lt;br /&gt;
|&lt;br /&gt;
* Provides encapsulation of test methods&lt;br /&gt;
* Provides encapsulation of state via member variables &lt;br /&gt;
* Could be [[Parameterized_Test_Units |parametrized]] via init-function arguments&lt;br /&gt;
|&lt;br /&gt;
* Requires initialization code for structure  function pointer setup&lt;br /&gt;
* [[Test_Documentation_in_C/C%2B%2B|Test Unit documentation]] must be associated with the  structure function pointer members instead of the actual test method implementations.&lt;br /&gt;
| &amp;lt;tt&amp;gt;scl_test_cclass&amp;lt;/tt&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
&#039;&#039;&#039;C functions&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Test_Unit#Free Functions|Example code]]&lt;br /&gt;
&lt;br /&gt;
|&lt;br /&gt;
* Extremely  simple syntax &lt;br /&gt;
|&lt;br /&gt;
* Parametrized test units are not supported&lt;br /&gt;
* No test unit support for constructor/initializer or destructor/de-initializer&lt;br /&gt;
* Changing test unit membership requires editing of the pragma statement &lt;br /&gt;
* [[Test_Documentation_in_C/C%2B%2B|Test Unit documentation]] for the FList must be associated  with the header file - as such, you can only have one FList per header file if you want to document your test units.&lt;br /&gt;
| &amp;lt;tt&amp;gt;scl_test_flist&amp;lt;/tt&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The best choice is usually the C++ class since it offers the best mix of features and ease-of-use. (You can test code written in C or C++ using the C++ class  test units.) However, compiling C++ is not always possible, in this case one of the C-based test unit packaging options must be used.&lt;br /&gt;
&lt;br /&gt;
You can freely mix different deployment methods across a project if desired, the format of the results is consistent across all test unit packaging options.&lt;br /&gt;
&lt;br /&gt;
== Test Method Return Values == &lt;br /&gt;
&lt;br /&gt;
Test Method return values must conform to certain return types as summarized in the following table. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;background-color:#ffffcc;font-family:arial;font-size:9pt;&amp;quot;  &lt;br /&gt;
| &#039;&#039;&#039;Return Type&#039;&#039;&#039; &lt;br /&gt;
| &#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039;How Return Value is Interpreted&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039;Default Status&#039;&#039;&#039;&lt;br /&gt;
|- &lt;br /&gt;
| &amp;lt;tt&amp;gt;void&amp;lt;/tt&amp;gt;&lt;br /&gt;
| Most common return type&lt;br /&gt;
| Since there is no return, PASS/FAIL status is set in the body of the method using a &lt;br /&gt;
* [[Test_Macros|Test Macro]] &lt;br /&gt;
or a runtime call&lt;br /&gt;
* [[Runtime_Test_Services#srTestCaseSetStatus|srTestCaseSetStatus()]]&lt;br /&gt;
* [[Runtime_Test_Services#srTestCaseSetStatusEx|srTestCaseSetStatusEx()]]&lt;br /&gt;
* [[Runtime_Test_Services#method_SetStatus|srTestCase::SetStatus()]]&lt;br /&gt;
| &lt;br /&gt;
* If the method runs to completion without another status being set, the status is srTEST_PASS&lt;br /&gt;
* If the method does not run to completion (due to crash or hang in software under test), the status is srTEST_INPROGRESS&lt;br /&gt;
|-&lt;br /&gt;
| integer type&lt;br /&gt;
| Integer types include:&lt;br /&gt;
* &amp;lt;tt&amp;gt;int&amp;lt;/tt&amp;gt;&lt;br /&gt;
* &amp;lt;tt&amp;gt;short&amp;lt;/tt&amp;gt;&lt;br /&gt;
* &amp;lt;tt&amp;gt;char&amp;lt;/tt&amp;gt;&lt;br /&gt;
* &amp;lt;tt&amp;gt;long&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;small&amp;gt;&#039;&#039;may include signed/unsigned/const qualifiers&#039;&#039;&amp;lt;/small&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* If you explicitly set the status in the method (using a test macro or a runtime call), this status will override the status that would otherwise be set by the return value&lt;br /&gt;
* If you don&#039;t explicitly set the status in the method, the return value determines the status as follows:&lt;br /&gt;
** Return is &#039;&#039;&#039;zero&#039;&#039;&#039; -&amp;gt; srTEST_PASS&lt;br /&gt;
** Return is &#039;&#039;&#039;non-zero&#039;&#039;&#039; -&amp;gt; srTEST_FAIL&lt;br /&gt;
|&lt;br /&gt;
* If the method runs to completion, the status is determined by the rules to the left (there is no default)  &lt;br /&gt;
* If the method does not run to completion (due to crash or hang in software under test), the status is srTEST_INPROGRESS&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;bool&amp;lt;/tt&amp;gt; &lt;br /&gt;
| c++ only&lt;br /&gt;
|&lt;br /&gt;
* If you explicitly set the status in the method (using a test macro or a runtime call), this status will override the status that would otherwise be set by the return value&lt;br /&gt;
* If you don&#039;t explicitly set the status in the method, the return value determines the status as follows:&lt;br /&gt;
** Return is &#039;&#039;&#039;true&#039;&#039;&#039; -&amp;gt; srTEST_PASS&lt;br /&gt;
** Return is &#039;&#039;&#039;false&#039;&#039;&#039; -&amp;gt; srTEST_FAIL&lt;br /&gt;
|&lt;br /&gt;
* If the method runs to completion, the status is determined by the rules to the left (there is no default)  &lt;br /&gt;
* If the method does not run to completion (due to crash or hang in software under test), the status is srTEST_INPROGRESS&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
&lt;br /&gt;
Following are a few short  examples. In each example, a single test unit with the name &amp;quot;MyTest&amp;quot; is  identified to the Stride compiler via [[Test Pragmas]].&lt;br /&gt;
&lt;br /&gt;
=== C++ Class  ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;MyTest.h&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;source  lang=cpp&amp;gt;&lt;br /&gt;
#include &amp;lt;srtest.h&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
class MyTest : public stride::srTest &lt;br /&gt;
{&lt;br /&gt;
public:&lt;br /&gt;
  void ExpectPass() &lt;br /&gt;
  {&lt;br /&gt;
    srNOTE_INFO(&amp;quot;this test should pass&amp;quot;);&lt;br /&gt;
    srEXPECT_EQ(2 + 2, 4); &lt;br /&gt;
  }&lt;br /&gt;
  void ExpectFail() &lt;br /&gt;
  {&lt;br /&gt;
    srNOTE_INFO(&amp;quot;this test should fail&amp;quot;);&lt;br /&gt;
    srEXPECT_GT(2 * 3, 7); &lt;br /&gt;
  }&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
#ifdef _SCL&lt;br /&gt;
// this pragma  identifies MyTest as a test class to the STRIDE compiler&lt;br /&gt;
#pragma scl_test_class(MyTest)&lt;br /&gt;
#endif&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== C  Class ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;MyTest.h&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source  lang=c&amp;gt;&lt;br /&gt;
#include &amp;lt;srtest.h&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
typedef struct MyTest&lt;br /&gt;
{&lt;br /&gt;
    void (*ExpectPass)(struct MyTest* self);&lt;br /&gt;
    void (*ExpectFail)(struct MyTest* self);&lt;br /&gt;
} MyTest;&lt;br /&gt;
&lt;br /&gt;
void MyTest_Init(MyTest* self);&lt;br /&gt;
&lt;br /&gt;
#ifdef _SCL&lt;br /&gt;
//  This pragma identifies MyTest as a test c class to the STRIDE compiler.&lt;br /&gt;
//  Extra instrumentation code will be generated to call MyTest_Init()  before&lt;br /&gt;
// tests are run.&lt;br /&gt;
#pragma scl_test_cclass(MyTest, MyTest_Init)&lt;br /&gt;
#endif&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;MyTest.c&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source  lang=&#039;c&#039;&amp;gt;&lt;br /&gt;
#include  &amp;quot;MyTest.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
static void ExpectPass(MyTest* self)&lt;br /&gt;
{&lt;br /&gt;
    srNOTE_INFO(&amp;quot;this test should pass&amp;quot;);&lt;br /&gt;
    srEXPECT_EQ(2 + 2, 4); &lt;br /&gt;
}&lt;br /&gt;
static void ExpectFail(MyTest* self)&lt;br /&gt;
{&lt;br /&gt;
    srNOTE_INFO(&amp;quot;this test should fail&amp;quot;);&lt;br /&gt;
    srEXPECT_GT(2 * 3, 7); &lt;br /&gt;
}&lt;br /&gt;
void MyTest_Init(MyTest* self)&lt;br /&gt;
{&lt;br /&gt;
    self-&amp;gt;ExpectPass = ExpectPass;&lt;br /&gt;
    self-&amp;gt;ExpectFail = ExpectFail;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Free Functions ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;MyTest.h&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=c&amp;gt;&lt;br /&gt;
#include &amp;lt;srtest.h&amp;gt;&lt;br /&gt;
void ExpectPass();&lt;br /&gt;
void ExpectFail();&lt;br /&gt;
&lt;br /&gt;
#ifdef _SCL&lt;br /&gt;
//  this pragma identifies MyTest as a test unit to the STRIDE compiler,  specifying&lt;br /&gt;
// the four functions as members of the test unit&lt;br /&gt;
#pragma scl_test_flist(&amp;quot;MyTest&amp;quot;, ExpectPass, ExpectFail, ChangeMyName, ChangeMyDescription)&lt;br /&gt;
#endif&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;MyTest.c&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&#039;c&#039;&amp;gt;&lt;br /&gt;
#include &amp;quot;MyTest.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
void ExpectPass()&lt;br /&gt;
{&lt;br /&gt;
    srNOTE_INFO(&amp;quot;this test should pass&amp;quot;);&lt;br /&gt;
    srEXPECT_EQ(2 + 2, 4); &lt;br /&gt;
}&lt;br /&gt;
void ExpectFail()&lt;br /&gt;
{&lt;br /&gt;
    srNOTE_INFO(&amp;quot;this test should fail&amp;quot;);&lt;br /&gt;
    srEXPECT_GT(2 * 3, 7); &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== C++ Only Features ==&lt;br /&gt;
&lt;br /&gt;
=== Use Operator &amp;lt;&amp;lt; to Augment Test Macros ===&lt;br /&gt;
&lt;br /&gt;
In C++ test code [[Test Point]], [[Test Log]] and [[Test Macros]] macros support adding to the annotation using the &amp;lt;&amp;lt; operator. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
srEXPECT_TRUE(a != b) &amp;lt;&amp;lt; &amp;quot;My custom message&amp;quot; &amp;lt;&amp;lt; &amp;quot; with more data &amp;quot; &amp;lt;&amp;lt; 1234;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As delivered, the macros will support stream input annotations for:&lt;br /&gt;
* all numeric types, &lt;br /&gt;
* C string (char* or wchar_t*), and &lt;br /&gt;
* types allowing implicit cast to numeric type or &amp;quot;C&amp;quot; string.&lt;br /&gt;
&lt;br /&gt;
=== Overloading the &amp;lt;&amp;lt; operator ===&lt;br /&gt;
&lt;br /&gt;
You can also overload the &amp;lt;&amp;lt; operator in order to annotate reports using your own custom type. An example is below.&lt;br /&gt;
&lt;br /&gt;
The following will compile and execute successfully given that the &amp;lt;&amp;lt; operator is overloaded as shown:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;srtest.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// MyCustomClass implementation&lt;br /&gt;
class MyCustomClass&lt;br /&gt;
{&lt;br /&gt;
public:&lt;br /&gt;
   MyCustomClass(int i) : m_int(i) {}&lt;br /&gt;
&lt;br /&gt;
private: &lt;br /&gt;
   int m_int; &lt;br /&gt;
   friend stride::Message&amp;amp; operator&amp;lt;&amp;lt;(stride::Message&amp;amp; ss, const MyCustomClass&amp;amp; obj);&lt;br /&gt;
}; &lt;br /&gt;
&lt;br /&gt;
stride::Message&amp;amp; operator&amp;lt;&amp;lt;(stride::Message&amp;amp; ss, const MyCustomClass&amp;amp; obj)&lt;br /&gt;
{&lt;br /&gt;
   ss &amp;lt;&amp;lt; obj.m_int;&lt;br /&gt;
   return ss;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void test()&lt;br /&gt;
{&lt;br /&gt;
    MyCustomClass custom(34); &lt;br /&gt;
&lt;br /&gt;
    srEXPECT_FALSE(true) &amp;lt;&amp;lt; custom;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ryanh</name></author>
	</entry>
	<entry>
		<id>https://www.stridewiki.com/index.php?title=Test_Unit&amp;diff=14442</id>
		<title>Test Unit</title>
		<link rel="alternate" type="text/html" href="https://www.stridewiki.com/index.php?title=Test_Unit&amp;diff=14442"/>
		<updated>2015-07-07T15:38:26Z</updated>

		<summary type="html">&lt;p&gt;Ryanh: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
&#039;&#039;&#039;Stride&#039;&#039;&#039; groups similar test cases into a single &#039;&#039;runnable&#039;&#039; package called a &#039;&#039;&#039;Test Unit&#039;&#039;&#039; (also known as a &#039;&#039;&#039;Test Suite&#039;&#039;&#039;). These tests are written in C and C++ which are compiled and linked with your software and run, when called, on your target platform. They are suitable for both developer unit testing as well as end-to-end integration testing. An external [[Stride Runner]] is provided which controls the execution of &#039;&#039;&#039;Test Units&#039;&#039;&#039; and publishes test results to the local file system and optionally to [http://www.testspace.com Testspace]. The following is an example of the structure of a &#039;&#039;&#039;Test Unit&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Declare tests&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;source  lang=cpp&amp;gt;&lt;br /&gt;
#include &amp;lt;srtest.h&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
class MyTest : public stride::srTest {&lt;br /&gt;
public: &lt;br /&gt;
    void CheckFoo();&lt;br /&gt;
    void CheckBoo();&lt;br /&gt;
};&lt;br /&gt;
#pragma scl_test_class(MyTest)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Write tests&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;source  lang=cpp&amp;gt;&lt;br /&gt;
#include &amp;lt;mytest.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
void MyTest::CheckFoo() {&lt;br /&gt;
    ..  &lt;br /&gt;
    srEXPECT_EQ(foo(2 + 2), 4); &lt;br /&gt;
}&lt;br /&gt;
void MyTest::CheckBoo() {&lt;br /&gt;
    ..&lt;br /&gt;
    srEXPECT_GT(boo(3 * 3), 7); &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Test Unit ==&lt;br /&gt;
A single &#039;&#039;&#039;Test Unit&#039;&#039;&#039; is a set of &#039;&#039;&#039;Test Methods&#039;&#039;&#039; that always run together as an &#039;&#039;&#039;executable unit&#039;&#039;&#039;. Test Methods are the &#039;&#039;&#039;test cases&#039;&#039;&#039;  that comprise a Test Unit. Each Test Method  by default maps to a single Test Case in the results. When relying on  this default behavior of Test Methods, we refer to these methods as &#039;&#039;static Test Cases&#039;&#039;. A less common technique is  to create and add a Test Case dynamically at runtime to an existing  Suite via the [[Runtime_Test_Services#method_AddCase|Test Services]].  We refer to these as &#039;&#039;dynamic  Test Cases&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Individual test cases are  implemented as test methods or functions which follow a four-phase testing pattern:&lt;br /&gt;
&lt;br /&gt;
# Setting up a  test fixture (optional)&lt;br /&gt;
# Exercising the Software Under Test (SUT)&lt;br /&gt;
# Verifying  that the expected outcome has occurred &lt;br /&gt;
# Tearing down  the test fixture (optional)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Test fixturing&#039;&#039;&#039; refers to the &#039;&#039;Setup&#039;&#039; and &#039;&#039;Teardown&#039;&#039;   phases of the testing.&lt;br /&gt;
&lt;br /&gt;
In the &#039;&#039;&#039;Setup&#039;&#039;&#039;   phase, we put all of the things into place that are required in order to run a test and expect a particular outcome. This includes things   like:&lt;br /&gt;
* Acquiring resources such as memory,   hardware, etc.&lt;br /&gt;
* Setting up required states such as input   files in place, memory filled with a pattern, dependencies initialized,   etc.&lt;br /&gt;
&lt;br /&gt;
In the &#039;&#039;&#039;Tear down&#039;&#039;&#039;   phase, we clean up the fixturing we did in the Setup phase, leaving  the  system in a state that is ready to be used by the next test.&lt;br /&gt;
&lt;br /&gt;
== Packaging ==&lt;br /&gt;
&lt;br /&gt;
Individual functions or methods,  which typically implement a single test case are grouped into one or  more Test Units which are executed as atomic entities.&lt;br /&gt;
&lt;br /&gt;
Grouping  of individual tests into a Test Unit can be accomplished in any of three  ways:&lt;br /&gt;
&lt;br /&gt;
* A Test Unit can be comprised of the public member functions of a &#039;&#039;&#039;C++  class&#039;&#039;&#039;, &lt;br /&gt;
* A Test Unit  can be comprised of a set of &#039;&#039;&#039;C functions&#039;&#039;&#039;,  &lt;br /&gt;
* A Test Unit can be comprised of C functions pointed to by members of a &#039;&#039;&#039;C struct&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The following  table compares the three packaging variants. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &amp;lt;big&amp;gt;&#039;&#039;&#039;&#039;&#039;Comparison of Test Unit Packaging&#039;&#039;&#039;&#039;&#039;&amp;lt;/big&amp;gt;&lt;br /&gt;
! Test Unit  Type!! Advantages !! Disadvantages !! scl pragma &lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
&#039;&#039;&#039;C++ class&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Test_Unit#Test_Unit_as_C.2B.2B_Class|Example code]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|&lt;br /&gt;
* Simple and easy to use&lt;br /&gt;
* Can be used with target code that is all C, all C++, or a mix&lt;br /&gt;
* Test utility methods can be encapsulated as test class members or members of a parent class&lt;br /&gt;
* Could be [[Parameterized_Test_Units | parametrized]] via constructor arguments&lt;br /&gt;
* Provides convenient syntax for augmenting report annotation (operator &amp;lt;tt&amp;gt;&amp;lt;&amp;lt;&amp;lt;/tt&amp;gt;)&lt;br /&gt;
| &lt;br /&gt;
* Requires a C++ build environment &lt;br /&gt;
| &amp;lt;tt&amp;gt;scl_test_class&amp;lt;/tt&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
&#039;&#039;&#039;C class&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Test_Unit#Test_Unit_as_C_Class|Example code]]&lt;br /&gt;
&lt;br /&gt;
|&lt;br /&gt;
* Provides encapsulation of test methods&lt;br /&gt;
* Provides encapsulation of state via member variables &lt;br /&gt;
* Could be [[Parameterized_Test_Units |parametrized]] via init-function arguments&lt;br /&gt;
|&lt;br /&gt;
* Requires initialization code for structure  function pointer setup&lt;br /&gt;
* [[Test_Documentation_in_C/C%2B%2B|Test Unit documentation]] must be associated with the  structure function pointer members instead of the actual test method implementations.&lt;br /&gt;
| &amp;lt;tt&amp;gt;scl_test_cclass&amp;lt;/tt&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
&#039;&#039;&#039;C functions&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Test_Unit#Test_Unit_as_Group_of_Free_Functions|Example code]]&lt;br /&gt;
&lt;br /&gt;
|&lt;br /&gt;
* Extremely  simple syntax &lt;br /&gt;
|&lt;br /&gt;
* Parametrized test units are not supported&lt;br /&gt;
* No test unit support for constructor/initializer or destructor/de-initializer&lt;br /&gt;
* Changing test unit membership requires editing of the pragma statement &lt;br /&gt;
* [[Test_Documentation_in_C/C%2B%2B|Test Unit documentation]] for the FList must be associated  with the header file - as such, you can only have one FList per header file if you want to document your test units.&lt;br /&gt;
| &amp;lt;tt&amp;gt;scl_test_flist&amp;lt;/tt&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The best choice is usually the C++ class since it offers the best mix of features and ease-of-use. (You can test code written in C or C++ using the C++ class  test units.) However, compiling C++ is not always possible, in this case one of the C-based test unit packaging options must be used.&lt;br /&gt;
&lt;br /&gt;
You can freely mix different deployment methods across a project if desired, the format of the results is consistent across all test unit packaging options.&lt;br /&gt;
&lt;br /&gt;
== Test Method Return Values == &lt;br /&gt;
&lt;br /&gt;
Test Method return values must conform to certain return types as summarized in the following table. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;background-color:#ffffcc;font-family:arial;font-size:9pt;&amp;quot;  &lt;br /&gt;
| &#039;&#039;&#039;Return Type&#039;&#039;&#039; &lt;br /&gt;
| &#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039;How Return Value is Interpreted&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039;Default Status&#039;&#039;&#039;&lt;br /&gt;
|- &lt;br /&gt;
| &amp;lt;tt&amp;gt;void&amp;lt;/tt&amp;gt;&lt;br /&gt;
| Most common return type&lt;br /&gt;
| Since there is no return, PASS/FAIL status is set in the body of the method using a &lt;br /&gt;
* [[Test_Macros|Test Macro]] &lt;br /&gt;
or a runtime call&lt;br /&gt;
* [[Runtime_Test_Services#srTestCaseSetStatus|srTestCaseSetStatus()]]&lt;br /&gt;
* [[Runtime_Test_Services#srTestCaseSetStatusEx|srTestCaseSetStatusEx()]]&lt;br /&gt;
* [[Runtime_Test_Services#method_SetStatus|srTestCase::SetStatus()]]&lt;br /&gt;
| &lt;br /&gt;
* If the method runs to completion without another status being set, the status is srTEST_PASS&lt;br /&gt;
* If the method does not run to completion (due to crash or hang in software under test), the status is srTEST_INPROGRESS&lt;br /&gt;
|-&lt;br /&gt;
| integer type&lt;br /&gt;
| Integer types include:&lt;br /&gt;
* &amp;lt;tt&amp;gt;int&amp;lt;/tt&amp;gt;&lt;br /&gt;
* &amp;lt;tt&amp;gt;short&amp;lt;/tt&amp;gt;&lt;br /&gt;
* &amp;lt;tt&amp;gt;char&amp;lt;/tt&amp;gt;&lt;br /&gt;
* &amp;lt;tt&amp;gt;long&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;small&amp;gt;&#039;&#039;may include signed/unsigned/const qualifiers&#039;&#039;&amp;lt;/small&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* If you explicitly set the status in the method (using a test macro or a runtime call), this status will override the status that would otherwise be set by the return value&lt;br /&gt;
* If you don&#039;t explicitly set the status in the method, the return value determines the status as follows:&lt;br /&gt;
** Return is &#039;&#039;&#039;zero&#039;&#039;&#039; -&amp;gt; srTEST_PASS&lt;br /&gt;
** Return is &#039;&#039;&#039;non-zero&#039;&#039;&#039; -&amp;gt; srTEST_FAIL&lt;br /&gt;
|&lt;br /&gt;
* If the method runs to completion, the status is determined by the rules to the left (there is no default)  &lt;br /&gt;
* If the method does not run to completion (due to crash or hang in software under test), the status is srTEST_INPROGRESS&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;bool&amp;lt;/tt&amp;gt; &lt;br /&gt;
| c++ only&lt;br /&gt;
|&lt;br /&gt;
* If you explicitly set the status in the method (using a test macro or a runtime call), this status will override the status that would otherwise be set by the return value&lt;br /&gt;
* If you don&#039;t explicitly set the status in the method, the return value determines the status as follows:&lt;br /&gt;
** Return is &#039;&#039;&#039;true&#039;&#039;&#039; -&amp;gt; srTEST_PASS&lt;br /&gt;
** Return is &#039;&#039;&#039;false&#039;&#039;&#039; -&amp;gt; srTEST_FAIL&lt;br /&gt;
|&lt;br /&gt;
* If the method runs to completion, the status is determined by the rules to the left (there is no default)  &lt;br /&gt;
* If the method does not run to completion (due to crash or hang in software under test), the status is srTEST_INPROGRESS&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
&lt;br /&gt;
Following are a few short  examples. In each example, a single test unit with the name &amp;quot;MyTest&amp;quot; is  identified to the Stride compiler via [[Test Pragmas]].&lt;br /&gt;
&lt;br /&gt;
=== C++ Class  ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;MyTest.h&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;source  lang=cpp&amp;gt;&lt;br /&gt;
#include &amp;lt;srtest.h&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
class MyTest : public stride::srTest &lt;br /&gt;
{&lt;br /&gt;
public:&lt;br /&gt;
  void ExpectPass() &lt;br /&gt;
  {&lt;br /&gt;
    srNOTE_INFO(&amp;quot;this test should pass&amp;quot;);&lt;br /&gt;
    srEXPECT_EQ(2 + 2, 4); &lt;br /&gt;
  }&lt;br /&gt;
  void ExpectFail() &lt;br /&gt;
  {&lt;br /&gt;
    srNOTE_INFO(&amp;quot;this test should fail&amp;quot;);&lt;br /&gt;
    srEXPECT_GT(2 * 3, 7); &lt;br /&gt;
  }&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
#ifdef _SCL&lt;br /&gt;
// this pragma  identifies MyTest as a test class to the STRIDE compiler&lt;br /&gt;
#pragma scl_test_class(MyTest)&lt;br /&gt;
#endif&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== C  Class ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;MyTest.h&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source  lang=c&amp;gt;&lt;br /&gt;
#include &amp;lt;srtest.h&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
typedef struct MyTest&lt;br /&gt;
{&lt;br /&gt;
    void (*ExpectPass)(struct MyTest* self);&lt;br /&gt;
    void (*ExpectFail)(struct MyTest* self);&lt;br /&gt;
} MyTest;&lt;br /&gt;
&lt;br /&gt;
void MyTest_Init(MyTest* self);&lt;br /&gt;
&lt;br /&gt;
#ifdef _SCL&lt;br /&gt;
//  This pragma identifies MyTest as a test c class to the STRIDE compiler.&lt;br /&gt;
//  Extra instrumentation code will be generated to call MyTest_Init()  before&lt;br /&gt;
// tests are run.&lt;br /&gt;
#pragma scl_test_cclass(MyTest, MyTest_Init)&lt;br /&gt;
#endif&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;MyTest.c&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source  lang=&#039;c&#039;&amp;gt;&lt;br /&gt;
#include  &amp;quot;MyTest.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
static void ExpectPass(MyTest* self)&lt;br /&gt;
{&lt;br /&gt;
    srNOTE_INFO(&amp;quot;this test should pass&amp;quot;);&lt;br /&gt;
    srEXPECT_EQ(2 + 2, 4); &lt;br /&gt;
}&lt;br /&gt;
static void ExpectFail(MyTest* self)&lt;br /&gt;
{&lt;br /&gt;
    srNOTE_INFO(&amp;quot;this test should fail&amp;quot;);&lt;br /&gt;
    srEXPECT_GT(2 * 3, 7); &lt;br /&gt;
}&lt;br /&gt;
void MyTest_Init(MyTest* self)&lt;br /&gt;
{&lt;br /&gt;
    self-&amp;gt;ExpectPass = ExpectPass;&lt;br /&gt;
    self-&amp;gt;ExpectFail = ExpectFail;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Free Functions ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;MyTest.h&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=c&amp;gt;&lt;br /&gt;
#include &amp;lt;srtest.h&amp;gt;&lt;br /&gt;
void ExpectPass();&lt;br /&gt;
void ExpectFail();&lt;br /&gt;
&lt;br /&gt;
#ifdef _SCL&lt;br /&gt;
//  this pragma identifies MyTest as a test unit to the STRIDE compiler,  specifying&lt;br /&gt;
// the four functions as members of the test unit&lt;br /&gt;
#pragma scl_test_flist(&amp;quot;MyTest&amp;quot;, ExpectPass, ExpectFail, ChangeMyName, ChangeMyDescription)&lt;br /&gt;
#endif&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;MyTest.c&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&#039;c&#039;&amp;gt;&lt;br /&gt;
#include &amp;quot;MyTest.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
void ExpectPass()&lt;br /&gt;
{&lt;br /&gt;
    srNOTE_INFO(&amp;quot;this test should pass&amp;quot;);&lt;br /&gt;
    srEXPECT_EQ(2 + 2, 4); &lt;br /&gt;
}&lt;br /&gt;
void ExpectFail()&lt;br /&gt;
{&lt;br /&gt;
    srNOTE_INFO(&amp;quot;this test should fail&amp;quot;);&lt;br /&gt;
    srEXPECT_GT(2 * 3, 7); &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== C++ Only Features ==&lt;br /&gt;
&lt;br /&gt;
=== Use Operator &amp;lt;&amp;lt; to Augment Test Macros ===&lt;br /&gt;
&lt;br /&gt;
In C++ test code [[Test Point]], [[Test Log]] and [[Test Macros]] macros support adding to the annotation using the &amp;lt;&amp;lt; operator. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
srEXPECT_TRUE(a != b) &amp;lt;&amp;lt; &amp;quot;My custom message&amp;quot; &amp;lt;&amp;lt; &amp;quot; with more data &amp;quot; &amp;lt;&amp;lt; 1234;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As delivered, the macros will support stream input annotations for:&lt;br /&gt;
* all numeric types, &lt;br /&gt;
* C string (char* or wchar_t*), and &lt;br /&gt;
* types allowing implicit cast to numeric type or &amp;quot;C&amp;quot; string.&lt;br /&gt;
&lt;br /&gt;
=== Overloading the &amp;lt;&amp;lt; operator ===&lt;br /&gt;
&lt;br /&gt;
You can also overload the &amp;lt;&amp;lt; operator in order to annotate reports using your own custom type. An example is below.&lt;br /&gt;
&lt;br /&gt;
The following will compile and execute successfully given that the &amp;lt;&amp;lt; operator is overloaded as shown:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;srtest.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// MyCustomClass implementation&lt;br /&gt;
class MyCustomClass&lt;br /&gt;
{&lt;br /&gt;
public:&lt;br /&gt;
   MyCustomClass(int i) : m_int(i) {}&lt;br /&gt;
&lt;br /&gt;
private: &lt;br /&gt;
   int m_int; &lt;br /&gt;
   friend stride::Message&amp;amp; operator&amp;lt;&amp;lt;(stride::Message&amp;amp; ss, const MyCustomClass&amp;amp; obj);&lt;br /&gt;
}; &lt;br /&gt;
&lt;br /&gt;
stride::Message&amp;amp; operator&amp;lt;&amp;lt;(stride::Message&amp;amp; ss, const MyCustomClass&amp;amp; obj)&lt;br /&gt;
{&lt;br /&gt;
   ss &amp;lt;&amp;lt; obj.m_int;&lt;br /&gt;
   return ss;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void test()&lt;br /&gt;
{&lt;br /&gt;
    MyCustomClass custom(34); &lt;br /&gt;
&lt;br /&gt;
    srEXPECT_FALSE(true) &amp;lt;&amp;lt; custom;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ryanh</name></author>
	</entry>
	<entry>
		<id>https://www.stridewiki.com/index.php?title=Test_Unit&amp;diff=14440</id>
		<title>Test Unit</title>
		<link rel="alternate" type="text/html" href="https://www.stridewiki.com/index.php?title=Test_Unit&amp;diff=14440"/>
		<updated>2015-07-07T15:17:52Z</updated>

		<summary type="html">&lt;p&gt;Ryanh: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
&#039;&#039;&#039;Stride&#039;&#039;&#039; groups similar test cases into a single &#039;&#039;runnable&#039;&#039; package called a &#039;&#039;&#039;Test Unit&#039;&#039;&#039; (also known as a &#039;&#039;&#039;Test Suite&#039;&#039;&#039;). These tests are written in C and C++ and are compiled and linked with your software and run, when called, on your target platform. They are suitable for both developer unit testing as well as end-to-end integration testing. An external [[Stride Runner]] is provided which controls the execution of &#039;&#039;&#039;Test Units&#039;&#039;&#039; and publishes test results to the local file system and optionally to [http://www.testspace.com Testspace]. The following is an example of the structure of a &#039;&#039;&#039;Test Unit&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Declare tests&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;source  lang=cpp&amp;gt;&lt;br /&gt;
#include &amp;lt;srtest.h&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
class MyTest : public stride::srTest {&lt;br /&gt;
public: &lt;br /&gt;
    void CheckFoo();&lt;br /&gt;
    void CheckBoo();&lt;br /&gt;
};&lt;br /&gt;
#pragma scl_test_class(MyTest)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Write tests&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;source  lang=cpp&amp;gt;&lt;br /&gt;
#include &amp;lt;mytest.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
void MyTest::CheckFoo() {&lt;br /&gt;
    ..  &lt;br /&gt;
    srEXPECT_EQ(foo(2 + 2), 4); &lt;br /&gt;
}&lt;br /&gt;
void MyTest::CheckBoo() {&lt;br /&gt;
    ..&lt;br /&gt;
    srEXPECT_GT(boo(3 * 3), 7); &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Test Unit ==&lt;br /&gt;
A single &#039;&#039;&#039;Test Unit&#039;&#039;&#039; is a set of &#039;&#039;&#039;Test Methods&#039;&#039;&#039; that always run together as an &#039;&#039;&#039;executable unit&#039;&#039;&#039;. Test Methods are the &#039;&#039;&#039;test cases&#039;&#039;&#039;  that comprise a Test Unit. Each Test Method  by default maps to a single Test Case in the results. When relying on  this default behavior of Test Methods, we refer to these methods as &#039;&#039;static Test Cases&#039;&#039;. A less common technique is  to create and add a Test Case dynamically at runtime to an existing  Suite via the [[Runtime_Test_Services#method_AddCase|Test Services]].  We refer to these as &#039;&#039;dynamic  Test Cases&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Individual test cases are  implemented as test methods or functions which follow a four-phase testing pattern:&lt;br /&gt;
&lt;br /&gt;
# Setting up a  test fixture (optional)&lt;br /&gt;
# Exercising the Software Under Test (SUT)&lt;br /&gt;
# Verifying  that the expected outcome has occurred &lt;br /&gt;
# Tearing down  the test fixture (optional)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Test fixturing&#039;&#039;&#039; refers to the &#039;&#039;Setup&#039;&#039; and &#039;&#039;Teardown&#039;&#039;   phases of the testing.&lt;br /&gt;
&lt;br /&gt;
In the &#039;&#039;&#039;Setup&#039;&#039;&#039;   phase, we put all of the things into place that are required in order   to run a our test and expect a particular outcome. This includes things   like:&lt;br /&gt;
* Acquiring resources such as memory,   hardware, etc.&lt;br /&gt;
* Setting up required states such as input   files in place, memory filled with a pattern, dependencies initialized,   etc.&lt;br /&gt;
&lt;br /&gt;
In the &#039;&#039;&#039;Tear down&#039;&#039;&#039;   phase, we clean up the fixturing we did in the Setup phase, leaving  the  system in a state that is ready to be used by the next test.&lt;br /&gt;
&lt;br /&gt;
== Packaging ==&lt;br /&gt;
&lt;br /&gt;
Individual functions or methods,  which typically implement a single test case are grouped into one or  more Test Units which are executed as atomic entities.&lt;br /&gt;
&lt;br /&gt;
Grouping  of individual tests into a Test Unit can be accomplished in any of three  ways:&lt;br /&gt;
&lt;br /&gt;
* A Test Unit can be comprised of the  member functions of a &#039;&#039;&#039;C++  class&#039;&#039;&#039;, &lt;br /&gt;
* A Test Unit  can be comprised of a set of &#039;&#039;&#039;C functions&#039;&#039;&#039;,  &lt;br /&gt;
* A Test Unit can be comprised of C functions pointed to by members of a &#039;&#039;&#039;C struct&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The following  table compares the three packaging variants. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &amp;lt;big&amp;gt;&#039;&#039;&#039;&#039;&#039;Comparison of Test Unit Packaging&#039;&#039;&#039;&#039;&#039;&amp;lt;/big&amp;gt;&lt;br /&gt;
! Test Unit  Type!! Advantages !! Disadvantages !! scl pragma &lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
&#039;&#039;&#039;C++ class&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Test_Unit#Test_Unit_as_C.2B.2B_Class|Example code]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|&lt;br /&gt;
* Simple and easy to use&lt;br /&gt;
* Can be used with target code that is all C, all C++, or a mix&lt;br /&gt;
* Test utility methods can be encapsulated as test class members or members of a parent class&lt;br /&gt;
* Could be [[Parameterized_Test_Units | parametrized]] via constructor arguments&lt;br /&gt;
* Provides convenient syntax for augmenting report annotation (operator &amp;lt;tt&amp;gt;&amp;lt;&amp;lt;&amp;lt;/tt&amp;gt;)&lt;br /&gt;
| &lt;br /&gt;
* Requires a C++ build environment &lt;br /&gt;
| &amp;lt;tt&amp;gt;scl_test_class&amp;lt;/tt&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
&#039;&#039;&#039;C class&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Test_Unit#Test_Unit_as_C_Class|Example code]]&lt;br /&gt;
&lt;br /&gt;
|&lt;br /&gt;
* Provides encapsulation of test methods&lt;br /&gt;
* Provides encapsulation of state via member variables &lt;br /&gt;
* Could be [[Parameterized_Test_Units |parametrized]] via init-function arguments&lt;br /&gt;
|&lt;br /&gt;
* Requires initialization code for structure  function pointer setup&lt;br /&gt;
* [[Test_Documentation_in_C/C%2B%2B|Test Unit documentation]] must be associated with the  structure function pointer members instead of the actual test method implementations.&lt;br /&gt;
| &amp;lt;tt&amp;gt;scl_test_cclass&amp;lt;/tt&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
&#039;&#039;&#039;C functions&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Test_Unit#Test_Unit_as_Group_of_Free_Functions|Example code]]&lt;br /&gt;
&lt;br /&gt;
|&lt;br /&gt;
* Extremely  simple syntax &lt;br /&gt;
|&lt;br /&gt;
* Parametrized test units are not supported&lt;br /&gt;
* No test unit support for constructor/initializer or destructor/de-initializer&lt;br /&gt;
* Changing test unit membership requires editing of the pragma statement &lt;br /&gt;
* [[Test_Documentation_in_C/C%2B%2B|Test Unit documentation]] for the FList must be associated  with the header file - as such, you can only have one FList per header file if you want to document your test units.&lt;br /&gt;
| &amp;lt;tt&amp;gt;scl_test_flist&amp;lt;/tt&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The best choice is usually the C++ class since it offers the best mix of features and ease-of-use. (You can test code written in C or C++ using the C++ class  test units.) However, compiling C++ is not always possible, in this case one of the C-based test unit packaging options must be used.&lt;br /&gt;
&lt;br /&gt;
You can freely mix different deployment methods across a project if desired, the format of the results is consistent across all test unit packaging options.&lt;br /&gt;
&lt;br /&gt;
== Test Method Return Values == &lt;br /&gt;
&lt;br /&gt;
Test Method return values must conform to certain return types as summarizing in the following table. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot; style=&amp;quot;background-color:#ffffcc;font-family:arial;font-size:9pt;&amp;quot;  &lt;br /&gt;
| &#039;&#039;&#039;Return Type&#039;&#039;&#039; &lt;br /&gt;
| &#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039;How Return Value is Interpreted&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039;Default Status&#039;&#039;&#039;&lt;br /&gt;
|- &lt;br /&gt;
| &amp;lt;tt&amp;gt;void&amp;lt;/tt&amp;gt;&lt;br /&gt;
| Most common return type&lt;br /&gt;
| Since there is no return, PASS/FAIL status is set in the body of the method using a &lt;br /&gt;
* [[Test_Macros|Test Macro]] &lt;br /&gt;
or a runtime call&lt;br /&gt;
* [[Runtime_Test_Services#srTestCaseSetStatus|srTestCaseSetStatus()]]&lt;br /&gt;
* [[Runtime_Test_Services#srTestCaseSetStatusEx|srTestCaseSetStatusEx()]]&lt;br /&gt;
* [[Runtime_Test_Services#method_SetStatus|srTestCase::SetStatus()]]&lt;br /&gt;
| &lt;br /&gt;
* If the method runs to completion without another status being set, the status is srTEST_PASS&lt;br /&gt;
* If the method does not run to completion (due to crash or hang in software under test), the status is srTEST_INPROGRESS&lt;br /&gt;
|-&lt;br /&gt;
| integer type&lt;br /&gt;
| Integer types include:&lt;br /&gt;
* &amp;lt;tt&amp;gt;int&amp;lt;/tt&amp;gt;&lt;br /&gt;
* &amp;lt;tt&amp;gt;short&amp;lt;/tt&amp;gt;&lt;br /&gt;
* &amp;lt;tt&amp;gt;char&amp;lt;/tt&amp;gt;&lt;br /&gt;
* &amp;lt;tt&amp;gt;long&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;small&amp;gt;&#039;&#039;may include signed/unsigned/const qualifiers&#039;&#039;&amp;lt;/small&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* If you explicitly set the status in the method (using a test macro or a runtime call), this status will override the status that would otherwise be set by the return value&lt;br /&gt;
* If you don&#039;t explicitly set the status in the method, the return value determines the status as follows:&lt;br /&gt;
** Return is &#039;&#039;&#039;zero&#039;&#039;&#039; -&amp;gt; srTEST_PASS&lt;br /&gt;
** Return is &#039;&#039;&#039;non-zero&#039;&#039;&#039; -&amp;gt; srTEST_FAIL&lt;br /&gt;
|&lt;br /&gt;
* If the method runs to completion, the status is determined by the rules to the left (there is no default)  &lt;br /&gt;
* If the method does not run to completion (due to crash or hang in software under test), the status is srTEST_INPROGRESS&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;bool&amp;lt;/tt&amp;gt; &lt;br /&gt;
| c++ only&lt;br /&gt;
|&lt;br /&gt;
* If you explicitly set the status in the method (using a test macro or a runtime call), this status will override the status that would otherwise be set by the return value&lt;br /&gt;
* If you don&#039;t explicitly set the status in the method, the return value determines the status as follows:&lt;br /&gt;
** Return is &#039;&#039;&#039;true&#039;&#039;&#039; -&amp;gt; srTEST_PASS&lt;br /&gt;
** Return is &#039;&#039;&#039;false&#039;&#039;&#039; -&amp;gt; srTEST_FAIL&lt;br /&gt;
|&lt;br /&gt;
* If the method runs to completion, the status is determined by the rules to the left (there is no default)  &lt;br /&gt;
* If the method does not run to completion (due to crash or hang in software under test), the status is srTEST_INPROGRESS&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
&lt;br /&gt;
Following are a few short  examples. In each example, a single test unit with the name &amp;quot;MyTest&amp;quot; is  identified to the Stride compiler via a [[Test Pragmas]].&lt;br /&gt;
&lt;br /&gt;
=== C++ Class  ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;MyTest.h&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;source  lang=cpp&amp;gt;&lt;br /&gt;
#include &amp;lt;srtest.h&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
class MyTest : public stride::srTest &lt;br /&gt;
{&lt;br /&gt;
public:&lt;br /&gt;
  void ExpectPass() &lt;br /&gt;
  {&lt;br /&gt;
    srNOTE_INFO(&amp;quot;this test should pass&amp;quot;);&lt;br /&gt;
    srEXPECT_EQ(2 + 2, 4); &lt;br /&gt;
  }&lt;br /&gt;
  void ExpectFail() &lt;br /&gt;
  {&lt;br /&gt;
    srNOTE_INFO(&amp;quot;this test should fail&amp;quot;);&lt;br /&gt;
    srEXPECT_GT(2 * 3, 7); &lt;br /&gt;
  }&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
#ifdef _SCL&lt;br /&gt;
// this pragma  identifies MyTest as a test class to the STRIDE compiler&lt;br /&gt;
#pragma scl_test_class(MyTest)&lt;br /&gt;
#endif&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== C  Class ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;MyTest.h&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source  lang=c&amp;gt;&lt;br /&gt;
#include &amp;lt;srtest.h&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
typedef struct MyTest&lt;br /&gt;
{&lt;br /&gt;
    void (*ExpectPass)(struct MyTest* self);&lt;br /&gt;
    void (*ExpectFail)(struct MyTest* self);&lt;br /&gt;
} MyTest;&lt;br /&gt;
&lt;br /&gt;
void MyTest_Init(MyTest* self);&lt;br /&gt;
&lt;br /&gt;
#ifdef _SCL&lt;br /&gt;
//  This pragma identifies MyTest as a test c class to the STRIDE compiler.&lt;br /&gt;
//  Extra instrumentation code will be generated to call MyTest_Init()  before&lt;br /&gt;
// tests are run.&lt;br /&gt;
#pragma scl_test_cclass(MyTest, MyTest_Init)&lt;br /&gt;
#endif&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;MyTest.c&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source  lang=&#039;c&#039;&amp;gt;&lt;br /&gt;
#include  &amp;quot;MyTest.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
static void ExpectPass(MyTest* self)&lt;br /&gt;
{&lt;br /&gt;
    srNOTE_INFO(&amp;quot;this test should pass&amp;quot;);&lt;br /&gt;
    srEXPECT_EQ(2 + 2, 4); &lt;br /&gt;
}&lt;br /&gt;
static void ExpectFail(MyTest* self)&lt;br /&gt;
{&lt;br /&gt;
    srNOTE_INFO(&amp;quot;this test should fail&amp;quot;);&lt;br /&gt;
    srEXPECT_GT(2 * 3, 7); &lt;br /&gt;
}&lt;br /&gt;
void MyTest_Init(MyTest* self)&lt;br /&gt;
{&lt;br /&gt;
    self-&amp;gt;ExpectPass = ExpectPass;&lt;br /&gt;
    self-&amp;gt;ExpectFail = ExpectFail;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Free Functions ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;MyTest.h&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=c&amp;gt;&lt;br /&gt;
#include &amp;lt;srtest.h&amp;gt;&lt;br /&gt;
void ExpectPass();&lt;br /&gt;
void ExpectFail();&lt;br /&gt;
&lt;br /&gt;
#ifdef _SCL&lt;br /&gt;
//  this pragma identifies MyTest as a test unit to the STRIDE compiler,  specifying&lt;br /&gt;
// the four functions as members of the test unit&lt;br /&gt;
#pragma scl_test_flist(&amp;quot;MyTest&amp;quot;, ExpectPass, ExpectFail, ChangeMyName, ChangeMyDescription)&lt;br /&gt;
#endif&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;MyTest.c&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&#039;c&#039;&amp;gt;&lt;br /&gt;
#include &amp;quot;MyTest.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
void ExpectPass()&lt;br /&gt;
{&lt;br /&gt;
    srNOTE_INFO(&amp;quot;this test should pass&amp;quot;);&lt;br /&gt;
    srEXPECT_EQ(2 + 2, 4); &lt;br /&gt;
}&lt;br /&gt;
void ExpectFail()&lt;br /&gt;
{&lt;br /&gt;
    srNOTE_INFO(&amp;quot;this test should fail&amp;quot;);&lt;br /&gt;
    srEXPECT_GT(2 * 3, 7); &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== C++ Only Features ==&lt;br /&gt;
&lt;br /&gt;
=== Use Operator &amp;lt;&amp;lt; to Augment Test Macros ===&lt;br /&gt;
&lt;br /&gt;
In C++ test code [[Test Point]], [[Test Log]] and [[Test Macros]] macros support adding to the annotation using the &amp;lt;&amp;lt; operator. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
srEXPECT_TRUE(a != b) &amp;lt;&amp;lt; &amp;quot;My custom message&amp;quot; &amp;lt;&amp;lt; &amp;quot; with more data &amp;quot; &amp;lt;&amp;lt; 1234;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As delivered, the macros will support stream input annotations for:&lt;br /&gt;
* all numeric types, &lt;br /&gt;
* C string (char* or wchar_t*), and &lt;br /&gt;
* types allowing implicit cast to numeric type or &amp;quot;C&amp;quot; string.&lt;br /&gt;
&lt;br /&gt;
=== Overloading the &amp;lt;&amp;lt; operator ===&lt;br /&gt;
&lt;br /&gt;
You can also overload the &amp;lt;&amp;lt; operator in order to annotate reports using your own custom type. An example is below.&lt;br /&gt;
&lt;br /&gt;
The following will compile and execute successfully given that the &amp;lt;&amp;lt; operator is overloaded as shown:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;srtest.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// MyCustomClass implementation&lt;br /&gt;
class MyCustomClass&lt;br /&gt;
{&lt;br /&gt;
public:&lt;br /&gt;
   MyCustomClass(int i) : m_int(i) {}&lt;br /&gt;
&lt;br /&gt;
private: &lt;br /&gt;
   int m_int; &lt;br /&gt;
   friend stride::Message&amp;amp; operator&amp;lt;&amp;lt;(stride::Message&amp;amp; ss, const MyCustomClass&amp;amp; obj);&lt;br /&gt;
}; &lt;br /&gt;
&lt;br /&gt;
stride::Message&amp;amp; operator&amp;lt;&amp;lt;(stride::Message&amp;amp; ss, const MyCustomClass&amp;amp; obj)&lt;br /&gt;
{&lt;br /&gt;
   ss &amp;lt;&amp;lt; obj.m_int;&lt;br /&gt;
   return ss;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void test()&lt;br /&gt;
{&lt;br /&gt;
    MyCustomClass custom(34); &lt;br /&gt;
&lt;br /&gt;
    srEXPECT_FALSE(true) &amp;lt;&amp;lt; custom;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ryanh</name></author>
	</entry>
</feed>