diff options
| author | Omar Rizwan <omar@omar.website> | 2022-12-05 07:14:51 +0000 |
|---|---|---|
| committer | Omar Rizwan <omar@omar.website> | 2022-12-05 07:14:51 +0000 |
| commit | 07fc041d7bc0793318dd31ebef6ab2da9bcb3fe2 (patch) | |
| tree | 202d978bd50fd5dd4c3cce5c690ea3dedb0e62bf /vendor/math/machineparameters.test | |
| parent | WebSocket server (diff) | |
| download | folk-07fc041d7bc0793318dd31ebef6ab2da9bcb3fe2.tar.gz folk-07fc041d7bc0793318dd31ebef6ab2da9bcb3fe2.zip | |
Vendor tcllib linear algebra
Diffstat (limited to 'vendor/math/machineparameters.test')
| -rw-r--r-- | vendor/math/machineparameters.test | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/vendor/math/machineparameters.test b/vendor/math/machineparameters.test new file mode 100644 index 00000000..2a3f58e1 --- /dev/null +++ b/vendor/math/machineparameters.test @@ -0,0 +1,52 @@ +# -*- tcl -*- +# machineparameters.test -- +# Unit tests for machineparameters.tcl +# +# Copyright 2008 Michael Baudin + +# ------------------------------------------------------------------------- + +source [file join \ + [file dirname [file dirname [file join [pwd] [info script]]]] \ + devtools testutilities.tcl] + +testsNeedTcl 8.5 +testsNeedTcltest 2.1 + +testing { + useLocal machineparameters.tcl math::machineparameters +} + +# ------------------------------------------------------------------------- + +# +# Check all parameters are there +# +test checkall {check epsilon, rounding mode} -setup { + set pp [machineparameters create %AUTO%] + $pp configure -verbose 0 + $pp compute +} -body { + set epsilon [$pp get -epsilon] + set rounding [$pp get -rounding] + set basis [$pp get -basis] + set mantissa [$pp get -mantissa] + set emax [$pp get -exponentmax] + #$pp print + set res {} + # The following property on epsilon must hold false (yes : epsilon is THAT small !) + lappend res [expr {1.0+$epsilon>1.0}] + lappend res [expr {$rounding!=""}] + lappend res [expr {$basis> 1}] + lappend res [expr {$mantissa> 1}] +} -cleanup { + $pp destroy + unset pp +} -result {0 1 1 1} + +# ------------------------------------------------------------------------- +# +# Shutdown tests +# +tcltest::cleanupTests + |
