[squeak-dev] RawBitsArray vs. DataStream

Marcel Taeumel marcel.taeumel at hpi.de
Tue Nov 22 12:53:54 UTC 2022


Hi Eliot --

> Write a test :-)

My image freezes. It seems totally broken. That's why I asked. I wanted to learn more about the expected behavior. After that, I could write a test. ;-)

Best,
Marcel
Am 22.11.2022 13:50:30 schrieb Eliot Miranda <eliot.miranda at gmail.com>:
Hi Marcel,


On Tue, Nov 22, 2022 at 1:58 AM Marcel Taeumel <marcel.taeumel at hpi.de [mailto:marcel.taeumel at hpi.de]> wrote:

Hi all --

Should the following work?

class := DoubleByteArray.
size := 10.
dummy := 123.

array := class new: size.
array  atAllPut: dummy.

(DataStream newFileNamed: 'numbers')
nextPut: array;
close.

stream := DataStream fileNamed: 'numbers'. 
load := stream readArray.
stream close.
load explore

Write a test :-)

testRawBits
    ((RawBitsArray subclasses reject: #isAbstract), ((RawBitsArray subclasses select: #isAbstract) collect: #subclasses)) flatten do:
        [:class| | instance |
        instance := class new: 10.
        instance first isColor
            ifTrue:
                [1 to: instance size do: [:i| instance at: i put: (Color r: i * 1 g: i * 2 b: i * 3)]]
            ifFalse:
                [1 to: instance size do: [:i| instance at: i put: i]].
        self assert: instance equals: (self testObject: instance) description: 'A ', class name, ' should be serializable']


see Tests-eem.494


Best,
Marcel



--

_,,,^..^,,,_

best, Eliot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20221122/4d5066c8/attachment.html>


More information about the Squeak-dev mailing list