2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
9 const char * strings
[] =
35 const double results
[] =
60 const int ptroffset
[] =
85 const char * newlinetest_rn
= "\t-2.700264 -1.792122 -2.037897\r\n\t-0.084267 0.081827 0.584534\r\n";
86 const char * newlinetest_n
= "\t-2.700264 -1.792122 -2.037897\n\t-0.084267 0.081827 0.584534\n";
88 const double newlinetestresults
[] =
99 const int newlinetestptroffset_rn
[] =
112 const int newlinetestptroffset_n
[] =
125 #define TESTLINELINE_I 6
127 void testnewline(const char * buffer
, const int * ptroffset
)
129 int i
= 0; char * src
= NULL
; char *next
;
130 for(src
= (char *)buffer
; i
< (TESTLINELINE_I
+ 2); i
++, src
= next
)
132 double f
= strtod(src
, &next
);
133 if ((float)newlinetestresults
[i
] != (float)f
)
134 printf("RESULT FAILURE @ %s, should be %f was %f\n", src
, newlinetestresults
[i
], f
);
135 if (ptroffset
[i
] != (next
- src
))
136 printf("OFFSET FAILURE @ %s, should be %d was %d\n", src
, ptroffset
[i
], (int)(next
- src
));
137 if(next
<= src
) break;
140 if (TESTLINELINE_I
!= i
)
141 printf("ITER FAILURE @ %s, should be %d was %d\n", buffer
, TESTLINELINE_I
, i
);
146 char * float_end
= NULL
;
149 const char * str
= NULL
;
151 while((str
= strings
[i
]) != NULL
)
153 f
= strtod(str
, &float_end
);
155 printf("RESULT FAILURE @ %s, should be %f was %f\n", str
, results
[i
], f
);
156 if ((float_end
- str
) != ptroffset
[i
])
157 printf("OFFSET FAILURE @ %s, should be %d was %d\n", str
, ptroffset
[i
], (int)(float_end
- str
));
161 /* Check bahavior with new-lined strings */
162 testnewline(newlinetest_rn
, newlinetestptroffset_rn
);
163 testnewline(newlinetest_n
, newlinetestptroffset_n
);