GSM48Classmark1: Implement parsing the classmark
This commit is contained in:
parent
86642be3ef
commit
58f2f19c98
12
GSM48.st
12
GSM48.st
|
@ -89,7 +89,19 @@ Object subclass: GSM48Classmark1 [
|
||||||
yourself
|
yourself
|
||||||
]
|
]
|
||||||
|
|
||||||
|
GSM48Classmark1 class >> length: aByteArray [
|
||||||
|
^ 1
|
||||||
|
]
|
||||||
|
|
||||||
|
GSM48Classmark1 class >> parseFrom: aByteArray [
|
||||||
|
^ (self new)
|
||||||
|
cm1: (aByteArray at: 1);
|
||||||
|
yourself
|
||||||
|
]
|
||||||
|
|
||||||
cm1: aCm [ <category: 'creation'> cm1 := aCm ]
|
cm1: aCm [ <category: 'creation'> cm1 := aCm ]
|
||||||
|
cm1 [ ^ cm1 ]
|
||||||
|
|
||||||
writeOnDirect: aMsg [
|
writeOnDirect: aMsg [
|
||||||
<category: 'creation'>
|
<category: 'creation'>
|
||||||
aMsg putByte: cm1.
|
aMsg putByte: cm1.
|
||||||
|
|
4
Tests.st
4
Tests.st
|
@ -140,6 +140,10 @@ TestCase subclass: GSM48Test [
|
||||||
gsm writeOnDirect: msg.
|
gsm writeOnDirect: msg.
|
||||||
|
|
||||||
self assert: msg asByteArray = res.
|
self assert: msg asByteArray = res.
|
||||||
|
|
||||||
|
self assert: (GSM48Classmark1 length: res) = res size.
|
||||||
|
gsm := GSM48Classmark1 parseFrom: res.
|
||||||
|
self assert: gsm cm1 = 16r33.
|
||||||
]
|
]
|
||||||
|
|
||||||
testMI [
|
testMI [
|
||||||
|
|
Reference in New Issue