[View] [Edit] [Lock] [References] [Attachments] [History] [Home] [Changes] [Search] [Help]
test[nodeJS] 051 buffer v4
| hello bf bf2 |
hello := 'Hello World'.
bf := NodeBuffer string: hello.
(bf indexOf: $3) = -1 ifFalse: [ self error: 'Wrong offset 3' ].
(bf indexOf: #World) = 6 ifFalse: [ self error: 'Wrong offset World' ].
bf2 := NodeBuffer string: 'o W'.
(bf indexOf: bf2 json) = 4 ifFalse: [ self error: 'Wrong offset bf2' ].
(bf indexOf: (NodeBuffer size: 2) json) = -1 ifFalse: [ self error: 'Wrong offset 2' ].
bf2 := NodeBuffer size: 20.
bf2 fill: ' '.
(bf indexOf: bf2 json) = -1 ifFalse: [ self error: 'Wrong offset fill' ].
(bf indexOf: 111) = 4 ifFalse: [ self error: 'Wrong offset 111' ].
bf2 := NodeBuffer string: hello.
(NodeBuffer compare: bf with: bf2) = 0 ifFalse: [ self error: 'Wrong compare 1' ].
(bf compare: bf2) = 0 ifFalse: [ self error: 'Wrong compare instance' ].
bf2 := NodeBuffer string: 'Hello Worl '.
(NodeBuffer compare: bf with: bf2) = 1 ifFalse: [ self error: 'Wrong compare ?' ].
(bf compare: bf2) = 1 ifFalse: [ self error: 'Wrong compare instance ?' ].
bf2 := NodeBuffer string: 'Hello Worle'.
(NodeBuffer compare: bf with: bf2) = -1 ifFalse: [ self error: 'Wrong compare e' ].
(bf compare: bf2) = -1 ifFalse: [ self error: 'Wrong compare instance e' ].
bf2 := NodeBuffer string: 'Hello'.
(NodeBuffer compare: bf with: bf2) = 1 ifFalse: [ self error: 'Wrong compare 5' ].
(bf compare: bf2) = 1 ifFalse: [ self error: 'Wrong compare instance 5' ].