smalltalk
/
osmo-st-smpp
Archived
1
0
Fork 0

header: Implement writing a header to a stream

This commit is contained in:
Holger Hans Peter Freyther 2014-04-24 20:30:01 +02:00
parent 38bca78f5b
commit fea5159aa7
2 changed files with 17 additions and 0 deletions

View File

@ -57,4 +57,11 @@ Object subclass: SMPPPDUHeader [
sequenceNumber: aNumber [
sequenceNumber := aNumber
]
writeOn: aMsg [
aMsg
putLen32: commandId;
putLen32: commandStatus;
putLen32: sequenceNumber
]
]

View File

@ -27,4 +27,14 @@ TestCase subclass: SMPPPDUHeaderTest [
self assert: hdr commandStatus equals: 0.
self assert: hdr sequenceNumber equals: 1.
]
testWrite [
| data |
data := (SMPPPDUHeader new
commandId: 2;
commandStatus: 0;
sequenceNumber: 1;
toMessage) asByteArray.
self assert: data equals: #[0 0 0 2 0 0 0 0 0 0 0 1].
]
]