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.

100 lines
2.6 KiB

  1. /* /////////////////////////////////////////////////////////////////////////
  2. * File: test/unit/test.unit.levels.values/test.unit.levels.values.c
  3. *
  4. * Purpose: Implementation file for the test.unit.levels.values project.
  5. *
  6. * Created: 29th November 2007
  7. * Updated: 7th December 2010
  8. *
  9. * Status: Wizard-generated
  10. *
  11. * License: (Licensed under the Synesis Software Open License)
  12. *
  13. * Copyright (c) 2007-2010, Synesis Software Pty Ltd.
  14. * All rights reserved.
  15. *
  16. * www: http://www.synesis.com.au/software
  17. *
  18. * ////////////////////////////////////////////////////////////////////// */
  19. #include <pantheios/pantheios.h>
  20. #include <xtests/xtests.h>
  21. #include <stlsoft/stlsoft.h> /* for STLSOFT_NUM_ELEMENTS */
  22. #include <stdio.h> /* for fprintf() */
  23. #include <stdlib.h> /* for EXIT_SUCCESS, EXIT_FAILURE */
  24. static const int s_severityLevels[] =
  25. {
  26. PANTHEIOS_SEV_EMERGENCY
  27. , PANTHEIOS_SEV_ALERT
  28. , PANTHEIOS_SEV_CRITICAL
  29. , PANTHEIOS_SEV_ERROR
  30. , PANTHEIOS_SEV_WARNING
  31. , PANTHEIOS_SEV_NOTICE
  32. , PANTHEIOS_SEV_INFORMATIONAL
  33. , PANTHEIOS_SEV_DEBUG
  34. };
  35. static const int s_severityLevelValues[] =
  36. {
  37. 0
  38. , 1
  39. , 2
  40. , 3
  41. , 4
  42. , 5
  43. , 6
  44. , 7
  45. };
  46. int main(int argc, char** argv)
  47. {
  48. int retCode = EXIT_SUCCESS;
  49. int verbosity = 2;
  50. XTESTS_COMMANDLINE_PARSEVERBOSITY(argc, argv, &verbosity);
  51. STLSOFT_STATIC_ASSERT(STLSOFT_NUM_ELEMENTS(s_severityLevels) == STLSOFT_NUM_ELEMENTS(s_severityLevelValues));
  52. if(XTESTS_START_RUNNER("test.unit.levels.values", verbosity))
  53. {
  54. /* Test-1 */
  55. if(XTESTS_CASE_BEGIN("Test-1", "Severity-level enumerator values"))
  56. {
  57. size_t i;
  58. for(i = 0; i != STLSOFT_NUM_ELEMENTS(s_severityLevels); ++i)
  59. {
  60. XTESTS_TEST_INTEGER_EQUAL(s_severityLevels[i], s_severityLevelValues[i]);
  61. }
  62. XTESTS_CASE_END("Test-1");
  63. }
  64. /* Test-2 */
  65. if(XTESTS_CASE_BEGIN("Test-2", "Severity-level enumerator values"))
  66. {
  67. size_t i;
  68. for(i = 0; i != STLSOFT_NUM_ELEMENTS(s_severityLevels); ++i)
  69. {
  70. XTESTS_TEST_INTEGER_EQUAL(s_severityLevels[i], s_severityLevelValues[i]);
  71. }
  72. XTESTS_CASE_END("Test-2");
  73. }
  74. XTESTS_PRINT_RESULTS();
  75. XTESTS_END_RUNNER_UPDATE_EXITCODE(&retCode);
  76. }
  77. return retCode;
  78. }
  79. /* ////////////////////////////////////////////////////////////////////// */