omdl
v0.6.1
OpenSCAD Mechanical Design Library
|
Function validation methods. More...
Files | |
file | validation.scad |
Function validation methods. | |
Functions | |
function | validate (d, cv, t, ev, p=4, pf=false) |
Compare a computed test value with an known good result. More... | |
Function validation methods.
Example
Result
function validate | ( | d | , |
cv | , | ||
t | , | ||
ev | , | ||
p | = 4 , |
||
pf | = false |
||
) |
Compare a computed test value with an known good result.
d | <string> A description. |
cv | <value> A computed value to validate. |
t | <string|boolean> The validation type. |
ev | <value> The expected good value. |
p | <number> A numerical precision for approximate comparisons. |
pf | <boolean> Report result as pass or fail boolean value. |
validation types | pass if (else fail) |
---|---|
"almost" | cv almost equals ev |
"equals" | cv equals ev |
"not" | cv not equal to ev |
"true" | true | cv is true |
"false" | false | cv is false |
p
. This specifies the number of digits of precision for each numerical comparison. A passing result indicates that cv
equals ev
to the number of decimal digits specified by p
. The comparison is performed by the function almost_equal().