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