fb 0.9.1 → 0.9.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/fb.c +16 -18
  3. data/test/NumericDataTypesTestCases.rb +88 -88
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d6dfab5ce4cf2d5bfaa5cdd364c5a6f397adfd4b411ae4ceb7e43ab9755be664
4
- data.tar.gz: 44fad4a53c1532883461f97aa647bb28fe621a3154b15906ddb730d59c0c5572
3
+ metadata.gz: 85959395ea35e03609898e959a9a6d72a12e67668b2b438684c65d197ee9a77d
4
+ data.tar.gz: 61d51c626978212ba2857911b4a041468b1b1cea5409d0fb87349a7a3e93cb06
5
5
  SHA512:
6
- metadata.gz: 7cc2b6247e41e55176a139a71adb752708f7f04b96e35a0760074c025c99ed8700eec8d2bac2a5f7f30416f33ca0ff86bbef8367d69ef1370e7538744c20b3ec
7
- data.tar.gz: 96ad46acc89372382068848edbef078c92af9df87101b7d520771a2bd17c54d126ac38c1a5766e23ecfc0ee567205b397636fc737ff697154bbc3d888f58c718
6
+ metadata.gz: 8ec388455ba9b8efcca12c767a5fa4560df0b1ede1c3b6b9fddaf271f6c5c9c39e9a2fcd264521b5cdb3079ec8d6114f2efeabafcaae00299226e13ed236bed8
7
+ data.tar.gz: f1949849953a5539b0094359446440cb1426425b827431fce7400b93da57cfee58b98c742d5efdf47681dbf10553a7f261840a366ac5adf97de5890769880b6e
data/fb.c CHANGED
@@ -148,7 +148,7 @@ typedef struct trans_opts
148
148
  #define UPPER(c) (((c) >= 'a' && (c)<= 'z') ? (c) - 'a' + 'A' : (c))
149
149
  #define FREE(p) if (p) { xfree(p); p = 0; }
150
150
  #define SETNULL(p) if (p && strlen(p) == 0) { p = 0; }
151
- // #define HERE(s) printf("%s\n", s)
151
+ // #define HERE(s) printf("%s\n", s)
152
152
  #define HERE(s)
153
153
 
154
154
  static long calculate_buffsize(XSQLDA *sqlda)
@@ -255,13 +255,13 @@ static VALUE fb_mkdate(struct tm *tm)
255
255
  {
256
256
  return rb_funcall(
257
257
  rb_cDate, rb_intern("civil"), 3,
258
- INT2FIX(1900 + tm->tm_year), INT2FIX(tm->tm_mon + 1), INT2FIX(tm->tm_mday));
258
+ INT2FIX(1900 + tm->tm_year), INT2FIX(tm->tm_mon + 1), INT2FIX(tm->tm_mday));
259
259
  }
260
260
 
261
261
  static int responds_like_date(VALUE obj)
262
262
  {
263
- return rb_respond_to(obj, rb_intern("year")) &&
264
- rb_respond_to(obj, rb_intern("month")) &&
263
+ return rb_respond_to(obj, rb_intern("year")) &&
264
+ rb_respond_to(obj, rb_intern("month")) &&
265
265
  rb_respond_to(obj, rb_intern("day"));
266
266
  }
267
267
  static void tm_from_date(struct tm *tm, VALUE date)
@@ -405,10 +405,10 @@ static VALUE fb_sql_type_from_code(int code, int subtype)
405
405
  sql_type = "ARRAY";
406
406
  break;
407
407
  #if (FB_API_VER >= 30)
408
- case SQL_BOOLEAN:
409
- case blr_boolean:
410
- sql_type = "BOOLEAN";
411
- break;
408
+ case SQL_BOOLEAN:
409
+ case blr_boolean:
410
+ sql_type = "BOOLEAN";
411
+ break;
412
412
  #endif
413
413
  case SQL_QUAD:
414
414
  case blr_quad:
@@ -1528,12 +1528,12 @@ static void fb_cursor_set_inputparams(struct FbCursor *fb_cursor, long argc, VAL
1528
1528
  #endif
1529
1529
 
1530
1530
  #if (FB_API_VER >= 30)
1531
- case SQL_BOOLEAN:
1532
- offset = FB_ALIGN(offset, alignment);
1531
+ case SQL_BOOLEAN:
1532
+ offset = FB_ALIGN(offset, alignment);
1533
1533
  var->sqldata = (char *)(fb_cursor->i_buffer + offset);
1534
1534
  *(bool *)var->sqldata = obj;
1535
- offset += alignment;
1536
- break;
1535
+ offset += alignment;
1536
+ break;
1537
1537
  #endif
1538
1538
  default :
1539
1539
  rb_raise(rb_eFbError, "Specified table includes unsupported datatype (%d)", dtp);
@@ -1627,7 +1627,7 @@ static VALUE precision_from_sqlvar(XSQLVAR *sqlvar)
1627
1627
  case SQL_BLOB: return Qnil;
1628
1628
  case SQL_ARRAY: return Qnil;
1629
1629
  #if (FB_API_VER >= 30)
1630
- case SQL_BOOLEAN: return Qnil;
1630
+ case SQL_BOOLEAN: return Qnil;
1631
1631
  #endif
1632
1632
  case SQL_QUAD: return Qnil;
1633
1633
  case SQL_TYPE_TIME: return Qnil;
@@ -1809,8 +1809,6 @@ static VALUE fb_cursor_fetch(struct FbCursor *fb_cursor)
1809
1809
  dtp = var->sqltype & ~1;
1810
1810
 
1811
1811
  /* Check if column is null */
1812
-
1813
-
1814
1812
  if ((var->sqltype & 1) && (*var->sqlind < 0)) {
1815
1813
  val = Qnil;
1816
1814
  } else {
@@ -1926,9 +1924,9 @@ static VALUE fb_cursor_fetch(struct FbCursor *fb_cursor)
1926
1924
  break;
1927
1925
 
1928
1926
  #if (FB_API_VER >= 30)
1929
- case SQL_BOOLEAN:
1930
- val = ((*(int*)var->sqldata) == 1) ? Qtrue : Qfalse;
1931
- break;
1927
+ case SQL_BOOLEAN:
1928
+ val = (*(bool*)var->sqldata) ? Qtrue : Qfalse;
1929
+ break;
1932
1930
  #endif
1933
1931
 
1934
1932
  default:
@@ -31,10 +31,10 @@ class NumericDataTypesTestCases < FbTestCase
31
31
  assert_equal 32767, write_and_read_value("32767")
32
32
  assert_equal 32767, write_and_read_value(32767.0)
33
33
  assert_equal 32767, write_and_read_value(BigDecimal("32767"))
34
- assert write_and_read_value(32767).is_a?(Fixnum)
35
- assert write_and_read_value("32767").is_a?(Fixnum)
36
- assert write_and_read_value(32767.0).is_a?(Fixnum)
37
- assert write_and_read_value(BigDecimal("32767")).is_a?(Fixnum)
34
+ assert write_and_read_value(32767).is_a?(Integer)
35
+ assert write_and_read_value("32767").is_a?(Integer)
36
+ assert write_and_read_value(32767.0).is_a?(Integer)
37
+ assert write_and_read_value(BigDecimal("32767")).is_a?(Integer)
38
38
  end
39
39
 
40
40
  def test_smallint_min
@@ -43,26 +43,26 @@ class NumericDataTypesTestCases < FbTestCase
43
43
  assert_equal -32768, write_and_read_value("-32768")
44
44
  assert_equal -32768, write_and_read_value(-32768.0)
45
45
  assert_equal -32768, write_and_read_value(BigDecimal("-32768"))
46
- assert write_and_read_value(-32768).is_a?(Fixnum)
47
- assert write_and_read_value("-32768").is_a?(Fixnum)
48
- assert write_and_read_value(-32768.0).is_a?(Fixnum)
49
- assert write_and_read_value(BigDecimal("-32768")).is_a?(Fixnum)
46
+ assert write_and_read_value(-32768).is_a?(Integer)
47
+ assert write_and_read_value("-32768").is_a?(Integer)
48
+ assert write_and_read_value(-32768.0).is_a?(Integer)
49
+ assert write_and_read_value(BigDecimal("-32768")).is_a?(Integer)
50
50
  end
51
51
 
52
52
  def test_smallint_rounding
53
53
  prepare_test_table("smallint")
54
54
  assert_equal 0, write_and_read_value(0.4)
55
55
  assert_equal 0, write_and_read_value("0.4")
56
- assert_equal 0, write_and_read_value(BigDecimal.new("0.4"))
56
+ assert_equal 0, write_and_read_value(BigDecimal("0.4"))
57
57
  assert_equal 0, write_and_read_value(-0.4)
58
58
  assert_equal 0, write_and_read_value("-0.4")
59
- assert_equal 0, write_and_read_value(BigDecimal.new("-0.4"))
59
+ assert_equal 0, write_and_read_value(BigDecimal("-0.4"))
60
60
  assert_equal 1, write_and_read_value(0.5)
61
61
  assert_equal 1, write_and_read_value("0.5")
62
- assert_equal 1, write_and_read_value(BigDecimal.new("0.5"))
62
+ assert_equal 1, write_and_read_value(BigDecimal("0.5"))
63
63
  assert_equal -1, write_and_read_value(-0.5)
64
64
  assert_equal -1, write_and_read_value("-0.5")
65
- assert_equal -1, write_and_read_value(BigDecimal.new("-0.5"))
65
+ assert_equal -1, write_and_read_value(BigDecimal("-0.5"))
66
66
  end
67
67
 
68
68
  def test_smallint_input_type
@@ -89,10 +89,10 @@ class NumericDataTypesTestCases < FbTestCase
89
89
  assert_equal 2147483647, write_and_read_value("2147483647")
90
90
  assert_equal 2147483647, write_and_read_value(2147483647.0)
91
91
  assert_equal 2147483647, write_and_read_value(BigDecimal("2147483647"))
92
- assert write_and_read_value(2147483647).is_a?(Fixnum)
93
- assert write_and_read_value("2147483647").is_a?(Fixnum)
94
- assert write_and_read_value(2147483647.0).is_a?(Fixnum)
95
- assert write_and_read_value(BigDecimal("2147483647")).is_a?(Fixnum)
92
+ assert write_and_read_value(2147483647).is_a?(Integer)
93
+ assert write_and_read_value("2147483647").is_a?(Integer)
94
+ assert write_and_read_value(2147483647.0).is_a?(Integer)
95
+ assert write_and_read_value(BigDecimal("2147483647")).is_a?(Integer)
96
96
  end
97
97
 
98
98
  def test_integer_min
@@ -101,26 +101,26 @@ class NumericDataTypesTestCases < FbTestCase
101
101
  assert_equal -2147483648, write_and_read_value("-2147483648")
102
102
  assert_equal -2147483648, write_and_read_value(-2147483648.0)
103
103
  assert_equal -2147483648, write_and_read_value(BigDecimal("-2147483648"))
104
- assert write_and_read_value(-2147483648).is_a?(Fixnum)
105
- assert write_and_read_value("-2147483648").is_a?(Fixnum)
106
- assert write_and_read_value(-2147483648.0).is_a?(Fixnum)
107
- assert write_and_read_value(BigDecimal("-2147483648")).is_a?(Fixnum)
104
+ assert write_and_read_value(-2147483648).is_a?(Integer)
105
+ assert write_and_read_value("-2147483648").is_a?(Integer)
106
+ assert write_and_read_value(-2147483648.0).is_a?(Integer)
107
+ assert write_and_read_value(BigDecimal("-2147483648")).is_a?(Integer)
108
108
  end
109
109
 
110
110
  def test_integer_rounding
111
111
  prepare_test_table("integer")
112
112
  assert_equal 0, write_and_read_value(0.4)
113
113
  assert_equal 0, write_and_read_value("0.4")
114
- assert_equal 0, write_and_read_value(BigDecimal.new("0.4"))
114
+ assert_equal 0, write_and_read_value(BigDecimal("0.4"))
115
115
  assert_equal 0, write_and_read_value(-0.4)
116
116
  assert_equal 0, write_and_read_value("-0.4")
117
- assert_equal 0, write_and_read_value(BigDecimal.new("-0.4"))
117
+ assert_equal 0, write_and_read_value(BigDecimal("-0.4"))
118
118
  assert_equal 1, write_and_read_value(0.5)
119
119
  assert_equal 1, write_and_read_value("0.5")
120
- assert_equal 1, write_and_read_value(BigDecimal.new("0.5"))
120
+ assert_equal 1, write_and_read_value(BigDecimal("0.5"))
121
121
  assert_equal -1, write_and_read_value(-0.5)
122
122
  assert_equal -1, write_and_read_value("-0.5")
123
- assert_equal -1, write_and_read_value(BigDecimal.new("-0.5"))
123
+ assert_equal -1, write_and_read_value(BigDecimal("-0.5"))
124
124
  end
125
125
 
126
126
  def test_integer_input_type
@@ -147,10 +147,10 @@ class NumericDataTypesTestCases < FbTestCase
147
147
  assert_equal 9223372036854775807, write_and_read_value("9223372036854775807")
148
148
  #assert_equal 9223372036854775807, write_and_read_value(9223372036854775807.0)
149
149
  assert_equal 9223372036854775807, write_and_read_value(BigDecimal("9223372036854775807"))
150
- assert write_and_read_value(9223372036854775807).is_a?(Bignum)
151
- assert write_and_read_value("9223372036854775807").is_a?(Bignum)
152
- #assert write_and_read_value(9223372036854775807.0).is_a?(Bignum)
153
- assert write_and_read_value(BigDecimal("9223372036854775807")).is_a?(Bignum)
150
+ assert write_and_read_value(9223372036854775807).is_a?(Integer)
151
+ assert write_and_read_value("9223372036854775807").is_a?(Integer)
152
+ #assert write_and_read_value(9223372036854775807.0).is_a?(Integer)
153
+ assert write_and_read_value(BigDecimal("9223372036854775807")).is_a?(Integer)
154
154
  end
155
155
 
156
156
  def test_bigint_min
@@ -159,26 +159,26 @@ class NumericDataTypesTestCases < FbTestCase
159
159
  assert_equal -9223372036854775808, write_and_read_value("-9223372036854775808")
160
160
  #assert_equal -9223372036854775808, write_and_read_value(-9223372036854775808.0)
161
161
  assert_equal -9223372036854775808, write_and_read_value(BigDecimal("-9223372036854775808"))
162
- assert write_and_read_value(-9223372036854775808).is_a?(Bignum)
163
- assert write_and_read_value("-9223372036854775808").is_a?(Bignum)
164
- #assert write_and_read_value(-9223372036854775808.0).is_a?(Bignum)
165
- assert write_and_read_value(BigDecimal("-9223372036854775808")).is_a?(Bignum)
162
+ assert write_and_read_value(-9223372036854775808).is_a?(Integer)
163
+ assert write_and_read_value("-9223372036854775808").is_a?(Integer)
164
+ #assert write_and_read_value(-9223372036854775808.0).is_a?(Integer)
165
+ assert write_and_read_value(BigDecimal("-9223372036854775808")).is_a?(Integer)
166
166
  end
167
167
 
168
168
  def test_bigint_rounding
169
169
  prepare_test_table("bigint")
170
170
  assert_equal 0, write_and_read_value(0.4)
171
171
  assert_equal 0, write_and_read_value("0.4")
172
- assert_equal 0, write_and_read_value(BigDecimal.new("0.4"))
172
+ assert_equal 0, write_and_read_value(BigDecimal("0.4"))
173
173
  assert_equal 0, write_and_read_value(-0.4)
174
174
  assert_equal 0, write_and_read_value("-0.4")
175
- assert_equal 0, write_and_read_value(BigDecimal.new("-0.4"))
175
+ assert_equal 0, write_and_read_value(BigDecimal("-0.4"))
176
176
  assert_equal 1, write_and_read_value(0.5)
177
177
  assert_equal 1, write_and_read_value("0.5")
178
- assert_equal 1, write_and_read_value(BigDecimal.new("0.5"))
178
+ assert_equal 1, write_and_read_value(BigDecimal("0.5"))
179
179
  assert_equal -1, write_and_read_value(-0.5)
180
180
  assert_equal -1, write_and_read_value("-0.5")
181
- assert_equal -1, write_and_read_value(BigDecimal.new("-0.5"))
181
+ assert_equal -1, write_and_read_value(BigDecimal("-0.5"))
182
182
  end
183
183
 
184
184
  def test_bigint_input_type
@@ -205,10 +205,10 @@ class NumericDataTypesTestCases < FbTestCase
205
205
  assert_equal 32767, write_and_read_value("32767")
206
206
  assert_equal 32767, write_and_read_value(32767.0)
207
207
  assert_equal 32767, write_and_read_value(BigDecimal("32767"))
208
- assert write_and_read_value(32767).is_a?(Fixnum)
209
- assert write_and_read_value("32767").is_a?(Fixnum)
210
- assert write_and_read_value(32767.0).is_a?(Fixnum)
211
- assert write_and_read_value(BigDecimal("32767")).is_a?(Fixnum)
208
+ assert write_and_read_value(32767).is_a?(Integer)
209
+ assert write_and_read_value("32767").is_a?(Integer)
210
+ assert write_and_read_value(32767.0).is_a?(Integer)
211
+ assert write_and_read_value(BigDecimal("32767")).is_a?(Integer)
212
212
  end
213
213
 
214
214
  def test_decimal_4_0_min
@@ -217,26 +217,26 @@ class NumericDataTypesTestCases < FbTestCase
217
217
  assert_equal -32768, write_and_read_value("-32768")
218
218
  assert_equal -32768, write_and_read_value(-32768.0)
219
219
  assert_equal -32768, write_and_read_value(BigDecimal("-32768"))
220
- assert write_and_read_value(-32768).is_a?(Fixnum)
221
- assert write_and_read_value("-32768").is_a?(Fixnum)
222
- assert write_and_read_value(-32768.0).is_a?(Fixnum)
223
- assert write_and_read_value(BigDecimal("-32768")).is_a?(Fixnum)
220
+ assert write_and_read_value(-32768).is_a?(Integer)
221
+ assert write_and_read_value("-32768").is_a?(Integer)
222
+ assert write_and_read_value(-32768.0).is_a?(Integer)
223
+ assert write_and_read_value(BigDecimal("-32768")).is_a?(Integer)
224
224
  end
225
225
 
226
226
  def test_decimal_4_0_rounding
227
227
  prepare_test_table("decimal(4, 0)")
228
228
  assert_equal 0, write_and_read_value(0.4)
229
229
  assert_equal 0, write_and_read_value("0.4")
230
- assert_equal 0, write_and_read_value(BigDecimal.new("0.4"))
230
+ assert_equal 0, write_and_read_value(BigDecimal("0.4"))
231
231
  assert_equal 0, write_and_read_value(-0.4)
232
232
  assert_equal 0, write_and_read_value("-0.4")
233
- assert_equal 0, write_and_read_value(BigDecimal.new("-0.4"))
233
+ assert_equal 0, write_and_read_value(BigDecimal("-0.4"))
234
234
  assert_equal 1, write_and_read_value(0.5)
235
235
  assert_equal 1, write_and_read_value("0.5")
236
- assert_equal 1, write_and_read_value(BigDecimal.new("0.5"))
236
+ assert_equal 1, write_and_read_value(BigDecimal("0.5"))
237
237
  assert_equal -1, write_and_read_value(-0.5)
238
238
  assert_equal -1, write_and_read_value("-0.5")
239
- assert_equal -1, write_and_read_value(BigDecimal.new("-0.5"))
239
+ assert_equal -1, write_and_read_value(BigDecimal("-0.5"))
240
240
  end
241
241
 
242
242
  def test_decimal_4_0_input_type
@@ -263,10 +263,10 @@ class NumericDataTypesTestCases < FbTestCase
263
263
  assert_equal 2147483647, write_and_read_value("2147483647")
264
264
  assert_equal 2147483647, write_and_read_value(2147483647.0)
265
265
  assert_equal 2147483647, write_and_read_value(BigDecimal("2147483647"))
266
- assert write_and_read_value(2147483647).is_a?(Fixnum)
267
- assert write_and_read_value("2147483647").is_a?(Fixnum)
268
- assert write_and_read_value(2147483647.0).is_a?(Fixnum)
269
- assert write_and_read_value(BigDecimal("2147483647")).is_a?(Fixnum)
266
+ assert write_and_read_value(2147483647).is_a?(Integer)
267
+ assert write_and_read_value("2147483647").is_a?(Integer)
268
+ assert write_and_read_value(2147483647.0).is_a?(Integer)
269
+ assert write_and_read_value(BigDecimal("2147483647")).is_a?(Integer)
270
270
  end
271
271
 
272
272
  def test_decimal_9_0_min
@@ -275,26 +275,26 @@ class NumericDataTypesTestCases < FbTestCase
275
275
  assert_equal 2147483647, write_and_read_value("2147483647")
276
276
  assert_equal 2147483647, write_and_read_value(2147483647.0)
277
277
  assert_equal 2147483647, write_and_read_value(BigDecimal("2147483647"))
278
- assert write_and_read_value(2147483647).is_a?(Fixnum)
279
- assert write_and_read_value("2147483647").is_a?(Fixnum)
280
- assert write_and_read_value(2147483647.0).is_a?(Fixnum)
281
- assert write_and_read_value(BigDecimal("2147483647")).is_a?(Fixnum)
278
+ assert write_and_read_value(2147483647).is_a?(Integer)
279
+ assert write_and_read_value("2147483647").is_a?(Integer)
280
+ assert write_and_read_value(2147483647.0).is_a?(Integer)
281
+ assert write_and_read_value(BigDecimal("2147483647")).is_a?(Integer)
282
282
  end
283
283
 
284
284
  def test_decimal_9_0_rounding
285
285
  prepare_test_table("decimal(9, 0)")
286
286
  assert_equal 0, write_and_read_value(0.4)
287
287
  assert_equal 0, write_and_read_value("0.4")
288
- assert_equal 0, write_and_read_value(BigDecimal.new("0.4"))
288
+ assert_equal 0, write_and_read_value(BigDecimal("0.4"))
289
289
  assert_equal 0, write_and_read_value(-0.4)
290
290
  assert_equal 0, write_and_read_value("-0.4")
291
- assert_equal 0, write_and_read_value(BigDecimal.new("-0.4"))
291
+ assert_equal 0, write_and_read_value(BigDecimal("-0.4"))
292
292
  assert_equal 1, write_and_read_value(0.5)
293
293
  assert_equal 1, write_and_read_value("0.5")
294
- assert_equal 1, write_and_read_value(BigDecimal.new("0.5"))
294
+ assert_equal 1, write_and_read_value(BigDecimal("0.5"))
295
295
  assert_equal -1, write_and_read_value(-0.5)
296
296
  assert_equal -1, write_and_read_value("-0.5")
297
- assert_equal -1, write_and_read_value(BigDecimal.new("-0.5"))
297
+ assert_equal -1, write_and_read_value(BigDecimal("-0.5"))
298
298
  end
299
299
 
300
300
  def test_decimal_9_0_input_type
@@ -339,16 +339,16 @@ class NumericDataTypesTestCases < FbTestCase
339
339
  prepare_test_table("decimal(9, 4)")
340
340
  assert_equal 0, write_and_read_value(0.00004)
341
341
  assert_equal 0, write_and_read_value("0.00004")
342
- assert_equal 0, write_and_read_value(BigDecimal.new("0.00004"))
342
+ assert_equal 0, write_and_read_value(BigDecimal("0.00004"))
343
343
  assert_equal 0, write_and_read_value(-0.00004)
344
344
  assert_equal 0, write_and_read_value("-0.00004")
345
- assert_equal 0, write_and_read_value(BigDecimal.new("-0.00004"))
345
+ assert_equal 0, write_and_read_value(BigDecimal("-0.00004"))
346
346
  assert_equal BigDecimal('0.0001'), write_and_read_value(0.00005)
347
347
  assert_equal BigDecimal('0.0001'), write_and_read_value("0.00005")
348
- assert_equal BigDecimal('0.0001'), write_and_read_value(BigDecimal.new("0.00005"))
348
+ assert_equal BigDecimal('0.0001'), write_and_read_value(BigDecimal("0.00005"))
349
349
  assert_equal BigDecimal('-0.0001'), write_and_read_value(-0.00005)
350
350
  assert_equal BigDecimal('-0.0001'), write_and_read_value("-0.00005")
351
- assert_equal BigDecimal('-0.0001'), write_and_read_value(BigDecimal.new("-0.00005"))
351
+ assert_equal BigDecimal('-0.0001'), write_and_read_value(BigDecimal("-0.00005"))
352
352
  end
353
353
 
354
354
  def test_decimal_9_4_input_type
@@ -393,16 +393,16 @@ class NumericDataTypesTestCases < FbTestCase
393
393
  prepare_test_table("decimal(9, 9)")
394
394
  assert_equal 0, write_and_read_value(0.0000000004)
395
395
  assert_equal 0, write_and_read_value("0.0000000004")
396
- assert_equal 0, write_and_read_value(BigDecimal.new("0.0000000004"))
396
+ assert_equal 0, write_and_read_value(BigDecimal("0.0000000004"))
397
397
  assert_equal 0, write_and_read_value(-0.0000000004)
398
398
  assert_equal 0, write_and_read_value("-0.0000000004")
399
- assert_equal 0, write_and_read_value(BigDecimal.new("-0.0000000004"))
399
+ assert_equal 0, write_and_read_value(BigDecimal("-0.0000000004"))
400
400
  assert_equal BigDecimal("0.000000001"), write_and_read_value(0.0000000005)
401
401
  assert_equal BigDecimal("0.000000001"), write_and_read_value("0.0000000005")
402
- assert_equal BigDecimal("0.000000001"), write_and_read_value(BigDecimal.new("0.0000000005"))
402
+ assert_equal BigDecimal("0.000000001"), write_and_read_value(BigDecimal("0.0000000005"))
403
403
  assert_equal BigDecimal("-0.000000001"), write_and_read_value(-0.0000000005)
404
404
  assert_equal BigDecimal("-0.000000001"), write_and_read_value("-0.0000000005")
405
- assert_equal BigDecimal("-0.000000001"), write_and_read_value(BigDecimal.new("-0.0000000005"))
405
+ assert_equal BigDecimal("-0.000000001"), write_and_read_value(BigDecimal("-0.0000000005"))
406
406
  end
407
407
 
408
408
  def test_decimal_9_9_input_type
@@ -429,10 +429,10 @@ class NumericDataTypesTestCases < FbTestCase
429
429
  assert_equal 9223372036854775807, write_and_read_value("9223372036854775807")
430
430
  #assert_equal 9223372036854775807, write_and_read_value(9223372036854775807.0)
431
431
  assert_equal 9223372036854775807, write_and_read_value(BigDecimal("9223372036854775807"))
432
- assert write_and_read_value(9223372036854775807).is_a?(Bignum)
433
- assert write_and_read_value("9223372036854775807").is_a?(Bignum)
434
- #assert write_and_read_value(9223372036854775807.0).is_a?(Bignum)
435
- assert write_and_read_value(BigDecimal("9223372036854775807")).is_a?(Bignum)
432
+ assert write_and_read_value(9223372036854775807).is_a?(Integer)
433
+ assert write_and_read_value("9223372036854775807").is_a?(Integer)
434
+ #assert write_and_read_value(9223372036854775807.0).is_a?(Integer)
435
+ assert write_and_read_value(BigDecimal("9223372036854775807")).is_a?(Integer)
436
436
  end
437
437
 
438
438
  def test_decimal_18_0_min
@@ -441,26 +441,26 @@ class NumericDataTypesTestCases < FbTestCase
441
441
  assert_equal -9223372036854775808, write_and_read_value("-9223372036854775808")
442
442
  #assert_equal -9223372036854775808, write_and_read_value(-9223372036854775808.0)
443
443
  assert_equal -9223372036854775808, write_and_read_value(BigDecimal("-9223372036854775808"))
444
- assert write_and_read_value(-9223372036854775808).is_a?(Bignum)
445
- assert write_and_read_value("-9223372036854775808").is_a?(Bignum)
446
- #assert write_and_read_value(-9223372036854775808.0).is_a?(Bignum)
447
- assert write_and_read_value(BigDecimal("-9223372036854775808")).is_a?(Bignum)
444
+ assert write_and_read_value(-9223372036854775808).is_a?(Integer)
445
+ assert write_and_read_value("-9223372036854775808").is_a?(Integer)
446
+ #assert write_and_read_value(-9223372036854775808.0).is_a?(Integer)
447
+ assert write_and_read_value(BigDecimal("-9223372036854775808")).is_a?(Integer)
448
448
  end
449
449
 
450
450
  def test_decimal_18_0_rounding
451
451
  prepare_test_table("decimal(18, 0)")
452
452
  assert_equal 0, write_and_read_value(0.4)
453
453
  assert_equal 0, write_and_read_value("0.4")
454
- assert_equal 0, write_and_read_value(BigDecimal.new("0.4"))
454
+ assert_equal 0, write_and_read_value(BigDecimal("0.4"))
455
455
  assert_equal 0, write_and_read_value(-0.4)
456
456
  assert_equal 0, write_and_read_value("-0.4")
457
- assert_equal 0, write_and_read_value(BigDecimal.new("-0.4"))
457
+ assert_equal 0, write_and_read_value(BigDecimal("-0.4"))
458
458
  assert_equal 1, write_and_read_value(0.5)
459
459
  assert_equal 1, write_and_read_value("0.5")
460
- assert_equal 1, write_and_read_value(BigDecimal.new("0.5"))
460
+ assert_equal 1, write_and_read_value(BigDecimal("0.5"))
461
461
  assert_equal -1, write_and_read_value(-0.5)
462
462
  assert_equal -1, write_and_read_value("-0.5")
463
- assert_equal -1, write_and_read_value(BigDecimal.new("-0.5"))
463
+ assert_equal -1, write_and_read_value(BigDecimal("-0.5"))
464
464
  end
465
465
 
466
466
  def test_decimal_18_0_input_types
@@ -505,16 +505,16 @@ class NumericDataTypesTestCases < FbTestCase
505
505
  prepare_test_table("decimal(18, 9)")
506
506
  assert_equal 0, write_and_read_value(0.0000000004)
507
507
  assert_equal 0, write_and_read_value("0.0000000004")
508
- assert_equal 0, write_and_read_value(BigDecimal.new("0.0000000004"))
508
+ assert_equal 0, write_and_read_value(BigDecimal("0.0000000004"))
509
509
  assert_equal 0, write_and_read_value(-0.0000000004)
510
510
  assert_equal 0, write_and_read_value("-0.0000000004")
511
- assert_equal 0, write_and_read_value(BigDecimal.new("-0.0000000004"))
511
+ assert_equal 0, write_and_read_value(BigDecimal("-0.0000000004"))
512
512
  assert_equal BigDecimal('0.000000001'), write_and_read_value(0.0000000005)
513
513
  assert_equal BigDecimal('0.000000001'), write_and_read_value("0.0000000005")
514
- assert_equal BigDecimal('0.000000001'), write_and_read_value(BigDecimal.new("0.0000000005"))
514
+ assert_equal BigDecimal('0.000000001'), write_and_read_value(BigDecimal("0.0000000005"))
515
515
  assert_equal BigDecimal('-0.000000001'), write_and_read_value(-0.0000000005)
516
516
  assert_equal BigDecimal('-0.000000001'), write_and_read_value("-0.0000000005")
517
- assert_equal BigDecimal('-0.000000001'), write_and_read_value(BigDecimal.new("-0.0000000005"))
517
+ assert_equal BigDecimal('-0.000000001'), write_and_read_value(BigDecimal("-0.0000000005"))
518
518
  end
519
519
 
520
520
  def test_decimal_18_9_input_type
@@ -559,16 +559,16 @@ class NumericDataTypesTestCases < FbTestCase
559
559
  prepare_test_table("decimal(18, 18)")
560
560
  assert_equal 0, write_and_read_value(0.0000000000000000004)
561
561
  assert_equal 0, write_and_read_value("0.0000000000000000004")
562
- assert_equal 0, write_and_read_value(BigDecimal.new("0.0000000000000000004"))
562
+ assert_equal 0, write_and_read_value(BigDecimal("0.0000000000000000004"))
563
563
  assert_equal 0, write_and_read_value(-0.0000000000000000004)
564
564
  assert_equal 0, write_and_read_value("-0.0000000000000000004")
565
- assert_equal 0, write_and_read_value(BigDecimal.new("-0.0000000000000000004"))
565
+ assert_equal 0, write_and_read_value(BigDecimal("-0.0000000000000000004"))
566
566
  assert_equal BigDecimal("0.000000000000000001"), write_and_read_value(0.0000000000000000005)
567
567
  assert_equal BigDecimal("0.000000000000000001"), write_and_read_value("0.0000000000000000005")
568
- assert_equal BigDecimal("0.000000000000000001"), write_and_read_value(BigDecimal.new("0.0000000000000000005"))
568
+ assert_equal BigDecimal("0.000000000000000001"), write_and_read_value(BigDecimal("0.0000000000000000005"))
569
569
  assert_equal BigDecimal("-0.000000000000000001"), write_and_read_value(-0.0000000000000000005)
570
570
  assert_equal BigDecimal("-0.000000000000000001"), write_and_read_value("-0.0000000000000000005")
571
- assert_equal BigDecimal("-0.000000000000000001"), write_and_read_value(BigDecimal.new("-0.0000000000000000005"))
571
+ assert_equal BigDecimal("-0.000000000000000001"), write_and_read_value(BigDecimal("-0.0000000000000000005"))
572
572
  end
573
573
 
574
574
  def test_decimal_18_18_input_type
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
4
+ version: 0.9.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brent Rowland