THRIFT-3456 rounding issue in static assert
Client: D
Patch: Nikolay Tolstokulakov
This closes #726
diff --git a/lib/d/src/thrift/codegen/idlgen.d b/lib/d/src/thrift/codegen/idlgen.d
index 1cb4c1f..9f88936 100644
--- a/lib/d/src/thrift/codegen/idlgen.d
+++ b/lib/d/src/thrift/codegen/idlgen.d
@@ -551,7 +551,7 @@
struct WithDefaults {
string a = "asdf";
- double b = 1.0e+20;
+ double b = 3.1415;
WithoutMeta c;
mixin TStructHelpers!([
@@ -641,13 +641,16 @@
}
`);
- 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 {