test_utils.cpp 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505
  1. // This file is part of OpenCV project.
  2. // It is subject to the license terms in the LICENSE file found in the top-level directory
  3. // of this distribution and at http://opencv.org/license.html.
  4. #include "test_precomp.hpp"
  5. #include "opencv2/core/utils/logger.defines.hpp"
  6. #undef CV_LOG_STRIP_LEVEL
  7. #define CV_LOG_STRIP_LEVEL CV_LOG_LEVEL_VERBOSE + 1
  8. #include "opencv2/core/utils/logger.hpp"
  9. #include "opencv2/core/utils/buffer_area.private.hpp"
  10. #include "opencv2/core/utils/filesystem.private.hpp"
  11. #ifndef OPENCV_DISABLE_THREAD_SUPPORT
  12. #include "test_utils_tls.impl.hpp"
  13. #endif
  14. namespace opencv_test { namespace {
  15. static const char * const keys =
  16. "{ h help | | print help }"
  17. "{ i info | false | print info }"
  18. "{ t true | true | true value }"
  19. "{ n unused | | dummy }"
  20. ;
  21. TEST(CommandLineParser, testFailure)
  22. {
  23. const char* argv[] = {"<bin>", "-q"};
  24. const int argc = 2;
  25. cv::CommandLineParser parser(argc, argv, keys);
  26. EXPECT_ANY_THROW(parser.has("q"));
  27. EXPECT_ANY_THROW(parser.get<bool>("q"));
  28. EXPECT_ANY_THROW(parser.get<bool>(0));
  29. parser.get<bool>("h");
  30. EXPECT_FALSE(parser.check());
  31. }
  32. TEST(CommandLineParser, testHas_noValues)
  33. {
  34. const char* argv[] = {"<bin>", "-h", "--info"};
  35. const int argc = 3;
  36. cv::CommandLineParser parser(argc, argv, keys);
  37. EXPECT_TRUE(parser.has("help"));
  38. EXPECT_TRUE(parser.has("h"));
  39. EXPECT_TRUE(parser.get<bool>("help"));
  40. EXPECT_TRUE(parser.get<bool>("h"));
  41. EXPECT_TRUE(parser.has("info"));
  42. EXPECT_TRUE(parser.has("i"));
  43. EXPECT_TRUE(parser.get<bool>("info"));
  44. EXPECT_TRUE(parser.get<bool>("i"));
  45. EXPECT_TRUE(parser.get<bool>("true"));
  46. EXPECT_TRUE(parser.get<bool>("t"));
  47. EXPECT_FALSE(parser.has("n"));
  48. EXPECT_FALSE(parser.has("unused"));
  49. }
  50. TEST(CommandLineParser, testHas_TrueValues)
  51. {
  52. const char* argv[] = {"<bin>", "-h=TRUE", "--info=true"};
  53. const int argc = 3;
  54. cv::CommandLineParser parser(argc, argv, keys);
  55. EXPECT_TRUE(parser.has("help"));
  56. EXPECT_TRUE(parser.has("h"));
  57. EXPECT_TRUE(parser.get<bool>("help"));
  58. EXPECT_TRUE(parser.get<bool>("h"));
  59. EXPECT_TRUE(parser.has("info"));
  60. EXPECT_TRUE(parser.has("i"));
  61. EXPECT_TRUE(parser.get<bool>("info"));
  62. EXPECT_TRUE(parser.get<bool>("i"));
  63. EXPECT_TRUE(parser.get<bool>("true"));
  64. EXPECT_TRUE(parser.get<bool>("t"));
  65. EXPECT_FALSE(parser.has("n"));
  66. EXPECT_FALSE(parser.has("unused"));
  67. }
  68. TEST(CommandLineParser, testHas_TrueValues1)
  69. {
  70. const char* argv[] = {"<bin>", "-h=1", "--info=1"};
  71. const int argc = 3;
  72. cv::CommandLineParser parser(argc, argv, keys);
  73. EXPECT_TRUE(parser.has("help"));
  74. EXPECT_TRUE(parser.has("h"));
  75. EXPECT_TRUE(parser.get<bool>("help"));
  76. EXPECT_TRUE(parser.get<bool>("h"));
  77. EXPECT_TRUE(parser.has("info"));
  78. EXPECT_TRUE(parser.has("i"));
  79. EXPECT_TRUE(parser.get<bool>("info"));
  80. EXPECT_TRUE(parser.get<bool>("i"));
  81. EXPECT_TRUE(parser.get<bool>("true"));
  82. EXPECT_TRUE(parser.get<bool>("t"));
  83. EXPECT_FALSE(parser.has("n"));
  84. EXPECT_FALSE(parser.has("unused"));
  85. }
  86. TEST(CommandLineParser, testHas_FalseValues0)
  87. {
  88. const char* argv[] = {"<bin>", "-h=0", "--info=0"};
  89. const int argc = 3;
  90. cv::CommandLineParser parser(argc, argv, keys);
  91. EXPECT_TRUE(parser.has("help"));
  92. EXPECT_TRUE(parser.has("h"));
  93. EXPECT_FALSE(parser.get<bool>("help"));
  94. EXPECT_FALSE(parser.get<bool>("h"));
  95. EXPECT_TRUE(parser.has("info"));
  96. EXPECT_TRUE(parser.has("i"));
  97. EXPECT_FALSE(parser.get<bool>("info"));
  98. EXPECT_FALSE(parser.get<bool>("i"));
  99. EXPECT_TRUE(parser.get<bool>("true"));
  100. EXPECT_TRUE(parser.get<bool>("t"));
  101. EXPECT_FALSE(parser.has("n"));
  102. EXPECT_FALSE(parser.has("unused"));
  103. }
  104. TEST(CommandLineParser, testBoolOption_noArgs)
  105. {
  106. const char* argv[] = {"<bin>"};
  107. const int argc = 1;
  108. cv::CommandLineParser parser(argc, argv, keys);
  109. EXPECT_FALSE(parser.get<bool>("help"));
  110. EXPECT_FALSE(parser.get<bool>("h"));
  111. EXPECT_FALSE(parser.get<bool>("info"));
  112. EXPECT_FALSE(parser.get<bool>("i"));
  113. EXPECT_TRUE(parser.get<bool>("true")); // default is true
  114. EXPECT_TRUE(parser.get<bool>("t"));
  115. }
  116. TEST(CommandLineParser, testBoolOption_noValues)
  117. {
  118. const char* argv[] = {"<bin>", "-h", "--info"};
  119. const int argc = 3;
  120. cv::CommandLineParser parser(argc, argv, keys);
  121. EXPECT_TRUE(parser.get<bool>("help"));
  122. EXPECT_TRUE(parser.get<bool>("h"));
  123. EXPECT_TRUE(parser.get<bool>("info"));
  124. EXPECT_TRUE(parser.get<bool>("i"));
  125. EXPECT_TRUE(parser.get<bool>("true"));
  126. EXPECT_TRUE(parser.get<bool>("t"));
  127. }
  128. TEST(CommandLineParser, testBoolOption_TrueValues)
  129. {
  130. const char* argv[] = {"<bin>", "-h=TrUe", "-t=1", "--info=true", "-n=truE"};
  131. const int argc = 5;
  132. cv::CommandLineParser parser(argc, argv, keys);
  133. EXPECT_TRUE(parser.get<bool>("help"));
  134. EXPECT_TRUE(parser.get<bool>("h"));
  135. EXPECT_TRUE(parser.get<bool>("info"));
  136. EXPECT_TRUE(parser.get<bool>("i"));
  137. EXPECT_TRUE(parser.get<bool>("true"));
  138. EXPECT_TRUE(parser.get<bool>("t"));
  139. EXPECT_TRUE(parser.get<bool>("unused"));
  140. EXPECT_TRUE(parser.get<bool>("n"));
  141. }
  142. TEST(CommandLineParser, testBoolOption_FalseValues)
  143. {
  144. const char* argv[] = {"<bin>", "--help=FALSE", "-t=FaLsE", "-i=false", "-n=0"};
  145. const int argc = 5;
  146. cv::CommandLineParser parser(argc, argv, keys);
  147. EXPECT_FALSE(parser.get<bool>("help"));
  148. EXPECT_FALSE(parser.get<bool>("h"));
  149. EXPECT_FALSE(parser.get<bool>("info"));
  150. EXPECT_FALSE(parser.get<bool>("i"));
  151. EXPECT_FALSE(parser.get<bool>("true"));
  152. EXPECT_FALSE(parser.get<bool>("t"));
  153. EXPECT_FALSE(parser.get<bool>("unused"));
  154. EXPECT_FALSE(parser.get<bool>("n"));
  155. }
  156. static const char * const keys2 =
  157. "{ h help | | print help }"
  158. "{ @arg1 | default1 | param1 }"
  159. "{ @arg2 | | param2 }"
  160. "{ n unused | | dummy }"
  161. ;
  162. TEST(CommandLineParser, testPositional_noArgs)
  163. {
  164. const char* argv[] = {"<bin>"};
  165. const int argc = 1;
  166. cv::CommandLineParser parser(argc, argv, keys2);
  167. EXPECT_TRUE(parser.has("@arg1"));
  168. EXPECT_FALSE(parser.has("@arg2"));
  169. EXPECT_EQ("default1", parser.get<String>("@arg1"));
  170. EXPECT_EQ("default1", parser.get<String>(0));
  171. EXPECT_EQ("", parser.get<String>("@arg2"));
  172. EXPECT_EQ("", parser.get<String>(1));
  173. }
  174. TEST(CommandLineParser, testPositional_default)
  175. {
  176. const char* argv[] = {"<bin>", "test1", "test2"};
  177. const int argc = 3;
  178. cv::CommandLineParser parser(argc, argv, keys2);
  179. EXPECT_TRUE(parser.has("@arg1"));
  180. EXPECT_TRUE(parser.has("@arg2"));
  181. EXPECT_EQ("test1", parser.get<String>("@arg1"));
  182. EXPECT_EQ("test2", parser.get<String>("@arg2"));
  183. EXPECT_EQ("test1", parser.get<String>(0));
  184. EXPECT_EQ("test2", parser.get<String>(1));
  185. }
  186. TEST(CommandLineParser, testPositional_withFlagsBefore)
  187. {
  188. const char* argv[] = {"<bin>", "-h", "test1", "test2"};
  189. const int argc = 4;
  190. cv::CommandLineParser parser(argc, argv, keys2);
  191. EXPECT_TRUE(parser.has("@arg1"));
  192. EXPECT_TRUE(parser.has("@arg2"));
  193. EXPECT_EQ("test1", parser.get<String>("@arg1"));
  194. EXPECT_EQ("test2", parser.get<String>("@arg2"));
  195. EXPECT_EQ("test1", parser.get<String>(0));
  196. EXPECT_EQ("test2", parser.get<String>(1));
  197. }
  198. TEST(CommandLineParser, testPositional_withFlagsAfter)
  199. {
  200. const char* argv[] = {"<bin>", "test1", "test2", "-h"};
  201. const int argc = 4;
  202. cv::CommandLineParser parser(argc, argv, keys2);
  203. EXPECT_TRUE(parser.has("@arg1"));
  204. EXPECT_TRUE(parser.has("@arg2"));
  205. EXPECT_EQ("test1", parser.get<String>("@arg1"));
  206. EXPECT_EQ("test2", parser.get<String>("@arg2"));
  207. EXPECT_EQ("test1", parser.get<String>(0));
  208. EXPECT_EQ("test2", parser.get<String>(1));
  209. }
  210. TEST(CommandLineParser, testEmptyStringValue)
  211. {
  212. static const char * const keys3 =
  213. "{ @pos0 | | empty default value }"
  214. "{ @pos1 | <none> | forbid empty default value }";
  215. const char* argv[] = {"<bin>"};
  216. const int argc = 1;
  217. cv::CommandLineParser parser(argc, argv, keys3);
  218. // EXPECT_TRUE(parser.has("@pos0"));
  219. EXPECT_EQ("", parser.get<String>("@pos0"));
  220. EXPECT_TRUE(parser.check());
  221. EXPECT_FALSE(parser.has("@pos1"));
  222. parser.get<String>(1);
  223. EXPECT_FALSE(parser.check());
  224. }
  225. TEST(CommandLineParser, positional_regression_5074_equal_sign)
  226. {
  227. static const char * const keys3 =
  228. "{ @eq0 | | }"
  229. "{ eq1 | | }";
  230. const char* argv[] = {"<bin>", "1=0", "--eq1=1=0"};
  231. const int argc = 3;
  232. cv::CommandLineParser parser(argc, argv, keys3);
  233. EXPECT_EQ("1=0", parser.get<String>("@eq0"));
  234. EXPECT_EQ("1=0", parser.get<String>(0));
  235. EXPECT_EQ("1=0", parser.get<String>("eq1"));
  236. EXPECT_TRUE(parser.check());
  237. }
  238. TEST(AutoBuffer, allocate_test)
  239. {
  240. AutoBuffer<int, 5> abuf(2);
  241. EXPECT_EQ(2u, abuf.size());
  242. abuf.allocate(4);
  243. EXPECT_EQ(4u, abuf.size());
  244. abuf.allocate(6);
  245. EXPECT_EQ(6u, abuf.size());
  246. }
  247. TEST(CommandLineParser, testScalar)
  248. {
  249. static const char * const keys3 =
  250. "{ s0 | 3 4 5 | default scalar }"
  251. "{ s1 | | single value scalar }"
  252. "{ s2 | | two values scalar (default with zeros) }"
  253. "{ s3 | | three values scalar }"
  254. "{ s4 | | four values scalar }"
  255. "{ s5 | | five values scalar }";
  256. const char* argv[] = {"<bin>", "--s1=1.1", "--s3=1.1 2.2 3",
  257. "--s4=-4.2 1 0 3", "--s5=5 -4 3 2 1"};
  258. const int argc = 5;
  259. CommandLineParser parser(argc, argv, keys3);
  260. EXPECT_EQ(parser.get<Scalar>("s0"), Scalar(3, 4, 5));
  261. EXPECT_EQ(parser.get<Scalar>("s1"), Scalar(1.1));
  262. EXPECT_EQ(parser.get<Scalar>("s2"), Scalar(0));
  263. EXPECT_EQ(parser.get<Scalar>("s3"), Scalar(1.1, 2.2, 3));
  264. EXPECT_EQ(parser.get<Scalar>("s4"), Scalar(-4.2, 1, 0, 3));
  265. EXPECT_EQ(parser.get<Scalar>("s5"), Scalar(5, -4, 3, 2));
  266. }
  267. TEST(Logger, DISABLED_message)
  268. {
  269. int id = 42;
  270. CV_LOG_VERBOSE(NULL, 0, "Verbose message: " << id);
  271. CV_LOG_VERBOSE(NULL, 1, "Verbose message: " << id);
  272. CV_LOG_DEBUG(NULL, "Debug message: " << id);
  273. CV_LOG_INFO(NULL, "Info message: " << id);
  274. CV_LOG_WARNING(NULL, "Warning message: " << id);
  275. CV_LOG_ERROR(NULL, "Error message: " << id);
  276. CV_LOG_FATAL(NULL, "Fatal message: " << id);
  277. }
  278. static int testLoggerMessageOnce(int id)
  279. {
  280. CV_LOG_ONCE_VERBOSE(NULL, 0, "Verbose message: " << id++);
  281. CV_LOG_ONCE_VERBOSE(NULL, 1, "Verbose message: " << id++);
  282. CV_LOG_ONCE_DEBUG(NULL, "Debug message: " << id++);
  283. CV_LOG_ONCE_INFO(NULL, "Info message: " << id++);
  284. CV_LOG_ONCE_WARNING(NULL, "Warning message: " << id++);
  285. CV_LOG_ONCE_ERROR(NULL, "Error message: " << id++);
  286. // doesn't make sense: CV_LOG_ONCE_FATAL
  287. return id;
  288. }
  289. TEST(Logger, DISABLED_message_once)
  290. {
  291. int check_id_first = testLoggerMessageOnce(42);
  292. EXPECT_GT(check_id_first, 42);
  293. int check_id_second = testLoggerMessageOnce(0);
  294. EXPECT_EQ(0, check_id_second);
  295. }
  296. TEST(Logger, DISABLED_message_if)
  297. {
  298. for (int i = 0; i < 100; i++)
  299. {
  300. CV_LOG_IF_VERBOSE(NULL, 0, i == 0 || i == 42, "Verbose message: " << i);
  301. CV_LOG_IF_VERBOSE(NULL, 1, i == 0 || i == 42, "Verbose message: " << i);
  302. CV_LOG_IF_DEBUG(NULL, i == 0 || i == 42, "Debug message: " << i);
  303. CV_LOG_IF_INFO(NULL, i == 0 || i == 42, "Info message: " << i);
  304. CV_LOG_IF_WARNING(NULL, i == 0 || i == 42, "Warning message: " << i);
  305. CV_LOG_IF_ERROR(NULL, i == 0 || i == 42, "Error message: " << i);
  306. CV_LOG_IF_FATAL(NULL, i == 0 || i == 42, "Fatal message: " << i);
  307. }
  308. }
  309. #if OPENCV_HAVE_FILESYSTEM_SUPPORT
  310. TEST(Samples, findFile)
  311. {
  312. cv::utils::logging::LogLevel prev = cv::utils::logging::setLogLevel(cv::utils::logging::LOG_LEVEL_VERBOSE);
  313. cv::String path;
  314. ASSERT_NO_THROW(path = samples::findFile("lena.jpg", false));
  315. EXPECT_NE(std::string(), path.c_str());
  316. cv::utils::logging::setLogLevel(prev);
  317. }
  318. TEST(Samples, findFile_missing)
  319. {
  320. cv::utils::logging::LogLevel prev = cv::utils::logging::setLogLevel(cv::utils::logging::LOG_LEVEL_VERBOSE);
  321. cv::String path;
  322. ASSERT_ANY_THROW(path = samples::findFile("non-existed.file", true));
  323. cv::utils::logging::setLogLevel(prev);
  324. }
  325. #endif // OPENCV_HAVE_FILESYSTEM_SUPPORT
  326. template <typename T>
  327. inline bool buffers_overlap(T * first, size_t first_num, T * second, size_t second_num)
  328. {
  329. // cerr << "[" << (void*)first << " : " << (void*)(first + first_num) << ")";
  330. // cerr << " X ";
  331. // cerr << "[" << (void*)second << " : " << (void*)(second + second_num) << ")";
  332. // cerr << endl;
  333. bool res = false;
  334. res |= (second <= first) && (first < second + second_num);
  335. res |= (second < first + first_num) && (first + first_num < second + second_num);
  336. return res;
  337. }
  338. typedef testing::TestWithParam<bool> BufferArea;
  339. TEST_P(BufferArea, basic)
  340. {
  341. const bool safe = GetParam();
  342. const size_t SZ = 3;
  343. int * int_ptr = NULL;
  344. uchar * uchar_ptr = NULL;
  345. double * dbl_ptr = NULL;
  346. {
  347. cv::utils::BufferArea area(safe);
  348. area.allocate(int_ptr, SZ);
  349. area.allocate(uchar_ptr, SZ);
  350. area.allocate(dbl_ptr, SZ);
  351. area.commit();
  352. ASSERT_TRUE(int_ptr != NULL);
  353. ASSERT_TRUE(uchar_ptr != NULL);
  354. ASSERT_TRUE(dbl_ptr != NULL);
  355. EXPECT_EQ((size_t)0, (size_t)int_ptr % sizeof(int));
  356. EXPECT_EQ((size_t)0, (size_t)dbl_ptr % sizeof(double));
  357. for (size_t i = 0; i < SZ; ++i)
  358. {
  359. int_ptr[i] = (int)i + 1;
  360. uchar_ptr[i] = (uchar)i + 1;
  361. dbl_ptr[i] = (double)i + 1;
  362. }
  363. area.zeroFill(int_ptr);
  364. area.zeroFill(uchar_ptr);
  365. area.zeroFill(dbl_ptr);
  366. for (size_t i = 0; i < SZ; ++i)
  367. {
  368. EXPECT_EQ((int)0, int_ptr[i]);
  369. EXPECT_EQ((uchar)0, uchar_ptr[i]);
  370. EXPECT_EQ((double)0, dbl_ptr[i]);
  371. }
  372. }
  373. EXPECT_TRUE(int_ptr == NULL);
  374. EXPECT_TRUE(uchar_ptr == NULL);
  375. EXPECT_TRUE(dbl_ptr == NULL);
  376. }
  377. TEST_P(BufferArea, align)
  378. {
  379. const bool safe = GetParam();
  380. const size_t SZ = 3;
  381. const size_t CNT = 5;
  382. typedef int T;
  383. T * buffers[CNT] = {0};
  384. {
  385. cv::utils::BufferArea area(safe);
  386. // allocate buffers with 3 elements with growing alignment (power of two)
  387. for (size_t i = 0; i < CNT; ++i)
  388. {
  389. const ushort ALIGN = static_cast<ushort>(sizeof(T) << i);
  390. EXPECT_TRUE(buffers[i] == NULL);
  391. area.allocate(buffers[i], SZ, ALIGN);
  392. }
  393. area.commit();
  394. for (size_t i = 0; i < CNT; ++i)
  395. {
  396. const ushort ALIGN = static_cast<ushort>(sizeof(T) << i);
  397. EXPECT_TRUE(buffers[i] != NULL);
  398. EXPECT_EQ((size_t)0, reinterpret_cast<size_t>(buffers[i]) % ALIGN);
  399. if (i < CNT - 1)
  400. {
  401. SCOPED_TRACE(i);
  402. EXPECT_FALSE(buffers_overlap(buffers[i], SZ, buffers[i + 1], SZ))
  403. << "Buffers overlap: "
  404. << buffers[i] << " (" << SZ << " elems)"
  405. << " and "
  406. << buffers[i + 1] << " (" << SZ << " elems)"
  407. << " (element size: " << sizeof(T) << ")";
  408. }
  409. }
  410. }
  411. for (size_t i = 0; i < CNT; ++i)
  412. {
  413. EXPECT_TRUE(buffers[i] == NULL);
  414. }
  415. }
  416. TEST_P(BufferArea, default_align)
  417. {
  418. const bool safe = GetParam();
  419. const size_t CNT = 100;
  420. const ushort ALIGN = 64;
  421. typedef int T;
  422. T * buffers[CNT] = {0};
  423. {
  424. cv::utils::BufferArea area(safe);
  425. // allocate buffers with 1-99 elements with default alignment
  426. for (size_t i = 0; i < CNT; ++ i)
  427. {
  428. EXPECT_TRUE(buffers[i] == NULL);
  429. area.allocate(buffers[i], i + 1, ALIGN);
  430. }
  431. area.commit();
  432. for (size_t i = 0; i < CNT; ++i)
  433. {
  434. EXPECT_TRUE(buffers[i] != NULL);
  435. EXPECT_EQ((size_t)0, reinterpret_cast<size_t>(buffers[i]) % ALIGN);
  436. if (i < CNT - 1)
  437. {
  438. SCOPED_TRACE(i);
  439. EXPECT_FALSE(buffers_overlap(buffers[i], i + 1, buffers[i + 1], i + 2))
  440. << "Buffers overlap: "
  441. << buffers[i] << " (" << i + 1 << " elems)"
  442. << " and "
  443. << buffers[i + 1] << " (" << i + 2 << " elems)"
  444. << " (element size: " << sizeof(T) << ")";
  445. }
  446. }
  447. }
  448. }
  449. TEST_P(BufferArea, bad)
  450. {
  451. const bool safe = GetParam();
  452. int * ptr = 0;
  453. cv::utils::BufferArea area(safe);
  454. EXPECT_ANY_THROW(area.allocate(ptr, 0)); // bad size
  455. EXPECT_ANY_THROW(area.allocate(ptr, 1, 0)); // bad alignment
  456. EXPECT_ANY_THROW(area.allocate(ptr, 1, 3)); // bad alignment
  457. ptr = (int*)1;
  458. EXPECT_ANY_THROW(area.allocate(ptr, 1)); // non-zero pointer
  459. }
  460. INSTANTIATE_TEST_CASE_P(/**/, BufferArea, testing::Values(true, false));
  461. }} // namespace