Uploaded image for project: 'Mesos'
  1. Mesos
  2. MESOS-4272

DurationTest.Arithmetic performs inexact float calculation in test

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: test
    • Labels:
      None
    • Target Version/s:
    • Sprint:
      Mesosphere Sprint 26
    • Story Points:
      1

      Description

      DurationTest.Arithmetic does a calculation with not exactly representable floating point values and also performs an equality check,

      EXPECT_EQ(Duration::create(3.3).get(), Seconds(10) * 0.33);
      

      Here neither the value 3.3 nor 0.33 cannot be represented exactly as a floating point number so the check might fail incorrectly (as it does e.g. when compiling and executing the test under 32-bit on Debian8).

      Instead we should just use exactly representable values to make sure the test will succeed as long as the implementation behaves as expected.

        Attachments

          Activity

            People

            • Assignee:
              bbannier Benjamin Bannier
              Reporter:
              bbannier Benjamin Bannier
              Shepherd:
              Till Toenshoff
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: