Skip to content

Commit 58fb345

Browse files
author
Michael Meskes
committed
Usage of isnan() in ECPG regression tests probably needs '#include <float.h>' as well.
1 parent a96ad2f commit 58fb345

File tree

3 files changed

+221
-219
lines changed

3 files changed

+221
-219
lines changed

src/interfaces/ecpg/test/expected/pgtypeslib-nan_test.c

Lines changed: 52 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <stdio.h>
1111
#include <stdlib.h>
1212
#include <math.h>
13+
#include <float.h>
1314
#include <pgtypes_numeric.h>
1415
#include <decimal.h>
1516

@@ -21,7 +22,7 @@
2122

2223

2324

24-
#line 7 "nan_test.pgc"
25+
#line 8 "nan_test.pgc"
2526

2627

2728
int
@@ -33,54 +34,54 @@ main(void)
3334

3435

3536

36-
#line 13 "nan_test.pgc"
37+
#line 14 "nan_test.pgc"
3738
int id ;
3839

39-
#line 14 "nan_test.pgc"
40+
#line 15 "nan_test.pgc"
4041
double d ;
4142

42-
#line 15 "nan_test.pgc"
43+
#line 16 "nan_test.pgc"
4344
numeric * num ;
4445

45-
#line 16 "nan_test.pgc"
46+
#line 17 "nan_test.pgc"
4647
char val [ 16 ] ;
4748
/* exec sql end declare section */
48-
#line 17 "nan_test.pgc"
49+
#line 18 "nan_test.pgc"
4950

5051

5152
ECPGdebug(1, stderr);
5253
/* exec sql whenever sqlerror do sqlprint ( ) ; */
53-
#line 20 "nan_test.pgc"
54+
#line 21 "nan_test.pgc"
5455

5556

5657
{ ECPGconnect(__LINE__, 0, "regress1" , NULL, NULL , NULL, 0);
57-
#line 22 "nan_test.pgc"
58+
#line 23 "nan_test.pgc"
5859

5960
if (sqlca.sqlcode < 0) sqlprint ( );}
60-
#line 22 "nan_test.pgc"
61+
#line 23 "nan_test.pgc"
6162

6263

6364
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create table nantest1 ( id int4 , d float8 )", ECPGt_EOIT, ECPGt_EORT);
64-
#line 24 "nan_test.pgc"
65+
#line 25 "nan_test.pgc"
6566

6667
if (sqlca.sqlcode < 0) sqlprint ( );}
67-
#line 24 "nan_test.pgc"
68+
#line 25 "nan_test.pgc"
6869

6970
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into nantest1 ( id , d ) values ( 1 , 'nan' :: float8 ) , ( 2 , 'infinity' :: float8 ) , ( 3 , '-infinity' :: float8 )", ECPGt_EOIT, ECPGt_EORT);
70-
#line 25 "nan_test.pgc"
71+
#line 26 "nan_test.pgc"
7172

7273
if (sqlca.sqlcode < 0) sqlprint ( );}
73-
#line 25 "nan_test.pgc"
74+
#line 26 "nan_test.pgc"
7475

7576

7677
/* declare cur cursor for select id , d , d from nantest1 */
77-
#line 27 "nan_test.pgc"
78+
#line 28 "nan_test.pgc"
7879

7980
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur cursor for select id , d , d from nantest1", ECPGt_EOIT, ECPGt_EORT);
80-
#line 28 "nan_test.pgc"
81+
#line 29 "nan_test.pgc"
8182

8283
if (sqlca.sqlcode < 0) sqlprint ( );}
83-
#line 28 "nan_test.pgc"
84+
#line 29 "nan_test.pgc"
8485

8586
while (1)
8687
{
@@ -91,10 +92,10 @@ if (sqlca.sqlcode < 0) sqlprint ( );}
9192
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
9293
ECPGt_char,(val),(long)16,(long)1,(16)*sizeof(char),
9394
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
94-
#line 31 "nan_test.pgc"
95+
#line 32 "nan_test.pgc"
9596

9697
if (sqlca.sqlcode < 0) sqlprint ( );}
97-
#line 31 "nan_test.pgc"
98+
#line 32 "nan_test.pgc"
9899

99100
if (sqlca.sqlcode)
100101
break;
@@ -108,34 +109,34 @@ if (sqlca.sqlcode < 0) sqlprint ( );}
108109
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
109110
ECPGt_double,&(d),(long)1,(long)1,sizeof(double),
110111
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
111-
#line 39 "nan_test.pgc"
112+
#line 40 "nan_test.pgc"
112113

113114
if (sqlca.sqlcode < 0) sqlprint ( );}
114-
#line 39 "nan_test.pgc"
115+
#line 40 "nan_test.pgc"
115116

116117
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into nantest1 ( id , d ) values ( $1 + 6 , $2 )",
117118
ECPGt_int,&(id),(long)1,(long)1,sizeof(int),
118119
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
119120
ECPGt_char,(val),(long)16,(long)1,(16)*sizeof(char),
120121
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
121-
#line 40 "nan_test.pgc"
122+
#line 41 "nan_test.pgc"
122123

123124
if (sqlca.sqlcode < 0) sqlprint ( );}
124-
#line 40 "nan_test.pgc"
125+
#line 41 "nan_test.pgc"
125126

126127
}
127128
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur", ECPGt_EOIT, ECPGt_EORT);
128-
#line 42 "nan_test.pgc"
129+
#line 43 "nan_test.pgc"
129130

130131
if (sqlca.sqlcode < 0) sqlprint ( );}
131-
#line 42 "nan_test.pgc"
132+
#line 43 "nan_test.pgc"
132133

133134

134135
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur cursor for select id , d , d from nantest1", ECPGt_EOIT, ECPGt_EORT);
135-
#line 44 "nan_test.pgc"
136+
#line 45 "nan_test.pgc"
136137

137138
if (sqlca.sqlcode < 0) sqlprint ( );}
138-
#line 44 "nan_test.pgc"
139+
#line 45 "nan_test.pgc"
139140

140141
while (1)
141142
{
@@ -146,10 +147,10 @@ if (sqlca.sqlcode < 0) sqlprint ( );}
146147
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
147148
ECPGt_char,(val),(long)16,(long)1,(16)*sizeof(char),
148149
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
149-
#line 47 "nan_test.pgc"
150+
#line 48 "nan_test.pgc"
150151

151152
if (sqlca.sqlcode < 0) sqlprint ( );}
152-
#line 47 "nan_test.pgc"
153+
#line 48 "nan_test.pgc"
153154

154155
if (sqlca.sqlcode)
155156
break;
@@ -159,25 +160,25 @@ if (sqlca.sqlcode < 0) sqlprint ( );}
159160
printf("%d NaN '%s'\n", id, val);
160161
}
161162
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur", ECPGt_EOIT, ECPGt_EORT);
162-
#line 55 "nan_test.pgc"
163+
#line 56 "nan_test.pgc"
163164

164165
if (sqlca.sqlcode < 0) sqlprint ( );}
165-
#line 55 "nan_test.pgc"
166+
#line 56 "nan_test.pgc"
166167

167168

168169
num = PGTYPESnumeric_new();
169170

170171
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create table nantest2 ( id int4 , d numeric )", ECPGt_EOIT, ECPGt_EORT);
171-
#line 59 "nan_test.pgc"
172+
#line 60 "nan_test.pgc"
172173

173174
if (sqlca.sqlcode < 0) sqlprint ( );}
174-
#line 59 "nan_test.pgc"
175+
#line 60 "nan_test.pgc"
175176

176177
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into nantest2 ( id , d ) values ( 4 , 'nan' :: numeric )", ECPGt_EOIT, ECPGt_EORT);
177-
#line 60 "nan_test.pgc"
178+
#line 61 "nan_test.pgc"
178179

179180
if (sqlca.sqlcode < 0) sqlprint ( );}
180-
#line 60 "nan_test.pgc"
181+
#line 61 "nan_test.pgc"
181182

182183

183184
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select id , d , d from nantest2 where id = 4", ECPGt_EOIT,
@@ -187,39 +188,39 @@ if (sqlca.sqlcode < 0) sqlprint ( );}
187188
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
188189
ECPGt_char,(val),(long)16,(long)1,(16)*sizeof(char),
189190
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
190-
#line 62 "nan_test.pgc"
191+
#line 63 "nan_test.pgc"
191192

192193
if (sqlca.sqlcode < 0) sqlprint ( );}
193-
#line 62 "nan_test.pgc"
194+
#line 63 "nan_test.pgc"
194195

195196

196197
printf("%d %s '%s'\n", id, (num->sign == NUMERIC_NAN ? "NaN" : "not NaN"), val);
197198

198199
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into nantest2 ( id , d ) values ( 5 , $1 )",
199200
ECPGt_numeric,&(num),(long)1,(long)0,sizeof(numeric),
200201
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
201-
#line 66 "nan_test.pgc"
202+
#line 67 "nan_test.pgc"
202203

203204
if (sqlca.sqlcode < 0) sqlprint ( );}
204-
#line 66 "nan_test.pgc"
205+
#line 67 "nan_test.pgc"
205206

206207
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into nantest2 ( id , d ) values ( 6 , $1 )",
207208
ECPGt_char,(val),(long)16,(long)1,(16)*sizeof(char),
208209
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
209-
#line 67 "nan_test.pgc"
210+
#line 68 "nan_test.pgc"
210211

211212
if (sqlca.sqlcode < 0) sqlprint ( );}
212-
#line 67 "nan_test.pgc"
213+
#line 68 "nan_test.pgc"
213214

214215

215216
/* declare cur1 cursor for select id , d , d from nantest2 */
216-
#line 69 "nan_test.pgc"
217+
#line 70 "nan_test.pgc"
217218

218219
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur1 cursor for select id , d , d from nantest2", ECPGt_EOIT, ECPGt_EORT);
219-
#line 70 "nan_test.pgc"
220+
#line 71 "nan_test.pgc"
220221

221222
if (sqlca.sqlcode < 0) sqlprint ( );}
222-
#line 70 "nan_test.pgc"
223+
#line 71 "nan_test.pgc"
223224

224225
while (1)
225226
{
@@ -230,33 +231,33 @@ if (sqlca.sqlcode < 0) sqlprint ( );}
230231
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
231232
ECPGt_char,(val),(long)16,(long)1,(16)*sizeof(char),
232233
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
233-
#line 73 "nan_test.pgc"
234+
#line 74 "nan_test.pgc"
234235

235236
if (sqlca.sqlcode < 0) sqlprint ( );}
236-
#line 73 "nan_test.pgc"
237+
#line 74 "nan_test.pgc"
237238

238239
if (sqlca.sqlcode)
239240
break;
240241
printf("%d %s '%s'\n", id, (num->sign == NUMERIC_NAN ? "NaN" : "not NaN"), val);
241242
}
242243
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur1", ECPGt_EOIT, ECPGt_EORT);
243-
#line 78 "nan_test.pgc"
244+
#line 79 "nan_test.pgc"
244245

245246
if (sqlca.sqlcode < 0) sqlprint ( );}
246-
#line 78 "nan_test.pgc"
247+
#line 79 "nan_test.pgc"
247248

248249

249250
{ ECPGtrans(__LINE__, NULL, "rollback");
250-
#line 80 "nan_test.pgc"
251+
#line 81 "nan_test.pgc"
251252

252253
if (sqlca.sqlcode < 0) sqlprint ( );}
253-
#line 80 "nan_test.pgc"
254+
#line 81 "nan_test.pgc"
254255

255256
{ ECPGdisconnect(__LINE__, "CURRENT");
256-
#line 81 "nan_test.pgc"
257+
#line 82 "nan_test.pgc"
257258

258259
if (sqlca.sqlcode < 0) sqlprint ( );}
259-
#line 81 "nan_test.pgc"
260+
#line 82 "nan_test.pgc"
260261

261262

262263
return (0);

0 commit comments

Comments
 (0)