TestAssert.h
上传用户:xfwatch
上传日期:2020-12-14
资源大小:872k
文件大小:3k
源码类别:

中间件编程

开发平台:

Java

  1. /*
  2.  * JBoss, Home of Professional Open Source
  3.  * Copyright 2010, Red Hat, Inc., and others contributors as indicated
  4.  * by the @authors tag. All rights reserved.
  5.  * See the copyright.txt in the distribution for a
  6.  * full listing of individual contributors.
  7.  * This copyrighted material is made available to anyone wishing to use,
  8.  * modify, copy, or redistribute it subject to the terms and conds
  9.  * of the GNU Lesser General Public License, v. 2.1.
  10.  * This program is distributed in the hope that it will be useful, but WITHOUT A
  11.  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
  12.  * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
  13.  * You should have received a copy of the GNU Lesser General Public License,
  14.  * v.2.1 along with this distribution; if not, write to the Free Software
  15.  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  16.  * MA  02110-1301, USA.
  17.  */
  18. #ifndef _TEST_ASSERT_H_
  19. #define _TEST_ASSERT_H_
  20. #include <cppunit/extensions/HelperMacros.h>
  21. #include "userlogc.h"
  22. #ifdef __cplusplus
  23. extern "C" {
  24. #endif
  25. extern BLACKTIE_CORE_DLL void init_ace();
  26. #ifdef __cplusplus
  27. }
  28. #endif
  29. #define BTDBGPOST
  30. userlogc_debug("POST ASSERT %s:%d", __FILE__, __LINE__)
  31. #define BTDBGPRE
  32. userlogc_debug("PRE ASSERT %s:%d", __FILE__, __LINE__)
  33. #define CHKCOND(cond)
  34. if (!(cond)) userlogc_debug("CHKCOND ASSERT FAILED %s:%d", __FILE__, __LINE__)
  35. #define BT_ASSERT(cond) {
  36. bool _w12pq_u = (cond);
  37. CHKCOND(_w12pq_u);
  38. CPPUNIT_ASSERT(_w12pq_u);}
  39. #define BT_ASSERT_MESSAGE(message,cond) {
  40. bool _w12pq_u = (cond);
  41. CHKCOND(_w12pq_u);
  42. CPPUNIT_ASSERT_MESSAGE((message),_w12pq_u);} 
  43. #define BT_ASSERT_EQUAL(expected,actual)
  44. BTDBGPRE;CPPUNIT_ASSERT_EQUAL((expected),(actual));BTDBGPOST
  45. #define BT_ASSERT_EQUAL_MESSAGE(message,expected,actual)
  46. BTDBGPRE;CPPUNIT_ASSERT_EQUAL_MESSAGE((message),(expected),(actual));BTDBGPOST
  47. #define BT_FAIL(message)
  48. userlogc_debug("ASSERT FAIL %s:%d", __FILE__, __LINE__);CPPUNIT_FAIL((message))
  49. #define BT_ASSERT_DOUBLES_EQUAL(expected,actual,delta)
  50. BTDBGPRE;CPPUNIT_ASSERT_DOUBLES_EQUAL((expected),(actual),(delta));BTDBGPOST
  51. #define BT_ASSERT_DOUBLES_EQUAL_MESSAGE(message,expected,actual,delta)
  52. BTDBGPRE;CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE((message),(expected),(actual),(delta));BTDBGPOST
  53. #define BT_ASSERT_THROW(expression, ExceptionType)
  54. BTDBGPRE;CPPUNIT_ASSERT_THROW((expression), (ExceptionType));BTDBGPOST
  55. #define BT_ASSERT_THROW_MESSAGE(message, expression, ExceptionType)
  56. BTDBGPRE;CPPUNIT_ASSERT_THROW_MESSAGE((message), (expression), (ExceptionType));BTDBGPOST
  57. #define BT_ASSERT_NO_THROW(expression)
  58. BTDBGPRE;CPPUNIT_ASSERT_NO_THROW((expression)) ;BTDBGPOST
  59. #define BT_ASSERT_ASSERTION_FAIL(assertion)
  60. BTDBGPRE;CPPUNIT_ASSERT_ASSERTION_FAIL((assertion));BTDBGPOST
  61. #define BT_ASSERT_ASSERTION_FAIL_MESSAGE(message, assertion)
  62. BTDBGPRE;CPPUNIT_ASSERT_ASSERTION_FAIL_MESSAGE((message), (assertion));BTDBGPOST
  63. #define BT_ASSERT_ASSERTION_PASS(assertion)
  64. BTDBGPRE;CPPUNIT_ASSERT_ASSERTION_PASS((assertion));BTDBGPOST
  65. #define BT_ASSERT_ASSERTION_PASS_MESSAGE(message, assertion)
  66. BTDBGPRE;CPPUNIT_ASSERT_ASSERTION_PASS_MESSAGE((message), (assertion));BTDBGPOST
  67. #endif /*_TEST_ASSERT_H_*/