/*************************************************************************** * * Copyright (c) 2008 Baidu.com, Inc. All Rights Reserved * $Id: bsl_test_alloc.h,v 1.2 2008/12/15 09:57:00 xiaowei Exp $ * **************************************************************************/ /** * @file bsl_test_alloc.h * @author xiaowei(com@baidu.com) * @date 2008/08/22 17:38:52 * @version $Revision: 1.2 $ * @brief * **/ #ifndef __BSL_TEST_ALLOC_H_ #define __BSL_TEST_ALLOC_H_ #include #include #include #define __XASSERT(flag, fmt, arg...) \ {\ bool ___bsl_flag = flag; \ if (!(___bsl_flag)) { \ fprintf(stdout, "\n[error][%s:%d][%s]"fmt"\n", __FILE__, __LINE__, #flag, ##arg); \ return false; \ }\ } #define __XASSERT2(flag) __XASSERT(flag, "") template bool test_normal() { typedef typename _Alloc::value_type value_type; typedef typename _Alloc::pointer pointer; typedef std::vector vec_t; typedef std::vector vecp_t; _Alloc alloc; __XASSERT2(alloc.create() == 0); vec_t vecs; vecp_t vecp; int loop = 100000; for (int i=0; i intalloc_t; void test_normal_int(void) { TSM_ASSERT (0, test_normal()); } typedef bsl::bsl_alloc dballoc_t; void test_normal_double() { TSM_ASSERT (0, test_normal()); } typedef bsl::bsl_sample_alloc intsalloc_t; void test_salloc_int(void) { TSM_ASSERT (0, test_normal()); } typedef bsl::bsl_sample_alloc dbsalloc_t; void test_salloc_double() { TSM_ASSERT (0, test_normal()); } typedef bsl::bsl_cpsalloc intcpalloc_t; void test_cpalloc_int() { TSM_ASSERT (0, test_normal()); } typedef bsl::bsl_cpsalloc dbcpalloc_t; void test_cpalloc_double() { TSM_ASSERT (0, test_normal()); } }; #endif //__BSL_TEST_ALLOC_H_ /* vim: set ts=4 sw=4 sts=4 tw=100 noet: */