unit-test.h.in 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. * Copyright © 2008-2013 Stéphane Raimbault <stephane.raimbault@gmail.com>
  3. *
  4. * This program is free software: you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 3 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. */
  17. #ifndef _UNIT_TEST_H_
  18. #define _UNIT_TEST_H_
  19. /* Constants defined by configure.ac */
  20. #define HAVE_INTTYPES_H @HAVE_INTTYPES_H@
  21. #define HAVE_STDINT_H @HAVE_STDINT_H@
  22. #ifdef HAVE_INTTYPES_H
  23. #include <inttypes.h>
  24. #endif
  25. #ifdef HAVE_STDINT_H
  26. # ifndef _MSC_VER
  27. # include <stdint.h>
  28. # else
  29. # include "stdint.h"
  30. # endif
  31. #endif
  32. #define SERVER_ID 17
  33. #define INVALID_SERVER_ID 18
  34. /* Server allocates address + nb */
  35. const uint16_t UT_BITS_ADDRESS = 0x130;
  36. const uint16_t UT_BITS_NB = 0x25;
  37. const uint8_t UT_BITS_TAB[] = { 0xCD, 0x6B, 0xB2, 0x0E, 0x1B };
  38. const uint16_t UT_INPUT_BITS_ADDRESS = 0x1C4;
  39. const uint16_t UT_INPUT_BITS_NB = 0x16;
  40. const uint8_t UT_INPUT_BITS_TAB[] = { 0xAC, 0xDB, 0x35 };
  41. const uint16_t UT_REGISTERS_ADDRESS = 0x16B;
  42. /* Raise a manual exception when this address is used for the first byte */
  43. const uint16_t UT_REGISTERS_ADDRESS_SPECIAL = 0x6C;
  44. /* The response of the server will contains an invalid TID or slave */
  45. const uint16_t UT_REGISTERS_ADDRESS_INVALID_TID_OR_SLAVE = 0x6D;
  46. /* The server will wait for 1 second before replying to test timeout */
  47. const uint16_t UT_REGISTERS_ADDRESS_SLEEP_500_MS = 0x6E;
  48. /* The server will wait for 5 ms before sending each byte */
  49. const uint16_t UT_REGISTERS_ADDRESS_BYTE_SLEEP_5_MS = 0x6F;
  50. const uint16_t UT_REGISTERS_NB = 0x3;
  51. const uint16_t UT_REGISTERS_TAB[] = { 0x022B, 0x0001, 0x0064 };
  52. /* If the following value is used, a bad response is sent.
  53. It's better to test with a lower value than
  54. UT_REGISTERS_NB_POINTS to try to raise a segfault. */
  55. const uint16_t UT_REGISTERS_NB_SPECIAL = 0x2;
  56. const uint16_t UT_INPUT_REGISTERS_ADDRESS = 0x108;
  57. const uint16_t UT_INPUT_REGISTERS_NB = 0x1;
  58. const uint16_t UT_INPUT_REGISTERS_TAB[] = { 0x000A };
  59. const float UT_REAL = 916.540649;
  60. const uint32_t UT_IREAL = 0x4465229a;
  61. const uint32_t UT_IREAL_DCBA = 0x9a226544;
  62. #endif /* _UNIT_TEST_H_ */