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.

174 lines
3.8 KiB

  1. /* /////////////////////////////////////////////////////////////////////////
  2. * File: test/unit/inserters/test.unit.inserter.w2m/test.unit.inserter.w2m.cpp
  3. *
  4. * Purpose: Implementation file for the test.unit.inserter.w2m project.
  5. *
  6. * Created: 21st December 2010
  7. * Updated: 6th August 2012
  8. *
  9. * Status: Wizard-generated
  10. *
  11. * License: (Licensed under the Synesis Software Open License)
  12. *
  13. * Copyright (c) 2010-2012, Synesis Software Pty Ltd.
  14. * All rights reserved.
  15. *
  16. * www: http://www.synesis.com.au/software
  17. *
  18. * ////////////////////////////////////////////////////////////////////// */
  19. #include <pantheios/util/test/compiler_warnings_suppression.first_include.h>
  20. #include <pantheios/pantheios.h>
  21. #ifdef PANTHEIOS_USE_WIDE_STRINGS
  22. # error This project only valid in multibyte-string builds
  23. #endif
  24. #include <pantheios/inserters/w2m.hpp>
  25. #include <xtests/xtests.h>
  26. #include <stlsoft/conversion/char_conversions.hpp>
  27. #include <stlsoft/shims/access/string.hpp>
  28. #include <stlsoft/util/limit_traits.h>
  29. #include <stlsoft/util/minmax.hpp>
  30. #include <pantheios/util/test/compiler_warnings_suppression.last_include.h>
  31. /* /////////////////////////////////////////////////////////////////////////
  32. * Forward declarations
  33. */
  34. namespace
  35. {
  36. static void test_1_01();
  37. static void test_1_02();
  38. static void test_1_03();
  39. static void test_1_04();
  40. static void test_1_05();
  41. static void test_1_06();
  42. static void test_1_07();
  43. static void test_1_08();
  44. static void test_1_09();
  45. static void test_1_10();
  46. static void test_1_11();
  47. static void test_1_12();
  48. } // anonymous namespace
  49. /* ////////////////////////////////////////////////////////////////////// */
  50. PANTHEIOS_EXTERN_C PAN_CHAR_T const PANTHEIOS_FE_PROCESS_IDENTITY[] = PANTHEIOS_LITERAL_STRING("test.unit.inserter.w2m");
  51. /* ////////////////////////////////////////////////////////////////////// */
  52. int main(int argc, char** argv)
  53. {
  54. int retCode = EXIT_SUCCESS;
  55. int verbosity = 2;
  56. XTESTS_COMMANDLINE_PARSEVERBOSITY(argc, argv, &verbosity);
  57. if(XTESTS_START_RUNNER("test.unit.inserter.w2m", verbosity))
  58. {
  59. XTESTS_RUN_CASE(test_1_01);
  60. XTESTS_RUN_CASE(test_1_02);
  61. XTESTS_RUN_CASE(test_1_03);
  62. XTESTS_RUN_CASE(test_1_04);
  63. XTESTS_RUN_CASE(test_1_05);
  64. XTESTS_RUN_CASE(test_1_06);
  65. XTESTS_RUN_CASE(test_1_07);
  66. XTESTS_RUN_CASE(test_1_08);
  67. XTESTS_RUN_CASE(test_1_09);
  68. XTESTS_RUN_CASE(test_1_10);
  69. XTESTS_RUN_CASE(test_1_11);
  70. XTESTS_RUN_CASE(test_1_12);
  71. XTESTS_PRINT_RESULTS();
  72. XTESTS_END_RUNNER_UPDATE_EXITCODE(&retCode);
  73. }
  74. return retCode;
  75. }
  76. /* ////////////////////////////////////////////////////////////////////// */
  77. namespace
  78. {
  79. wchar_t const* strings[] =
  80. {
  81. L""
  82. , L"a"
  83. , L"ab"
  84. , L"abc"
  85. , L"abcd"
  86. , L"abcde"
  87. , L"abcdef"
  88. , L"abcdefghijklmnopqrstuvwxyz"
  89. , L"abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789"
  90. };
  91. inline size_t get_min_max(size_t minLen, size_t maxLen)
  92. {
  93. return pantheios::pan_slice_t::get_lazy_length(minLen, maxLen);
  94. }
  95. static void test_1_01()
  96. {
  97. { for(size_t i = 0; i != STLSOFT_NUM_ELEMENTS(strings); ++i)
  98. {
  99. XTESTS_TEST_MULTIBYTE_STRING_EQUAL(stlsoft::w2m(strings[i]), pantheios::w2m(strings[i]));
  100. }}
  101. }
  102. static void test_1_02()
  103. {
  104. }
  105. static void test_1_03()
  106. {
  107. }
  108. static void test_1_04()
  109. {
  110. }
  111. static void test_1_05()
  112. {
  113. }
  114. static void test_1_06()
  115. {
  116. }
  117. static void test_1_07()
  118. {
  119. }
  120. static void test_1_08()
  121. {
  122. }
  123. static void test_1_09()
  124. {
  125. }
  126. static void test_1_10()
  127. {
  128. }
  129. static void test_1_11()
  130. {
  131. }
  132. static void test_1_12()
  133. {
  134. }
  135. } // anonymous namespace
  136. /* ////////////////////////////////////////////////////////////////////// */