Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-783

QTest real value comparison with precision

    XMLWordPrintable

Details

    Description

      It would be very helpfull to have a makro, that compares real values like (float, double, long double) againts an expected value with a precision.

      e.g. QCOMPARE_REAL(actual, expect, precision) QVERIFY(qAbs((expect) - (actual)) < prec)
      but with a more well-defined output

      so that you can use
      QCOMPARE_REAL(sqrt(2), 1.4, 0.1)
      QCOMPARE_REAL(foo(), 1., 0.0005)
      QCOMPARE_REAL(123.456, 123.455987, 0.00001)

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            jasmcdon Jason McDonald (Closed Nokia Identity. Please assign to "macadder" instead) (Inactive)
            sanonymous Nokia Qt Support (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes