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.

125 lines
3.0 KiB

  1. /* /////////////////////////////////////////////////////////////////////////
  2. * File: test/unit/test.unit.getversion/test.unit.getversion.c
  3. *
  4. * Purpose: Implementation file for the test.unit.getversion project.
  5. *
  6. * Created: 28th August 2008
  7. * Updated: 10th January 2011
  8. *
  9. * Status: Wizard-generated
  10. *
  11. * License: (Licensed under the Synesis Software Open License)
  12. *
  13. * Copyright (c) 2008-2011, Synesis Software Pty Ltd.
  14. * All rights reserved.
  15. *
  16. * www: http://www.synesis.com.au/software
  17. *
  18. * ////////////////////////////////////////////////////////////////////// */
  19. /* /////////////////////////////////////////////////////////////////////////
  20. * Test component header file include(s)
  21. */
  22. #include <pantheios/pantheios.h>
  23. /* /////////////////////////////////////////////////////////////////////////
  24. * Includes
  25. */
  26. /* xTests Header Files */
  27. #include <xtests/xtests.h>
  28. /* STLSoft Header Files */
  29. #include <stlsoft/stlsoft.h>
  30. /* Standard C Header Files */
  31. #include <stdlib.h>
  32. /* /////////////////////////////////////////////////////////////////////////
  33. * Forward declarations
  34. */
  35. static void test_signature(void);
  36. static void test_call(void);
  37. static void test_version(void);
  38. static void test_major(void);
  39. static void test_minor(void);
  40. static void test_revision(void);
  41. /* /////////////////////////////////////////////////////////////////////////
  42. * Main
  43. */
  44. int main(int argc, char **argv)
  45. {
  46. int retCode = EXIT_SUCCESS;
  47. int verbosity = 2;
  48. XTESTS_COMMANDLINE_PARSEVERBOSITY(argc, argv, &verbosity);
  49. if(XTESTS_START_RUNNER("test.unit.getversion", verbosity))
  50. {
  51. XTESTS_RUN_CASE(test_signature);
  52. XTESTS_RUN_CASE(test_call);
  53. XTESTS_RUN_CASE(test_version);
  54. XTESTS_RUN_CASE(test_major);
  55. XTESTS_RUN_CASE(test_minor);
  56. XTESTS_RUN_CASE(test_revision);
  57. XTESTS_PRINT_RESULTS();
  58. XTESTS_END_RUNNER_UPDATE_EXITCODE(&retCode);
  59. }
  60. return retCode;
  61. }
  62. /* /////////////////////////////////////////////////////////////////////////
  63. * Test function implementations
  64. */
  65. static void test_signature()
  66. {
  67. // pan_uint32_t (PANTHEIOS_CALL *pfn)(void) = pantheios_getVersion;
  68. XTESTS_TEST_PASSED();
  69. }
  70. static void test_call()
  71. {
  72. pantheios_getVersion();
  73. XTESTS_TEST_PASSED();
  74. }
  75. static void test_version()
  76. {
  77. pan_uint32_t ver = pantheios_getVersion();
  78. XTESTS_TEST_INTEGER_EQUAL(PANTHEIOS_VER, ver);
  79. }
  80. static void test_major()
  81. {
  82. pan_uint32_t verMajor = (pantheios_getVersion() & 0xff000000) >> 24;
  83. XTESTS_TEST_INTEGER_EQUAL(PANTHEIOS_VER_MAJOR, verMajor);
  84. }
  85. static void test_minor()
  86. {
  87. pan_uint32_t verMinor = (pantheios_getVersion() & 0x00ff0000) >> 16;
  88. XTESTS_TEST_INTEGER_EQUAL(PANTHEIOS_VER_MINOR, verMinor);
  89. }
  90. static void test_revision()
  91. {
  92. pan_uint32_t verRevision = (pantheios_getVersion() & 0x0000ff00) >> 8;
  93. XTESTS_TEST_INTEGER_EQUAL(PANTHEIOS_VER_REVISION, verRevision);
  94. }
  95. /* ///////////////////////////// end of file //////////////////////////// */