RegressionTests__MiscArithmeticTests.st
author Stefan Vogel <sv@exept.de>
Tue, 11 Jun 2019 10:34:41 +0200
changeset 2321 32ea6329f5ad
parent 2313 aada90d91658
child 2325 070a15489964
permissions -rw-r--r--
class: stx_goodies_regression class changed: #classNamesAndAttributes make classes autoloaded that stc cannot compile (yet)

"{ Encoding: utf8 }"

"{ Package: 'stx:goodies/regression' }"

"{ NameSpace: RegressionTests }"

TestCase subclass:#MiscArithmeticTests
	instanceVariableNames:''
	classVariableNames:''
	poolDictionaries:''
	category:'tests-Regression-Numbers'
!

!MiscArithmeticTests class methodsFor:'documentation'!

documentation
"
    documentation to be added.

    class:
        <a short class summary here, describing what instances represent>

    responsibilities:    
        <describing what my main role is>

    collaborators:    
        <describing with whom and how I talk to>

    API:
        <public api and main messages>
        
    example:
        <a one-line examples on how to use - can also be in a separate example method>

    implementation:
        <implementation points>

    [author:]
        Claus Gittinger

    [instance variables:]

    [class variables:]

    [see also:]

"
! !

!MiscArithmeticTests methodsFor:'tests'!

test01_sum


    "tests the accumlated error when summing up many floats"

    |arr sum|

    arr := #(1e100 1 -1e100 1) asDoubleArray.
    sum := arr sum.
    sum = 2 ifFalse:[
        Transcript showCR:'ignored expected error in sum'.
    ].
    sum := arr esum.
    self assert:(sum = 2).

    arr := #(1e38 1 -1e38 1) asFloatArray.
    sum := arr sum.
    sum = 2 ifFalse:[
        Transcript showCR:'ignored expected error in sum'.
    ].
    sum := arr esum.
    self assert:(sum = 2).

    "/ same using literals    
    arr := #f32(1e38 1 -1e38 1).
    sum := arr esum.
    self assert:(sum = 2).

    arr := #f64(1e100 1 -1e100 1).
    sum := arr esum.
    self assert:(sum = 2).

    "
     self run:#test01_sum
     self new test01_sum
    "

    "Created: / 09-06-2019 / 10:35:16 / Claus Gittinger"
    "Modified: / 09-06-2019 / 14:20:16 / Claus Gittinger"
! !

!MiscArithmeticTests class methodsFor:'documentation'!

version_CVS
    ^ '$Header$'
! !