summaryrefslogtreecommitdiff
path: root/test/DoubleConstantsTest.thrift
diff options
context:
space:
mode:
authorOzan Can Altiok <ozan@unscrambl.com>2018-03-20 15:02:28 +0300
committerJames E. King III <jking@apache.org>2018-03-20 16:28:15 -0400
commite46419b5ecb8e430d8555c2d5fbcffbc6a91ff83 (patch)
tree888f59c716c6ec5f5ee9715b6e06410e1d9a5d97 /test/DoubleConstantsTest.thrift
parentb4960838a3b20e6bcf61727f21214a47418a2ca5 (diff)
downloadthrift-e46419b5ecb8e430d8555c2d5fbcffbc6a91ff83.tar.gz
THRIFT-4476: Typecasting problem on double list items,
emitting doubles with high precision Client: cpp Client: erl Client: java Client: js Client: py This closes #1511
Diffstat (limited to 'test/DoubleConstantsTest.thrift')
-rw-r--r--test/DoubleConstantsTest.thrift17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/DoubleConstantsTest.thrift b/test/DoubleConstantsTest.thrift
new file mode 100644
index 000000000..c9212abbb
--- /dev/null
+++ b/test/DoubleConstantsTest.thrift
@@ -0,0 +1,17 @@
+namespace java thrift.test
+namespace cpp thrift.test
+
+// more tests on double constants (precision and type checks)
+const double DOUBLE_ASSIGNED_TO_INT_CONSTANT_TEST = 1
+const double DOUBLE_ASSIGNED_TO_NEGATIVE_INT_CONSTANT_TEST = -100
+const double DOUBLE_ASSIGNED_TO_LARGEST_INT_CONSTANT_TEST = 9223372036854775807
+const double DOUBLE_ASSIGNED_TO_SMALLEST_INT_CONSTANT_TEST = -9223372036854775807
+const double DOUBLE_ASSIGNED_TO_DOUBLE_WITH_MANY_DECIMALS_TEST = 3.14159265359
+const double DOUBLE_ASSIGNED_TO_FRACTIONAL_DOUBLE_TEST = 1000000.1
+const double DOUBLE_ASSIGNED_TO_NEGATIVE_FRACTIONAL_DOUBLE_TEST = -1000000.1
+const double DOUBLE_ASSIGNED_TO_LARGE_DOUBLE_TEST = 1.7e+308
+const double DOUBLE_ASSIGNED_TO_LARGE_FRACTIONAL_DOUBLE_TEST = 9223372036854775816.43
+const double DOUBLE_ASSIGNED_TO_SMALL_DOUBLE_TEST = -1.7e+308
+const double DOUBLE_ASSIGNED_TO_NEGATIVE_BUT_LARGE_FRACTIONAL_DOUBLE_TEST = -9223372036854775816.43
+
+const list<double> DOUBLE_LIST_TEST = [1,-100,100,9223372036854775807,-9223372036854775807,3.14159265359,1000000.1,-1000000.1,1.7e+308,-1.7e+308,9223372036854775816.43,-9223372036854775816.43]