source: rtems/testsuites/libtests/stringto01/init.c @ 7d3f9c6

4.115
Last change on this file since 7d3f9c6 was 7d3f9c6, checked in by Ralf Corsepius <ralf.corsepius@…>, on 02/22/11 at 07:37:03

Add HAVE_CONFIG_H.

  • Property mode set to 100644
File size: 6.1 KB
Line 
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#ifdef HAVE_CONFIG_H
13#include "config.h"
14#endif
15
16#include "tmacros.h"
17#include <rtems/stringto.h>
18#include <limits.h>
19#include <math.h>
20
21#include <stdio.h>
22
23#define __STRING(x)     #x              /* stringify without expanding x */
24#define __XSTRING(x)    __STRING(x)     /* expand x, then stringify */
25
26/* c99 has LLONG_MAX instead of LONG_LONG_MAX */
27#ifndef LONG_LONG_MAX
28#define LONG_LONG_MAX   LLONG_MAX
29#endif
30/* c99 has LLONG_MIN instead of LONG_LONG_MIN */
31#ifndef LONG_LONG_MIN
32#define LONG_LONG_MIN   LLONG_MIN
33#endif
34
35/* Test pointer conversions */
36#define TEST_STRING_TO_TYPE          void *
37#define TEST_STRING_TO_NAME          test_rtems_string_to_pointer
38#define STRING_TO_NAME_METHOD        rtems_string_to_pointer
39#define STRING_TO_NAME_METHOD_STRING "rtems_string_to_pointer"
40#define STRING_TO_POINTER
41#include "stringto_test_template.h"
42
43/* Test unsigned char conversions */
44#define TEST_STRING_TO_TYPE          unsigned char
45#define TEST_STRING_TO_NAME          test_rtems_string_to_unsigned_char
46#define STRING_TO_NAME_METHOD        rtems_string_to_unsigned_char
47#define STRING_TO_NAME_METHOD_STRING "rtems_string_to_unsigned_char"
48/* #define TEST_TOO_LARGE_STRING        "987654321123456789123456789" */
49#define STRING_TO_INTEGER
50#include "stringto_test_template.h"
51
52/* Test integer conversions */
53#define TEST_STRING_TO_TYPE          int
54#define STRING_TO_MAX                LONG_MAX
55#define STRING_TO_MAX_STRING         __XSTRING(LONG_MAX)
56#define TEST_STRING_TO_NAME          test_rtems_string_to_int
57#define STRING_TO_NAME_METHOD        rtems_string_to_int
58#define STRING_TO_NAME_METHOD_STRING "rtems_string_to_int"
59#define TEST_TOO_LARGE_STRING        "987654321123456789123456789"
60#define STRING_TO_INTEGER
61#include "stringto_test_template.h"
62
63/* Test unsigned int conversions */
64#define TEST_STRING_TO_TYPE          unsigned int
65#define TEST_STRING_TO_NAME          test_rtems_string_to_unsigned_int
66#define STRING_TO_NAME_METHOD        rtems_string_to_unsigned_int
67#define STRING_TO_NAME_METHOD_STRING "rtems_string_to_unsigned_int"
68#define TEST_TOO_LARGE_STRING        "987654321123456789123456789"
69#define STRING_TO_INTEGER
70#include "stringto_test_template.h"
71
72/* Test long conversions */
73#define TEST_STRING_TO_TYPE          long
74#define STRING_TO_MAX                LONG_MAX
75#define STRING_TO_MAX_STRING         __XSTRING(LONG_MAX)
76#define TEST_STRING_TO_NAME          test_rtems_string_to_long
77#define STRING_TO_NAME_METHOD        rtems_string_to_long
78#define STRING_TO_NAME_METHOD_STRING "rtems_string_to_long"
79#define TEST_TOO_LARGE_STRING        "987654321123456789123456789"
80#define TEST_TOO_SMALL_STRING        "-98765432198765432123456789"
81#define STRING_TO_INTEGER
82#include "stringto_test_template.h"
83
84/* Test unsigned long conversions */
85#define TEST_STRING_TO_TYPE          unsigned long
86#define TEST_STRING_TO_NAME          test_rtems_string_to_unsigned_long
87#define STRING_TO_NAME_METHOD        rtems_string_to_unsigned_long
88#define STRING_TO_NAME_METHOD_STRING "rtems_string_to_unsigned_long"
89#define TEST_TOO_LARGE_STRING        "987654321123456789123456789"
90#define STRING_TO_INTEGER
91#include "stringto_test_template.h"
92
93/* Test long long conversions */
94#define TEST_STRING_TO_TYPE          long long
95#define STRING_TO_MAX                LONG_LONG_MAX
96#define STRING_TO_MAX_STRING         __XSTRING(LONG_LONG_MAX)
97#define TEST_STRING_TO_NAME          test_rtems_string_to_long_long
98#define STRING_TO_NAME_METHOD        rtems_string_to_long_long
99#define STRING_TO_NAME_METHOD_STRING "rtems_string_to_long_long"
100#define TEST_TOO_LARGE_STRING        "987654321123456789123456789"
101#define TEST_TOO_SMALL_STRING        "-98765432198765432123456789"
102#define STRING_TO_INTEGER
103#include "stringto_test_template.h"
104
105/* Test unsigned long long conversions */
106#define TEST_STRING_TO_TYPE          unsigned long long
107#define TEST_STRING_TO_NAME          test_rtems_string_to_unsigned_long_long
108#define STRING_TO_NAME_METHOD        rtems_string_to_unsigned_long_long
109#define STRING_TO_NAME_METHOD_STRING "rtems_string_to_unsigned_long_long"
110#define TEST_TOO_LARGE_STRING        "987654321123456789123456789"
111#define STRING_TO_INTEGER
112#include "stringto_test_template.h"
113
114/* Test float conversions */
115#define TEST_STRING_TO_TYPE          float
116#define TEST_STRING_TO_NAME          test_rtems_string_to_float
117#define STRING_TO_NAME_METHOD        rtems_string_to_float
118#define STRING_TO_NAME_METHOD_STRING "rtems_string_to_float"
119#define TEST_TOO_LARGE_STRING        "9.87654321123456789123456789E10240"
120#define STRING_TO_FLOAT
121#include "stringto_test_template.h"
122
123/* Test double conversions */
124#define TEST_STRING_TO_TYPE          double
125#define TEST_STRING_TO_NAME          test_rtems_string_to_double
126#define STRING_TO_NAME_METHOD        rtems_string_to_double
127#define STRING_TO_NAME_METHOD_STRING "rtems_string_to_double"
128#define TEST_TOO_LARGE_STRING        "9.87654321123456789123456789E10240"
129#define STRING_TO_FLOAT
130#include "stringto_test_template.h"
131
132rtems_task Init(
133  rtems_task_argument ignored
134)
135{
136  puts( "\n\n*** STRING TO CONVERSION TEST ***" );
137  test_rtems_string_to_pointer();
138  test_rtems_string_to_unsigned_char();
139  test_rtems_string_to_int();
140  test_rtems_string_to_unsigned_int();
141  test_rtems_string_to_long();
142  test_rtems_string_to_unsigned_long();
143  test_rtems_string_to_long_long();
144  test_rtems_string_to_unsigned_long_long();
145
146  test_rtems_string_to_float();
147  test_rtems_string_to_double();
148  puts( "*** END OF STRING TO CONVERSION TEST ***" );
149  rtems_test_exit(0);
150}
151
152/* NOTICE: the clock driver is explicitly disabled */
153#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
154#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
155
156#define CONFIGURE_MAXIMUM_TASKS            1
157#define CONFIGURE_USE_DEVFS_AS_BASE_FILESYSTEM
158
159#define CONFIGURE_INIT_TASK_ATTRIBUTES RTEMS_FLOATING_POINT
160#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
161
162#define CONFIGURE_INIT
163#include <rtems/confdefs.h>
Note: See TracBrowser for help on using the repository browser.