aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit-test.h
diff options
context:
space:
mode:
authorJonathan McCrohan <jmccrohan@gmail.com>2011-10-12 21:50:48 +0100
committerJonathan McCrohan <jmccrohan@gmail.com>2011-10-12 21:50:48 +0100
commit6cfbf2dee130cc36a72d57adea0e9c04bb31f620 (patch)
tree638bcaf4c63e3d3be17e0f5e7d74639394d15702 /tests/unit-test.h
downloadverteco-6cfbf2dee130cc36a72d57adea0e9c04bb31f620.tar.gz
Initial commit
Diffstat (limited to 'tests/unit-test.h')
-rw-r--r--tests/unit-test.h62
1 files changed, 62 insertions, 0 deletions
diff --git a/tests/unit-test.h b/tests/unit-test.h
new file mode 100644
index 0000000..78575c1
--- /dev/null
+++ b/tests/unit-test.h
@@ -0,0 +1,62 @@
+/*
+ * Copyright © 2008-2010 Stéphane Raimbault <stephane.raimbault@gmail.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef _UNIT_TEST_H_
+#define _UNIT_TEST_H_
+
+#include <config.h>
+
+#ifdef HAVE_INTTYPES_H
+#include <inttypes.h>
+#endif
+#ifdef HAVE_STDINT_H
+# ifndef _MSC_VER
+# include <stdint.h>
+# else
+# include "stdint.h"
+# endif
+#endif
+
+#define SERVER_ID 17
+#define INVALID_SERVER_ID 18
+
+const uint16_t UT_BITS_ADDRESS = 0x13;
+const uint16_t UT_BITS_NB = 0x25;
+const uint8_t UT_BITS_TAB[] = { 0xCD, 0x6B, 0xB2, 0x0E, 0x1B };
+
+const uint16_t UT_INPUT_BITS_ADDRESS = 0xC4;
+const uint16_t UT_INPUT_BITS_NB = 0x16;
+const uint8_t UT_INPUT_BITS_TAB[] = { 0xAC, 0xDB, 0x35 };
+
+const uint16_t UT_REGISTERS_ADDRESS = 0x6B;
+/* Raise a manual exception when this adress is used for the first byte */
+const uint16_t UT_REGISTERS_ADDRESS_SPECIAL = 0x6C;
+const uint16_t UT_REGISTERS_NB = 0x3;
+const uint16_t UT_REGISTERS_TAB[] = { 0x022B, 0x0001, 0x0064 };
+/* If the following value is used, a bad response is sent.
+ It's better to test with a lower value than
+ UT_REGISTERS_NB_POINTS to try to raise a segfault. */
+const uint16_t UT_REGISTERS_NB_SPECIAL = 0x2;
+
+const uint16_t UT_INPUT_REGISTERS_ADDRESS = 0x08;
+const uint16_t UT_INPUT_REGISTERS_NB = 0x1;
+const uint16_t UT_INPUT_REGISTERS_TAB[] = { 0x000A };
+
+const float UT_REAL = 916.540649;
+const uint32_t UT_IREAL = 0x4465229a;
+
+#endif /* _UNIT_TEST_H_ */