Test Macros Sample: Difference between revisions

From STRIDE Wiki
Jump to navigation Jump to search
 
(2 intermediate revisions by the same user not shown)
Line 5: Line 5:
==Tests Description==
==Tests Description==


===Basic===
===Bool===
 
====Basic::ExpectBool====


This example demonstrates uses of the [[Test Macros#Boolean_Macros|''srEXPECT_TRUE()'' and ''srEXPECT_FALSE()'']] test class macros.  
This example demonstrates uses of the [[Test Macros#Boolean_Macros|''srEXPECT_TRUE()'' and ''srEXPECT_FALSE()'']] test class macros.  


====Basic::Comparison====
===Comparison===


This example demonstrates uses of the [[Test Macros#Comparison_Macros|''srEXPECT_EQ()'', ''srEXPECT_NE()'', ''srEXPECT_GT()'', ''srEXPECT_GE()'', ''srEXPECT_LT()'' and ''srEXPECT_LE()'']] macros.  
This example demonstrates uses of the [[Test Macros#Comparison_Macros|''srEXPECT_EQ()'', ''srEXPECT_NE()'', ''srEXPECT_GT()'', ''srEXPECT_GE()'', ''srEXPECT_LT()'' and ''srEXPECT_LE()'']] macros.  


====Basic::CString====
===CString===


This example demonstrates use of the C-string (zero terminated character sequence) macros [[Test Macros#C_String_Comparison_Macros|''srEXPECT_STREQ()'', ''srEXPECT_STRNE(''), ''srEXPECT_STRCASEEQ()'' and ''srEXPECT_STRCASENE()'']].  
This example demonstrates use of the C-string (zero terminated character sequence) macros [[Test Macros#C_String_Comparison_Macros|''srEXPECT_STREQ()'', ''srEXPECT_STRNE(''), ''srEXPECT_STRCASEEQ()'' and ''srEXPECT_STRCASENE()'']].  


====Basic::Exceptions====
===FloatingPointComparison===


This example demonstrates use of the exception verification macros [[Test Macros#Exception_Macros|''srEXPECT_THROW()'', ''srEXPECT_THROW_ANY()'' and ''srEXPECT_NO_THROW()'']]. Note there is only C++ implementation for this test.
This example demonstrates use of the macro used to test equality (or near equality) of floating point values [[Test Macros#Floating_Point_Comparison_Macros|''srEXPECT_NEAR()'']].


====Basic::Predicates====
===Predicates===


This example demonstrates use of the predicate based macros [[Test Macros#Predicate_Macros|''srEXPECT_PRED<n>()'']].
This example demonstrates use of the predicate based macros [[Test Macros#Predicate_Macros|''srEXPECT_PRED<n>()'']].


====Basic::FloatingPointComparison====
===Note===
TBD
 
===Assert===
 
This example illustrates the use of the [[Test Macros#General_Guidelines_for_Test_Macros|assertion macros]] (''srASSERT_xx'') which, in contrast to the [[Test Macros#General_Guidelines_for_Test_Macros|expectation macros]] (''srEXPECT_xx''), cause the rest of the test case code to be bypassed.
 
===ExitUnit===
TBD
 
===ExitUnitFixture===
TBD
 
===ExitUnitConstructor===
TBD


This example demonstrates use of the macro used to test equality (or near equality) of floating point values [[Test Macros#Floating_Point_Comparison_Macros|''srEXPECT_NEAR()'']].
===Exceptions===


====Basic::Assert====
This example demonstrates use of the exception verification macros [[Test Macros#Exception_Macros|''srEXPECT_THROW()'', ''srEXPECT_THROW_ANY()'' and ''srEXPECT_NO_THROW()'']]. Note there is only C++ implementation for this test.


This example illustrates the use of the [[Test Macros#General_Guidelines_for_Test_Macros|assertion macros]] (''srASSERT_xx'') which, in contrast to the [[Test Macros#General_Guidelines_for_Test_Macros|expectation macros]] (''srEXPECT_xx''), cause the rest of the test case code to be bypassed.


[[Category: Samples]]
[[Category: Samples]]

Latest revision as of 23:49, 6 June 2011

Introduction

These examples cover simple uses of each of the Test Macros. The names of the test methods contain either Pass or Fail. All methods containing Fail illustrates uses of test macros that result in failures. Methods containing Pass illustrate passing uses. While these examples use Test Class packaging, these macros works basically the same within c compilation units.

Tests Description

Bool

This example demonstrates uses of the srEXPECT_TRUE() and srEXPECT_FALSE() test class macros.

Comparison

This example demonstrates uses of the srEXPECT_EQ(), srEXPECT_NE(), srEXPECT_GT(), srEXPECT_GE(), srEXPECT_LT() and srEXPECT_LE() macros.

CString

This example demonstrates use of the C-string (zero terminated character sequence) macros srEXPECT_STREQ(), srEXPECT_STRNE(), srEXPECT_STRCASEEQ() and srEXPECT_STRCASENE().

FloatingPointComparison

This example demonstrates use of the macro used to test equality (or near equality) of floating point values srEXPECT_NEAR().

Predicates

This example demonstrates use of the predicate based macros srEXPECT_PRED<n>().

Note

TBD

Assert

This example illustrates the use of the assertion macros (srASSERT_xx) which, in contrast to the expectation macros (srEXPECT_xx), cause the rest of the test case code to be bypassed.

ExitUnit

TBD

ExitUnitFixture

TBD

ExitUnitConstructor

TBD

Exceptions

This example demonstrates use of the exception verification macros srEXPECT_THROW(), srEXPECT_THROW_ANY() and srEXPECT_NO_THROW(). Note there is only C++ implementation for this test.