RegressionTests__MiscArithmeticTests.st
author Claus Gittinger <cg@exept.de>
Tue, 09 Jul 2019 18:53:03 +0200
changeset 2327 bf482d49aeaf
parent 2325 070a15489964
child 2414 8cf9b2d022f5
permissions -rw-r--r--
#QUALITY by exept class: RegressionTests::StringTests added: #test82c_expanding

"{ 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
    <pragma: +STXExtendedArrayLiterals>

    "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$'
! !