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

GSM48: Parse the reject cause properly

This commit is contained in:
Holger Hans Peter Freyther 2010-11-24 15:12:48 +01:00
parent 5a4cb78826
commit f396be9541
2 changed files with 47 additions and 0 deletions

View File

@ -215,6 +215,39 @@ Object subclass: GSM48MIdentity [
]
]
Object subclass: GSM48RejectCause [
| cause |
GSM48RejectCause class >> createDefault [
<category: 'creation'>
^ self new
cause: 11;
yourself.
]
GSM48RejectCause class >> length: aByteArray [
^ 1
]
GSM48RejectCause class >> parseFrom: aByteArray [
^ self new
cause: (aByteArray at: 1);
yourself
]
cause [
^ cause
]
cause: aCause [
cause := aCause.
]
writeOnDirect: aMsg [
aMsg putByte: cause.
]
]
IEMessage subclass: GSM48MSG [
<category: 'osmo-message'>

View File

@ -163,6 +163,20 @@ TestCase subclass: GSM48Test [
self assert: gsm imsi = imsi.
]
testRejectCause [
| rej msg target |
target := #(11) asByteArray.
msg := Osmo.MessageBuffer new.
rej := GSM48RejectCause createDefault.
rej writeOnDirect: msg.
self assert: msg asByteArray = target.
self assert: (GSM48RejectCause length: target) = 1.
rej := GSM48RejectCause parseFrom: target.
self assert: rej cause = 11.
]
testLU [
| gsm msg res |