Difference between revisions of "Test Macros Sample"

From STRIDE Wiki
Jump to: navigation, search
(Introduction)
(Tests Description)
Line 9: Line 9:
 
====Basic::ExpectBool====
 
====Basic::ExpectBool====
  
This example demonstrates uses of the [[Test_Units#Boolean_Macros|''srEXPECT_TRUE()'' and ''srEXPECT_FALSE()'']] test class macros.  
+
This example demonstrates uses of the [[Pass/Fail_Macros#Boolean_Macros|''srEXPECT_TRUE()'' and ''srEXPECT_FALSE()'']] test class macros.  
  
 
====Basic::Comparison====
 
====Basic::Comparison====
  
This example demonstrates uses of the [[Test_Units#Comparison_Macros|''srEXPECT_EQ()'', ''srEXPECT_NE()'', ''srEXPECT_GT()'', ''srEXPECT_GE()'', ''srEXPECT_LT()'' and ''srEXPECT_LE()'']] macros.  
+
This example demonstrates uses of the [[Pass/Fail_Macros#Comparison_Macros|''srEXPECT_EQ()'', ''srEXPECT_NE()'', ''srEXPECT_GT()'', ''srEXPECT_GE()'', ''srEXPECT_LT()'' and ''srEXPECT_LE()'']] macros.  
  
 
====Basic::CString====
 
====Basic::CString====
  
This example demonstrates use of the C-string (zero terminated character sequence) macros [[Test_Units#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 [[Pass/Fail_Macros#C_String_Comparison_Macros|''srEXPECT_STREQ()'', ''srEXPECT_STRNE(''), ''srEXPECT_STRCASEEQ()'' and ''srEXPECT_STRCASENE()'']].  
  
 
====Basic::Exceptions====
 
====Basic::Exceptions====
  
This example demonstrates use of the exception verification macros [[Test_Units#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 exception verification macros [[Pass/Fail_Macros#Exception_Macros|''srEXPECT_THROW()'', ''srEXPECT_THROW_ANY()'' and ''srEXPECT_NO_THROW()'']]. Note there is only C++ implementation for this test.
  
 
====Basic::Predicates====
 
====Basic::Predicates====
  
This example demonstrates use of the predicate based macros [[Test_Units#Predicate_Macros|''srEXPECT_PRED<n>()'']].
+
This example demonstrates use of the predicate based macros [[Pass/Fail_Macros#Predicate_Macros|''srEXPECT_PRED<n>()'']].
  
 
====Basic::FloatingPointComparison====
 
====Basic::FloatingPointComparison====
  
This example demonstrates use of the macro used to test equality (or near equality) of floating point values [[Test_Units#Floating_Point_Macros|''srEXPECT_NEAR()'']].
+
This example demonstrates use of the macro used to test equality (or near equality) of floating point values [[Pass/Fail_Macros#Floating_Point_Macros|''srEXPECT_NEAR()'']].
  
 
====Basic::Assert====
 
====Basic::Assert====
  
This example illustrates the use of the [[Test_Units#General_guidelines_for_all_macros|assertion macros]] (''srASSERT_xx'') which, in contrast to the [[Test_Units#General_guidelines_for_all_macros|expectation macros]] (''srEXPECT_xx''), cause the rest of the test case code to be bypassed.
+
This example illustrates the use of the [[Pass/Fail_Macros#General_guidelines_for_all_macros|assertion macros]] (''srASSERT_xx'') which, in contrast to the [[Pass/Fail_Macros#General_guidelines_for_all_macros|expectation macros]] (''srEXPECT_xx''), cause the rest of the test case code to be bypassed.
  
 
[[Category: Samples]]
 
[[Category: Samples]]

Revision as of 17:41, 21 August 2009

Introduction

These examples cover simple uses of each of the STRIDE assertion 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 c++ test classes, these macros are also available for use in c compilation units.

Tests Description

Basic

Basic::ExpectBool

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

Basic::Comparison

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

Basic::CString

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

Basic::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.

Basic::Predicates

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

Basic::FloatingPointComparison

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

Basic::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.