Floating point test guidelines using NUNIT

xiaoxiao2021-04-01  191

Floating point test guidelines using NUNIT

Float and Double), because for some reason, the computer cannot guarantee 100% precise expression of them, it is easy to have some deviations. Therefore, when testing with Assert.Arequals assertions, you must specify an error parameter.

AskERT.Arequal (Expected, Actual, Tolerance ")

Parameter eXpected is a value that is expected; the parameter actual is the actual value actually generated after the code is executed; the parameter Tolerance is an error parameter, which determines how the expected and actual approach are equal (or this parameter determines Expected and What extent is approaching Actual to think that they are equal); the parameter message is the message that will report when Expected and Actual are inconsistent.

For business procedures, it must be accurate to 4 or 5 digits to the decimal point. For scientific calculations, higher precision is required.

See article:

"What should I test? - Right-Bicep

"Test an abnormality in NUNIT !!"

"NUNIT assertion"

转载请注明原文地址:https://www.9cbs.com/read-131174.html

New Post(0)