labath added inline comments.

================
Comment at: lldb/unittests/Utility/TimerTest.cpp:100-101
+      << "String: " << ss.GetData();
+  EXPECT_GT(total1 - child1, seconds1 - 0.001);
+  EXPECT_LT(total1 - child1, seconds1 + 0.001);
+  EXPECT_EQ(1, count1);
----------------
aadsm wrote:
> labath wrote:
> > aadsm wrote:
> > > davide wrote:
> > > > this seems ... very fragile.
> > > that's a good point. I'm not that familiar with the ieee754 to know 
> > > what's a safe interval here, do you know?
> > I think you want to use `EXPECT_DOUBLE_EQ` here.
> It still doesn't help me :(
> 
> ```
> Expected: total1 - child1
>       Which is: 0.099999999999999992
> To be equal to: seconds1
>       Which is: 0.10011115499999999
> ```
Ah, ok I see now.. You need smaller precision because two of the numbers are 
only printed with three decimal spaces. In that case, you can do 
`EXPECT_NEAR(a-b, c, 0.002)`. ( I chose 0.002 instead of 0.001 just in case 
it's possible for rounding errors to add up to over 0.001 --- cca. 0.0005 for 
`a`, ~0.0005 for `b` and ~0.0...05 for `c`).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D61235/new/

https://reviews.llvm.org/D61235



_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to