[View]  [Edit]  [Lock]  [References]  [Attachments]  [History]  [Home]  [Changes]  [Search]  [Help] 

test[S8Ref] bool

"should return false for a value of 0"
| buf |
buf := S8Ref alloc: #bool.
buf at: 1 put: 0.
(S8Ref current get: buf) == false ifFalse: [ self error: 'Should be false' ]


"should return false for a value of 1"
| buf |
buf := S8Ref alloc: #bool.
buf at: 1 put: 1.
(S8Ref current get: buf) == true ifFalse: [ self error: 'Should be true' ]


"should write false value as 0"
| buf value |
buf := S8Ref alloc: #bool.
S8Ref current set: buf offset: 0 value: false.
value := buf at: 1.
0 = value ifFalse: [ self error: 'Wrong value' ]


"should write true value as 1"
| buf value |
buf := S8Ref alloc: #bool.
S8Ref current set: buf offset: 0 value: true.
value := buf at: 1.
1 = value ifFalse: [ self error: 'Wrong value (',value,')' ]


"should allow uint8 number values to be written to it"
| buf value |
buf := S8Ref alloc: #bool.
S8Ref current set: buf offset: 0 value: 255.
(S8Ref current get: buf) = true ifFalse: [ self error: 'Should be true' ].
value := buf at: 1.
255 = value ifFalse: [ self error: 'Wrong value (',value,')' ]