unit-test.h.in 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*
  2. * Copyright © 2008-2014 Stéphane Raimbault <stephane.raimbault@gmail.com>
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #ifndef _UNIT_TEST_H_
  7. #define _UNIT_TEST_H_
  8. /* Constants defined by configure.ac */
  9. #define HAVE_INTTYPES_H @HAVE_INTTYPES_H@
  10. #define HAVE_STDINT_H @HAVE_STDINT_H@
  11. #ifdef HAVE_INTTYPES_H
  12. #include <inttypes.h>
  13. #endif
  14. #ifdef HAVE_STDINT_H
  15. # ifndef _MSC_VER
  16. # include <stdint.h>
  17. # else
  18. # include "stdint.h"
  19. # endif
  20. #endif
  21. #define SERVER_ID 17
  22. #define INVALID_SERVER_ID 18
  23. /* Server allocates address + nb */
  24. const uint16_t UT_BITS_ADDRESS = 0x130;
  25. const uint16_t UT_BITS_NB = 0x25;
  26. const uint8_t UT_BITS_TAB[] = { 0xCD, 0x6B, 0xB2, 0x0E, 0x1B };
  27. const uint16_t UT_INPUT_BITS_ADDRESS = 0x1C4;
  28. const uint16_t UT_INPUT_BITS_NB = 0x16;
  29. const uint8_t UT_INPUT_BITS_TAB[] = { 0xAC, 0xDB, 0x35 };
  30. const uint16_t UT_REGISTERS_ADDRESS = 0x16B;
  31. /* Raise a manual exception when this address is used for the first byte */
  32. const uint16_t UT_REGISTERS_ADDRESS_SPECIAL = 0x6C;
  33. /* The response of the server will contains an invalid TID or slave */
  34. const uint16_t UT_REGISTERS_ADDRESS_INVALID_TID_OR_SLAVE = 0x6D;
  35. /* The server will wait for 1 second before replying to test timeout */
  36. const uint16_t UT_REGISTERS_ADDRESS_SLEEP_500_MS = 0x6E;
  37. /* The server will wait for 5 ms before sending each byte */
  38. const uint16_t UT_REGISTERS_ADDRESS_BYTE_SLEEP_5_MS = 0x6F;
  39. const uint16_t UT_REGISTERS_NB = 0x3;
  40. const uint16_t UT_REGISTERS_TAB[] = { 0x022B, 0x0001, 0x0064 };
  41. /* If the following value is used, a bad response is sent.
  42. It's better to test with a lower value than
  43. UT_REGISTERS_NB_POINTS to try to raise a segfault. */
  44. const uint16_t UT_REGISTERS_NB_SPECIAL = 0x2;
  45. const uint16_t UT_INPUT_REGISTERS_ADDRESS = 0x108;
  46. const uint16_t UT_INPUT_REGISTERS_NB = 0x1;
  47. const uint16_t UT_INPUT_REGISTERS_TAB[] = { 0x000A };
  48. const float UT_REAL = 916.540649;
  49. const uint32_t UT_IREAL = 0x4465229a;
  50. const uint32_t UT_IREAL_DCBA = 0x9a226544;
  51. #endif /* _UNIT_TEST_H_ */