unit-test.h.in 2.0 KB

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