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.

189 lines
4.7 KiB

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