1 | /* |
---|
2 | * COPYRIGHT (c) 1989-2009. |
---|
3 | * On-Line Applications Research Corporation (OAR). |
---|
4 | * |
---|
5 | * The license and distribution terms for this file may be |
---|
6 | * found in the file LICENSE in this distribution or at |
---|
7 | * http://www.rtems.com/license/LICENSE. |
---|
8 | * |
---|
9 | * $Id$ |
---|
10 | */ |
---|
11 | |
---|
12 | #include "tmacros.h" |
---|
13 | #include <rtems/stringto.h> |
---|
14 | |
---|
15 | #include <stdio.h> |
---|
16 | |
---|
17 | /* Test pointer conversions */ |
---|
18 | #define TEST_STRING_TO_TYPE void * |
---|
19 | #define TEST_STRING_TO_NAME test_rtems_string_to_pointer |
---|
20 | #define STRING_TO_NAME_METHOD rtems_string_to_pointer |
---|
21 | #define STRING_TO_NAME_METHOD_STRING "rtems_string_to_pointer" |
---|
22 | #define STRING_TO_POINTER |
---|
23 | #include "stringto_test_template.h" |
---|
24 | |
---|
25 | /* Test unsigned char conversions */ |
---|
26 | #define TEST_STRING_TO_TYPE unsigned char |
---|
27 | #define TEST_STRING_TO_NAME test_rtems_string_to_unsigned_char |
---|
28 | #define STRING_TO_NAME_METHOD rtems_string_to_unsigned_char |
---|
29 | #define STRING_TO_NAME_METHOD_STRING "rtems_string_to_unsigned_char" |
---|
30 | /* #define TEST_TOO_LARGE_STRING "987654321123456789123456789" */ |
---|
31 | #define STRING_TO_INTEGER |
---|
32 | #include "stringto_test_template.h" |
---|
33 | |
---|
34 | /* Test integer conversions */ |
---|
35 | #define TEST_STRING_TO_TYPE int |
---|
36 | #define TEST_STRING_TO_NAME test_rtems_string_to_int |
---|
37 | #define STRING_TO_NAME_METHOD rtems_string_to_int |
---|
38 | #define STRING_TO_NAME_METHOD_STRING "rtems_string_to_int" |
---|
39 | #define TEST_TOO_LARGE_STRING "987654321123456789123456789" |
---|
40 | #define STRING_TO_INTEGER |
---|
41 | #include "stringto_test_template.h" |
---|
42 | |
---|
43 | /* Test unsigned int conversions */ |
---|
44 | #define TEST_STRING_TO_TYPE unsigned int |
---|
45 | #define TEST_STRING_TO_NAME test_rtems_string_to_unsigned_int |
---|
46 | #define STRING_TO_NAME_METHOD rtems_string_to_unsigned_int |
---|
47 | #define STRING_TO_NAME_METHOD_STRING "rtems_string_to_unsigned_int" |
---|
48 | #define TEST_TOO_LARGE_STRING "987654321123456789123456789" |
---|
49 | #define STRING_TO_INTEGER |
---|
50 | #include "stringto_test_template.h" |
---|
51 | |
---|
52 | /* Test long conversions */ |
---|
53 | #define TEST_STRING_TO_TYPE long |
---|
54 | #define TEST_STRING_TO_NAME test_rtems_string_to_long |
---|
55 | #define STRING_TO_NAME_METHOD rtems_string_to_long |
---|
56 | #define STRING_TO_NAME_METHOD_STRING "rtems_string_to_long" |
---|
57 | #define TEST_TOO_LARGE_STRING "987654321123456789123456789" |
---|
58 | #define TEST_TOO_SMALL_STRING "-98765432198765432123456789" |
---|
59 | #define STRING_TO_INTEGER |
---|
60 | #include "stringto_test_template.h" |
---|
61 | |
---|
62 | /* Test unsigned long conversions */ |
---|
63 | #define TEST_STRING_TO_TYPE unsigned long |
---|
64 | #define TEST_STRING_TO_NAME test_rtems_string_to_unsigned_long |
---|
65 | #define STRING_TO_NAME_METHOD rtems_string_to_unsigned_long |
---|
66 | #define STRING_TO_NAME_METHOD_STRING "rtems_string_to_unsigned_long" |
---|
67 | #define TEST_TOO_LARGE_STRING "987654321123456789123456789" |
---|
68 | #define STRING_TO_INTEGER |
---|
69 | #include "stringto_test_template.h" |
---|
70 | |
---|
71 | /* Test long long conversions */ |
---|
72 | #define TEST_STRING_TO_TYPE long long |
---|
73 | #define TEST_STRING_TO_NAME test_rtems_string_to_long_long |
---|
74 | #define STRING_TO_NAME_METHOD rtems_string_to_long_long |
---|
75 | #define STRING_TO_NAME_METHOD_STRING "rtems_string_to_long_long" |
---|
76 | #define TEST_TOO_LARGE_STRING "987654321123456789123456789" |
---|
77 | #define TEST_TOO_SMALL_STRING "-98765432198765432123456789" |
---|
78 | #define STRING_TO_INTEGER |
---|
79 | #include "stringto_test_template.h" |
---|
80 | |
---|
81 | /* Test unsigned long long conversions */ |
---|
82 | #define TEST_STRING_TO_TYPE unsigned long long |
---|
83 | #define TEST_STRING_TO_NAME test_rtems_string_to_unsigned_long_long |
---|
84 | #define STRING_TO_NAME_METHOD rtems_string_to_unsigned_long_long |
---|
85 | #define STRING_TO_NAME_METHOD_STRING "rtems_string_to_unsigned_long_long" |
---|
86 | #define TEST_TOO_LARGE_STRING "987654321123456789123456789" |
---|
87 | #define STRING_TO_INTEGER |
---|
88 | #include "stringto_test_template.h" |
---|
89 | |
---|
90 | /* Test float conversions */ |
---|
91 | #define TEST_STRING_TO_TYPE float |
---|
92 | #define TEST_STRING_TO_NAME test_rtems_string_to_float |
---|
93 | #define STRING_TO_NAME_METHOD rtems_string_to_float |
---|
94 | #define STRING_TO_NAME_METHOD_STRING "rtems_string_to_float" |
---|
95 | #define TEST_TOO_LARGE_STRING "9.87654321123456789123456789E10240" |
---|
96 | #define STRING_TO_FLOAT |
---|
97 | #include "stringto_test_template.h" |
---|
98 | |
---|
99 | /* Test double conversions */ |
---|
100 | #define TEST_STRING_TO_TYPE double |
---|
101 | #define TEST_STRING_TO_NAME test_rtems_string_to_double |
---|
102 | #define STRING_TO_NAME_METHOD rtems_string_to_double |
---|
103 | #define STRING_TO_NAME_METHOD_STRING "rtems_string_to_double" |
---|
104 | #define TEST_TOO_LARGE_STRING "9.87654321123456789123456789E10240" |
---|
105 | #define STRING_TO_FLOAT |
---|
106 | #include "stringto_test_template.h" |
---|
107 | |
---|
108 | rtems_task Init( |
---|
109 | rtems_task_argument ignored |
---|
110 | ) |
---|
111 | { |
---|
112 | puts( "\n\n*** STRING TO CONVERSION TEST ***" ); |
---|
113 | test_rtems_string_to_pointer(); |
---|
114 | test_rtems_string_to_unsigned_char(); |
---|
115 | test_rtems_string_to_int(); |
---|
116 | test_rtems_string_to_unsigned_int(); |
---|
117 | test_rtems_string_to_long(); |
---|
118 | test_rtems_string_to_unsigned_long(); |
---|
119 | test_rtems_string_to_long_long(); |
---|
120 | test_rtems_string_to_unsigned_long_long(); |
---|
121 | |
---|
122 | test_rtems_string_to_float(); |
---|
123 | test_rtems_string_to_double(); |
---|
124 | puts( "*** END OF STRING TO CONVERSION TEST ***" ); |
---|
125 | rtems_test_exit(0); |
---|
126 | } |
---|
127 | |
---|
128 | /* NOTICE: the clock driver is explicitly disabled */ |
---|
129 | #define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER |
---|
130 | #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER |
---|
131 | |
---|
132 | #define CONFIGURE_MAXIMUM_TASKS 1 |
---|
133 | #define CONFIGURE_USE_DEVFS_AS_BASE_FILESYSTEM |
---|
134 | |
---|
135 | #define CONFIGURE_INIT_TASK_ATTRIBUTES RTEMS_FLOATING_POINT |
---|
136 | #define CONFIGURE_RTEMS_INIT_TASKS_TABLE |
---|
137 | |
---|
138 | #define CONFIGURE_INIT |
---|
139 | #include <rtems/confdefs.h> |
---|