/sparrowhawk/test_framework/ESTFSystemAssert.h

http://github.com/jtblatt/duderino · C Header · 61 lines · 14 code · 7 blank · 40 comment · 6 complexity · 5478855ef1148c2837141f51a917cb68 MD5 · raw file

  1. /** @file ESTFSystemAssert.h
  2. * @brief Macros that pass test case results to the system assert facility.
  3. *
  4. * Copyright (c) 2009 Yahoo! Inc.
  5. * The copyrights embodied in the content of this file are licensed by Yahoo! Inc.
  6. * under the BSD (revised) open source license.
  7. *
  8. * Derived from code that is Copyright (c) 2009 Joshua Blatt and offered under both
  9. * BSD and Apache 2.0 licenses (http://sourceforge.net/projects/sparrowhawk/).
  10. *
  11. * $Author: blattj $
  12. * $Date: 2009/05/25 21:51:19 $
  13. * $Name: $
  14. * $Revision: 1.3 $
  15. */
  16. #ifndef ESTF_SYSTEM_ASSERT_H
  17. #define ESTF_SYSTEM_ASSERT_H
  18. #ifndef ESTF_CONFIG_H
  19. #include <ESTFConfig.h>
  20. #endif
  21. /** Evaluate an expression and record the result in a result collector. The
  22. * expression itself will be used as the decription of the test record.
  23. *
  24. * @param collector The result collector to modify
  25. * @param expr The expression to test
  26. * @ingroup test
  27. */
  28. #define ESTF_ASSERT( collector, expr ) \
  29. if ( collector ) ESTF_NATIVE_ASSERT( expr );
  30. /** Add a success result to a result collector.
  31. *
  32. * @param collector The result collector to modify
  33. * @param description The description of the success result.
  34. * @ingroup test
  35. */
  36. #define ESTF_SUCCESS( collector, description ) \
  37. if ( collector );
  38. /** Add a failure result to a result collector.
  39. *
  40. * @param collector The result collector to modify
  41. * @param description The description of the failure result.
  42. * @ingroup test
  43. */
  44. #define ESTF_FAILURE( collector, description ) \
  45. if ( collector ) ESTF_NATIVE_ASSERT( (void *) "FAILURE: " == (void *) description )
  46. /** Add an error result to a result collector.
  47. *
  48. * @param collector The result collector to modify
  49. * @param description The description of the error condition.
  50. * @ingroup test
  51. */
  52. #define ESTF_ERROR( collector, description ) \
  53. if ( collector ) ESTF_NATIVE_ASSERT( (void *) "ERROR: " == (void *) description )
  54. #endif