diff options
author | Nikolay Tolstokulakov <tolstokulakov.n@laximo.ru> | 2015-12-02 09:01:30 +0600 |
---|---|---|
committer | Jens Geyer <jensg@apache.org> | 2015-12-02 21:41:58 +0100 |
commit | 620e7a893a32867b664de4d8b648c8f1811d9f6f (patch) | |
tree | 0614e35de316a6dc4fc19762fe41a3eaeb7ea1c6 /lib/d | |
parent | 3aa617a48341341feb767280eb87da6ea3d05417 (diff) | |
download | thrift-620e7a893a32867b664de4d8b648c8f1811d9f6f.tar.gz |
THRIFT-3456 rounding issue in static assert
Client: D
Patch: Nikolay Tolstokulakov
This closes #726
Diffstat (limited to 'lib/d')
-rw-r--r-- | lib/d/src/thrift/codegen/idlgen.d | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/d/src/thrift/codegen/idlgen.d b/lib/d/src/thrift/codegen/idlgen.d index 1cb4c1fc1..9f889368c 100644 --- a/lib/d/src/thrift/codegen/idlgen.d +++ b/lib/d/src/thrift/codegen/idlgen.d @@ -551,7 +551,7 @@ version (unittest) { struct WithDefaults { string a = "asdf"; - double b = 1.0e+20; + double b = 3.1415; WithoutMeta c; mixin TStructHelpers!([ @@ -641,13 +641,16 @@ version (unittest) { } `); - static assert(structIdlString!WithDefaults == +import std.algorithm; + static assert(structIdlString!WithDefaults.startsWith( `struct WithDefaults { -1: string a = "asdf", - -2: double b = 1.0e+20, - 1: WithoutMeta c = {a: "foo", b: 3, }, + -2: double b = 3.141`)); + + static assert(structIdlString!WithDefaults.endsWith( +`1: WithoutMeta c = {a: "foo", b: 3, }, } -`); +`)); static assert(structIdlString!OneOfEach == `struct OneOfEach { |