RegressionTests__UninterpretedBytesTest.st
changeset 1113 7e24c992441b
child 1357 6d1158181ddc
child 1485 5a1aadddbc7f
equal deleted inserted replaced
1112:f462798b6a1d 1113:7e24c992441b
       
     1 "{ Package: 'exept:regression' }"
       
     2 
       
     3 "{ NameSpace: RegressionTests }"
       
     4 
       
     5 TestCase subclass:#UninterpretedBytesTest
       
     6 	instanceVariableNames:''
       
     7 	classVariableNames:''
       
     8 	poolDictionaries:''
       
     9 	category:'tests-Regression-Collections'
       
    10 !
       
    11 
       
    12 
       
    13 !UninterpretedBytesTest methodsFor:'tests'!
       
    14 
       
    15 testFloatAccess
       
    16     |bytes|
       
    17 
       
    18     bytes := ByteArray new:4.
       
    19     bytes floatAt:1 put:1.234.
       
    20     self assert:(bytes = #[182 243 157 63]).
       
    21 
       
    22     bytes floatAt:1 put:2.345 asShortFloat.
       
    23     self assert:(bytes = #[123 20 22 64]).
       
    24 
       
    25     bytes floatAt:1 put:345.
       
    26     self assert:(bytes = #[0 128 172 67]).
       
    27 
       
    28 
       
    29     bytes := ByteArray new:8.
       
    30     bytes doubleAt:1 put:1.234.
       
    31     self assert:(bytes = #[88 57 180 200 118 190 243 63]).
       
    32 
       
    33     bytes doubleAt:1 put:2.345 asShortFloat.
       
    34     self assert:(bytes = #[0 0 0 96 143 194 2 64]).
       
    35 
       
    36     bytes doubleAt:1 put:345.
       
    37     self assert:(bytes = #[0 0 0 0 0 144 117 64]).
       
    38 
       
    39     "
       
    40      self run:#testFloatAccess
       
    41     "
       
    42 ! !
       
    43 
       
    44 !UninterpretedBytesTest class methodsFor:'documentation'!
       
    45 
       
    46 version
       
    47     ^ '$Header$'
       
    48 !
       
    49 
       
    50 version_CVS
       
    51     ^ '$Header$'
       
    52 ! !
       
    53