[squeak-dev] RawBitsArray vs. DataStream

Eliot Miranda eliot.miranda at gmail.com
Tue Nov 22 12:56:52 UTC 2022


On Tue, Nov 22, 2022 at 4:54 AM Marcel Taeumel <marcel.taeumel at hpi.de>
wrote:

> 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.
> ;-)
>

Interesting! The test worked second time for me (I used "instance first
class = Color", which is false since in that case "instance first class =
TransparentColor :-) ). That's 64 bits macOS.

Are you seeing this on 32-bit Windows? or...?



> 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>
> 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
>
>
>

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


More information about the Squeak-dev mailing list