Floating Point Accuracy in FIT Tests

Are there any good / best practices for working with floating point values ​​when validating results using a compliance framework?

There are a lot of calculations in our application. In most cases, checking values ​​with an accuracy of more than 6 or 8 digits makes no sense. Therefore, I would like to indicate the accuracy that is used when comparing expected and actual values.

My solution for brute force would be to set the accuracy value and then compare the values ​​in my ColumnFixture containing test cases.

This will result in something like:

!|info.fitnesse.fixturegallery.ColumnFixtureTest|
|firstSummand|secondSummand|precision|expectedResult|calculateSumAndCheck()|
|2.1|3.3|0.0001|5.3|true|

The main drawback of this approach would be that I could not use the comparative functions of fit, but write my own.

+3
1

. Fit ToString() , , , , Fit.

, #, , ( , ..) - "ToStringForComparison()", , .

Edit:

, , , , .

+2

Source: https://habr.com/ru/post/1721665/


All Articles