You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

711 lines
15 KiB

  1. /* /////////////////////////////////////////////////////////////////////////
  2. * File: test/component/test.component.inserters.m2w/test.component.inserters.m2w.cpp
  3. *
  4. * Purpose: Implementation file for the test.component.inserters.m2w project.
  5. *
  6. * Created: 22nd November 2010
  7. * Updated: 22nd November 2010
  8. *
  9. * Status: Wizard-generated
  10. *
  11. * License: (Licensed under the Synesis Software Open License)
  12. *
  13. * Copyright (c) 2010, Synesis Software Pty Ltd.
  14. * All rights reserved.
  15. *
  16. * www: http://www.synesis.com.au/software
  17. *
  18. * ////////////////////////////////////////////////////////////////////// */
  19. #define PANTHEIOS_NO_INCLUDE_OS_AND_3PTYLIB_STRING_ACCESS
  20. #include <pantheios/util/test/compiler_warnings_suppression.first_include.h>
  21. /* xTests Header Files */
  22. #include <xtests/xtests.h>
  23. /* Pantheios Header Files */
  24. #include <pantheios/pantheios.h>
  25. #ifndef PANTHEIOS_USE_WIDE_STRINGS
  26. # error This program source only valid in wide string builds
  27. #endif /* !PANTHEIOS_USE_WIDE_STRINGS */
  28. #include <stlsoft/string/simple_string.hpp>
  29. #include <pantheios/pantheios.hpp> // Pantheios C++ main header
  30. #include <pantheios/inserters/m2w.hpp> // for pantheios::m2w
  31. #include <pantheios/backends/bec.test.h>
  32. /* STLSoft Header Files */
  33. #include <stlsoft/util/limit_traits.h>
  34. #include <stlsoft/string/simple_string.hpp>
  35. /* Standard C++ Header Files */
  36. #include <exception>
  37. #include <string>
  38. /* Standard C Header Files */
  39. #include <stdio.h>
  40. #include <stdlib.h>
  41. #include <pantheios/util/test/compiler_warnings_suppression.last_include.h>
  42. /* /////////////////////////////////////////////////////////////////////////
  43. * Forward declarations
  44. */
  45. static void test_1_01();
  46. static void test_1_02();
  47. static void test_1_03();
  48. static void test_1_04();
  49. static void test_1_05();
  50. static void test_1_06();
  51. static void test_1_07();
  52. static void test_1_08();
  53. static void test_1_09();
  54. static void test_2_01();
  55. static void test_2_02();
  56. static void test_2_03();
  57. static void test_2_04();
  58. static void test_2_05();
  59. static void test_2_06();
  60. static void test_2_07();
  61. static void test_2_08();
  62. static void test_2_09();
  63. static void test_3_01();
  64. static void test_3_02();
  65. static void test_3_03();
  66. static void test_3_04();
  67. static void test_3_05();
  68. static void test_3_06();
  69. static void test_3_07();
  70. static void test_3_08();
  71. static void test_3_09();
  72. /* /////////////////////////////////////////////////////////////////////////
  73. * Globals
  74. */
  75. PANTHEIOS_EXTERN_C const PAN_CHAR_T PANTHEIOS_FE_PROCESS_IDENTITY[] = L"test.component.inserters.m2w";
  76. /* ////////////////////////////////////////////////////////////////////// */
  77. int main(int argc, char** argv)
  78. {
  79. int retCode = EXIT_SUCCESS;
  80. int verbosity = 2;
  81. XTESTS_COMMANDLINE_PARSEVERBOSITY(argc, argv, &verbosity);
  82. if(XTESTS_START_RUNNER("test.component.inserters.m2w", verbosity))
  83. {
  84. XTESTS_RUN_CASE(test_1_01);
  85. XTESTS_RUN_CASE(test_1_02);
  86. XTESTS_RUN_CASE(test_1_03);
  87. XTESTS_RUN_CASE(test_1_04);
  88. XTESTS_RUN_CASE(test_1_05);
  89. XTESTS_RUN_CASE(test_1_06);
  90. XTESTS_RUN_CASE(test_1_07);
  91. XTESTS_RUN_CASE(test_1_08);
  92. XTESTS_RUN_CASE(test_1_09);
  93. XTESTS_RUN_CASE(test_2_01);
  94. XTESTS_RUN_CASE(test_2_02);
  95. XTESTS_RUN_CASE(test_2_03);
  96. XTESTS_RUN_CASE(test_2_04);
  97. XTESTS_RUN_CASE(test_2_05);
  98. XTESTS_RUN_CASE(test_2_06);
  99. XTESTS_RUN_CASE(test_2_07);
  100. XTESTS_RUN_CASE(test_2_08);
  101. XTESTS_RUN_CASE(test_2_09);
  102. XTESTS_RUN_CASE(test_3_01);
  103. XTESTS_RUN_CASE(test_3_02);
  104. XTESTS_RUN_CASE(test_3_03);
  105. XTESTS_RUN_CASE(test_3_04);
  106. XTESTS_RUN_CASE(test_3_05);
  107. XTESTS_RUN_CASE(test_3_06);
  108. XTESTS_RUN_CASE(test_3_07);
  109. XTESTS_RUN_CASE(test_3_08);
  110. XTESTS_RUN_CASE(test_3_09);
  111. XTESTS_PRINT_RESULTS();
  112. XTESTS_END_RUNNER_UPDATE_EXITCODE(&retCode);
  113. }
  114. return retCode;
  115. }
  116. /* ////////////////////////////////////////////////////////////////////// */
  117. static void test_1_01()
  118. {
  119. // 1. Setup
  120. pantheios::be::test::reset();
  121. // 2. Create test data
  122. pantheios::log_NOTICE(pantheios::m2w(""));
  123. // 3. Verification
  124. pantheios::be::test::Results results = pantheios::be::test::results();
  125. XTESTS_TEST(!results.empty());
  126. XTESTS_TEST_INTEGER_EQUAL(1u, results.size());
  127. XTESTS_TEST_WIDE_STRING_EQUAL(L"", results[0].statement);
  128. }
  129. static void test_1_02()
  130. {
  131. // 1. Setup
  132. pantheios::be::test::reset();
  133. // 2. Create test data
  134. pantheios::log_NOTICE(pantheios::m2w("a"));
  135. // 3. Verification
  136. pantheios::be::test::Results results = pantheios::be::test::results();
  137. XTESTS_TEST(!results.empty());
  138. XTESTS_TEST_INTEGER_EQUAL(1u, results.size());
  139. XTESTS_TEST_WIDE_STRING_EQUAL(L"a", results[0].statement);
  140. }
  141. static void test_1_03()
  142. {
  143. // 1. Setup
  144. pantheios::be::test::reset();
  145. // 2. Create test data
  146. pantheios::log_NOTICE(L"[", pantheios::m2w("abc"), L"]");
  147. // 3. Verification
  148. pantheios::be::test::Results results = pantheios::be::test::results();
  149. XTESTS_TEST(!results.empty());
  150. XTESTS_TEST_INTEGER_EQUAL(1u, results.size());
  151. XTESTS_TEST_WIDE_STRING_EQUAL(L"[abc]", results[0].statement);
  152. }
  153. static void test_1_04()
  154. {
  155. // 1. Setup
  156. pantheios::be::test::reset();
  157. // 2. Create test data
  158. pantheios::log_NOTICE(pantheios::m2w(""));
  159. // 3. Verification
  160. pantheios::be::test::Results results = pantheios::be::test::results();
  161. XTESTS_TEST(!results.empty());
  162. XTESTS_TEST_INTEGER_EQUAL(1u, results.size());
  163. XTESTS_TEST_WIDE_STRING_EQUAL(L"", results[0].statement);
  164. }
  165. static void test_1_05()
  166. {
  167. // 1. Setup
  168. pantheios::be::test::reset();
  169. // 2. Create test data
  170. pantheios::log_NOTICE(pantheios::m2w(""));
  171. // 3. Verification
  172. pantheios::be::test::Results results = pantheios::be::test::results();
  173. XTESTS_TEST(!results.empty());
  174. XTESTS_TEST_INTEGER_EQUAL(1u, results.size());
  175. XTESTS_TEST_WIDE_STRING_EQUAL(L"", results[0].statement);
  176. }
  177. static void test_1_06()
  178. {
  179. // 1. Setup
  180. pantheios::be::test::reset();
  181. // 2. Create test data
  182. pantheios::log_NOTICE(pantheios::m2w(""));
  183. // 3. Verification
  184. pantheios::be::test::Results results = pantheios::be::test::results();
  185. XTESTS_TEST(!results.empty());
  186. XTESTS_TEST_INTEGER_EQUAL(1u, results.size());
  187. XTESTS_TEST_WIDE_STRING_EQUAL(L"", results[0].statement);
  188. }
  189. static void test_1_07()
  190. {
  191. // 1. Setup
  192. pantheios::be::test::reset();
  193. // 2. Create test data
  194. pantheios::log_NOTICE(pantheios::m2w(""));
  195. // 3. Verification
  196. pantheios::be::test::Results results = pantheios::be::test::results();
  197. XTESTS_TEST(!results.empty());
  198. XTESTS_TEST_INTEGER_EQUAL(1u, results.size());
  199. XTESTS_TEST_WIDE_STRING_EQUAL(L"", results[0].statement);
  200. }
  201. static void test_1_08()
  202. {
  203. // 1. Setup
  204. pantheios::be::test::reset();
  205. // 2. Create test data
  206. pantheios::log_NOTICE(pantheios::m2w(""));
  207. // 3. Verification
  208. pantheios::be::test::Results results = pantheios::be::test::results();
  209. XTESTS_TEST(!results.empty());
  210. XTESTS_TEST_INTEGER_EQUAL(1u, results.size());
  211. XTESTS_TEST_WIDE_STRING_EQUAL(L"", results[0].statement);
  212. }
  213. static void test_1_09()
  214. {
  215. // 1. Setup
  216. pantheios::be::test::reset();
  217. // 2. Create test data
  218. pantheios::log_NOTICE(pantheios::m2w(""));
  219. // 3. Verification
  220. pantheios::be::test::Results results = pantheios::be::test::results();
  221. XTESTS_TEST(!results.empty());
  222. XTESTS_TEST_INTEGER_EQUAL(1u, results.size());
  223. XTESTS_TEST_WIDE_STRING_EQUAL(L"", results[0].statement);
  224. }
  225. static void test_2_01()
  226. {
  227. // 1. Setup
  228. pantheios::be::test::reset();
  229. // 2. Create test data
  230. pantheios::log_NOTICE(pantheios::m2w(std::string("")));
  231. // 3. Verification
  232. pantheios::be::test::Results results = pantheios::be::test::results();
  233. XTESTS_TEST(!results.empty());
  234. XTESTS_TEST_INTEGER_EQUAL(1u, results.size());
  235. XTESTS_TEST_WIDE_STRING_EQUAL(L"", results[0].statement);
  236. }
  237. static void test_2_02()
  238. {
  239. // 1. Setup
  240. pantheios::be::test::reset();
  241. // 2. Create test data
  242. pantheios::log_NOTICE(pantheios::m2w(std::string("a")));
  243. // 3. Verification
  244. pantheios::be::test::Results results = pantheios::be::test::results();
  245. XTESTS_TEST(!results.empty());
  246. XTESTS_TEST_INTEGER_EQUAL(1u, results.size());
  247. XTESTS_TEST_WIDE_STRING_EQUAL(L"a", results[0].statement);
  248. }
  249. static void test_2_03()
  250. {
  251. // 1. Setup
  252. pantheios::be::test::reset();
  253. // 2. Create test data
  254. pantheios::log_NOTICE(L"[", pantheios::m2w(std::string("abc")), L"]");
  255. // 3. Verification
  256. pantheios::be::test::Results results = pantheios::be::test::results();
  257. XTESTS_TEST(!results.empty());
  258. XTESTS_TEST_INTEGER_EQUAL(1u, results.size());
  259. XTESTS_TEST_WIDE_STRING_EQUAL(L"[abc]", results[0].statement);
  260. }
  261. static void test_2_04()
  262. {
  263. // 1. Setup
  264. pantheios::be::test::reset();
  265. // 2. Create test data
  266. pantheios::log_NOTICE(pantheios::m2w(std::string("")));
  267. // 3. Verification
  268. pantheios::be::test::Results results = pantheios::be::test::results();
  269. XTESTS_TEST(!results.empty());
  270. XTESTS_TEST_INTEGER_EQUAL(1u, results.size());
  271. XTESTS_TEST_WIDE_STRING_EQUAL(L"", results[0].statement);
  272. }
  273. static void test_2_05()
  274. {
  275. // 1. Setup
  276. pantheios::be::test::reset();
  277. // 2. Create test data
  278. pantheios::log_NOTICE(pantheios::m2w(std::string("")));
  279. // 3. Verification
  280. pantheios::be::test::Results results = pantheios::be::test::results();
  281. XTESTS_TEST(!results.empty());
  282. XTESTS_TEST_INTEGER_EQUAL(1u, results.size());
  283. XTESTS_TEST_WIDE_STRING_EQUAL(L"", results[0].statement);
  284. }
  285. static void test_2_06()
  286. {
  287. // 1. Setup
  288. pantheios::be::test::reset();
  289. // 2. Create test data
  290. pantheios::log_NOTICE(pantheios::m2w(std::string("")));
  291. // 3. Verification
  292. pantheios::be::test::Results results = pantheios::be::test::results();
  293. XTESTS_TEST(!results.empty());
  294. XTESTS_TEST_INTEGER_EQUAL(1u, results.size());
  295. XTESTS_TEST_WIDE_STRING_EQUAL(L"", results[0].statement);
  296. }
  297. static void test_2_07()
  298. {
  299. // 1. Setup
  300. pantheios::be::test::reset();
  301. // 2. Create test data
  302. pantheios::log_NOTICE(pantheios::m2w(std::string("")));
  303. // 3. Verification
  304. pantheios::be::test::Results results = pantheios::be::test::results();
  305. XTESTS_TEST(!results.empty());
  306. XTESTS_TEST_INTEGER_EQUAL(1u, results.size());
  307. XTESTS_TEST_WIDE_STRING_EQUAL(L"", results[0].statement);
  308. }
  309. static void test_2_08()
  310. {
  311. // 1. Setup
  312. pantheios::be::test::reset();
  313. // 2. Create test data
  314. pantheios::log_NOTICE(pantheios::m2w(std::string("")));
  315. // 3. Verification
  316. pantheios::be::test::Results results = pantheios::be::test::results();
  317. XTESTS_TEST(!results.empty());
  318. XTESTS_TEST_INTEGER_EQUAL(1u, results.size());
  319. XTESTS_TEST_WIDE_STRING_EQUAL(L"", results[0].statement);
  320. }
  321. static void test_2_09()
  322. {
  323. // 1. Setup
  324. pantheios::be::test::reset();
  325. // 2. Create test data
  326. pantheios::log_NOTICE(pantheios::m2w(std::string("")));
  327. // 3. Verification
  328. pantheios::be::test::Results results = pantheios::be::test::results();
  329. XTESTS_TEST(!results.empty());
  330. XTESTS_TEST_INTEGER_EQUAL(1u, results.size());
  331. XTESTS_TEST_WIDE_STRING_EQUAL(L"", results[0].statement);
  332. }
  333. static void test_3_01()
  334. {
  335. // 1. Setup
  336. pantheios::be::test::reset();
  337. // 2. Create test data
  338. pantheios::log_NOTICE(pantheios::m2w(stlsoft::simple_string("")));
  339. // 3. Verification
  340. pantheios::be::test::Results results = pantheios::be::test::results();
  341. XTESTS_TEST(!results.empty());
  342. XTESTS_TEST_INTEGER_EQUAL(1u, results.size());
  343. XTESTS_TEST_WIDE_STRING_EQUAL(L"", results[0].statement);
  344. }
  345. static void test_3_02()
  346. {
  347. // 1. Setup
  348. pantheios::be::test::reset();
  349. // 2. Create test data
  350. pantheios::log_NOTICE(pantheios::m2w(stlsoft::simple_string("a")));
  351. // 3. Verification
  352. pantheios::be::test::Results results = pantheios::be::test::results();
  353. XTESTS_TEST(!results.empty());
  354. XTESTS_TEST_INTEGER_EQUAL(1u, results.size());
  355. XTESTS_TEST_WIDE_STRING_EQUAL(L"a", results[0].statement);
  356. }
  357. static void test_3_03()
  358. {
  359. // 1. Setup
  360. pantheios::be::test::reset();
  361. // 2. Create test data
  362. pantheios::log_NOTICE(L"[", pantheios::m2w(stlsoft::simple_string("abc")), L"]");
  363. // 3. Verification
  364. pantheios::be::test::Results results = pantheios::be::test::results();
  365. XTESTS_TEST(!results.empty());
  366. XTESTS_TEST_INTEGER_EQUAL(1u, results.size());
  367. XTESTS_TEST_WIDE_STRING_EQUAL(L"[abc]", results[0].statement);
  368. }
  369. static void test_3_04()
  370. {
  371. // 1. Setup
  372. pantheios::be::test::reset();
  373. // 2. Create test data
  374. pantheios::log_NOTICE(pantheios::m2w(stlsoft::simple_string("")));
  375. // 3. Verification
  376. pantheios::be::test::Results results = pantheios::be::test::results();
  377. XTESTS_TEST(!results.empty());
  378. XTESTS_TEST_INTEGER_EQUAL(1u, results.size());
  379. XTESTS_TEST_WIDE_STRING_EQUAL(L"", results[0].statement);
  380. }
  381. static void test_3_05()
  382. {
  383. // 1. Setup
  384. pantheios::be::test::reset();
  385. // 2. Create test data
  386. pantheios::log_NOTICE(pantheios::m2w(stlsoft::simple_string("")));
  387. // 3. Verification
  388. pantheios::be::test::Results results = pantheios::be::test::results();
  389. XTESTS_TEST(!results.empty());
  390. XTESTS_TEST_INTEGER_EQUAL(1u, results.size());
  391. XTESTS_TEST_WIDE_STRING_EQUAL(L"", results[0].statement);
  392. }
  393. static void test_3_06()
  394. {
  395. // 1. Setup
  396. pantheios::be::test::reset();
  397. // 2. Create test data
  398. pantheios::log_NOTICE(pantheios::m2w(stlsoft::simple_string("")));
  399. // 3. Verification
  400. pantheios::be::test::Results results = pantheios::be::test::results();
  401. XTESTS_TEST(!results.empty());
  402. XTESTS_TEST_INTEGER_EQUAL(1u, results.size());
  403. XTESTS_TEST_WIDE_STRING_EQUAL(L"", results[0].statement);
  404. }
  405. static void test_3_07()
  406. {
  407. // 1. Setup
  408. pantheios::be::test::reset();
  409. // 2. Create test data
  410. pantheios::log_NOTICE(pantheios::m2w(stlsoft::simple_string("")));
  411. // 3. Verification
  412. pantheios::be::test::Results results = pantheios::be::test::results();
  413. XTESTS_TEST(!results.empty());
  414. XTESTS_TEST_INTEGER_EQUAL(1u, results.size());
  415. XTESTS_TEST_WIDE_STRING_EQUAL(L"", results[0].statement);
  416. }
  417. static void test_3_08()
  418. {
  419. // 1. Setup
  420. pantheios::be::test::reset();
  421. // 2. Create test data
  422. pantheios::log_NOTICE(pantheios::m2w(stlsoft::simple_string("")));
  423. // 3. Verification
  424. pantheios::be::test::Results results = pantheios::be::test::results();
  425. XTESTS_TEST(!results.empty());
  426. XTESTS_TEST_INTEGER_EQUAL(1u, results.size());
  427. XTESTS_TEST_WIDE_STRING_EQUAL(L"", results[0].statement);
  428. }
  429. static void test_3_09()
  430. {
  431. // 1. Setup
  432. pantheios::be::test::reset();
  433. // 2. Create test data
  434. pantheios::log_NOTICE(pantheios::m2w(stlsoft::simple_string("")));
  435. // 3. Verification
  436. pantheios::be::test::Results results = pantheios::be::test::results();
  437. XTESTS_TEST(!results.empty());
  438. XTESTS_TEST_INTEGER_EQUAL(1u, results.size());
  439. XTESTS_TEST_WIDE_STRING_EQUAL(L"", results[0].statement);
  440. }
  441. /* ///////////////////////////// end of file //////////////////////////// */