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.

202 lines
4.8 KiB

  1. /* /////////////////////////////////////////////////////////////////////////
  2. * File: test/component/test.component.custom_severity/test.component.custom_severity.cpp
  3. *
  4. * Purpose: Implementation file for the test.component.custom_severity project.
  5. *
  6. * Created: 31st October 2005
  7. * Updated: 6th August 2012
  8. *
  9. * Status: Wizard-generated
  10. *
  11. * License: (Licensed under the Synesis Software Open License)
  12. *
  13. * Copyright (c) 2005-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. /* xTests Header Files */
  21. #include <xtests/xtests.h>
  22. /* Pantheios Header Files */
  23. #include <pantheios/pantheios.hpp>
  24. #include <pantheios/backends/bec.test.h>
  25. /* Standard C++ Header Files */
  26. #include <exception>
  27. /* Standard C Header Files */
  28. #include <stdio.h>
  29. #include <stdlib.h>
  30. #include <pantheios/util/test/compiler_warnings_suppression.last_include.h>
  31. /* /////////////////////////////////////////////////////////////////////////
  32. * Macros
  33. */
  34. #define PANTHEIOS_SEV_LEVELS_EQUAL(x, y) XTESTS_TEST_INTEGER_EQUAL(static_cast<int>(x), static_cast<int>(y))
  35. /* ////////////////////////////////////////////////////////////////////// */
  36. #define PSTR(x) PANTHEIOS_LITERAL_STRING(x)
  37. /* /////////////////////////////////////////////////////////////////////////
  38. * Character encoding
  39. */
  40. #ifdef PANTHEIOS_USE_WIDE_STRINGS
  41. # define XTESTS_TEST_STRING_EQUAL XTESTS_TEST_WIDE_STRING_EQUAL
  42. #else /* ? PANTHEIOS_USE_WIDE_STRINGS */
  43. # define XTESTS_TEST_STRING_EQUAL XTESTS_TEST_MULTIBYTE_STRING_EQUAL
  44. #endif /* PANTHEIOS_USE_WIDE_STRINGS */
  45. /* /////////////////////////////////////////////////////////////////////////
  46. * Forward declarations
  47. */
  48. static void test_1_01();
  49. static void test_1_02();
  50. static void test_1_03();
  51. static void test_1_04();
  52. static void test_1_05();
  53. static void test_1_06();
  54. static void test_1_07();
  55. static void test_1_08();
  56. static void test_1_09();
  57. /* /////////////////////////////////////////////////////////////////////////
  58. * Globals
  59. */
  60. PANTHEIOS_EXTERN_C PAN_CHAR_T const PANTHEIOS_FE_PROCESS_IDENTITY[] = PANTHEIOS_LITERAL_STRING("test.component.custom_severity");
  61. int main(int argc, char** argv)
  62. {
  63. int retCode = EXIT_SUCCESS;
  64. int verbosity = 2;
  65. XTESTS_COMMANDLINE_PARSEVERBOSITY(argc, argv, &verbosity);
  66. if(XTESTS_START_RUNNER("test.component.custom_severity", verbosity))
  67. {
  68. XTESTS_RUN_CASE(test_1_01);
  69. XTESTS_RUN_CASE(test_1_02);
  70. XTESTS_RUN_CASE(test_1_03);
  71. XTESTS_RUN_CASE(test_1_04);
  72. XTESTS_RUN_CASE(test_1_05);
  73. XTESTS_RUN_CASE(test_1_06);
  74. XTESTS_RUN_CASE(test_1_07);
  75. XTESTS_RUN_CASE(test_1_08);
  76. XTESTS_RUN_CASE(test_1_09);
  77. XTESTS_PRINT_RESULTS();
  78. XTESTS_END_RUNNER_UPDATE_EXITCODE(&retCode);
  79. }
  80. return retCode;
  81. }
  82. /* ////////////////////////////////////////////////////////////////////// */
  83. static void test_1_01()
  84. {
  85. // 1. Setup
  86. pantheios::be::test::reset();
  87. // 2. Create test data
  88. pantheios::log(pantheios::notice, PSTR("abc"));
  89. // 3. Verification
  90. pantheios::be::test::Results results = pantheios::be::test::results();
  91. XTESTS_TEST(!results.empty());
  92. XTESTS_TEST(1 == results.size());
  93. XTESTS_TEST_STRING_EQUAL(PSTR("abc"), results[0].statement);
  94. PANTHEIOS_SEV_LEVELS_EQUAL(PANTHEIOS_SEV_NOTICE, results[0].severity);
  95. }
  96. static void test_1_02()
  97. {
  98. // 1. Setup
  99. pantheios::be::test::reset();
  100. // 2. Create test data
  101. pantheios::log(pantheios::notice(1), PSTR("abc"));
  102. // 3. Verification
  103. pantheios::be::test::Results results = pantheios::be::test::results();
  104. XTESTS_TEST(!results.empty());
  105. XTESTS_TEST(1 == results.size());
  106. XTESTS_TEST_STRING_EQUAL(PSTR("abc"), results[0].statement);
  107. PANTHEIOS_SEV_LEVELS_EQUAL(PANTHEIOS_SEV_NOTICE | (1 << 4), results[0].severity);
  108. }
  109. static void test_1_03()
  110. {
  111. // 1. Setup
  112. pantheios::be::test::reset();
  113. // 2. Create test data
  114. pantheios::log(pantheios::notice(0x01234567), PSTR("abc"));
  115. // 3. Verification
  116. pantheios::be::test::Results results = pantheios::be::test::results();
  117. XTESTS_TEST(!results.empty());
  118. XTESTS_TEST(1 == results.size());
  119. XTESTS_TEST_STRING_EQUAL(PSTR("abc"), results[0].statement);
  120. PANTHEIOS_SEV_LEVELS_EQUAL(PANTHEIOS_SEV_NOTICE | (0x01234567 << 4), results[0].severity);
  121. }
  122. static void test_1_04()
  123. {
  124. }
  125. static void test_1_05()
  126. {
  127. }
  128. static void test_1_06()
  129. {
  130. }
  131. static void test_1_07()
  132. {
  133. }
  134. static void test_1_08()
  135. {
  136. }
  137. static void test_1_09()
  138. {
  139. }
  140. /* ///////////////////////////// end of file //////////////////////////// */