BSSAP: Test the new BSSAP code to prepend the messages.
This commit is contained in:
parent
f8b0fa8e82
commit
512da52c99
|
@ -0,0 +1,24 @@
|
|||
Object subclass: BSSAPHelper [
|
||||
BSSAPHelper class >> msgManagemnt [ ^ 0 ]
|
||||
BSSAPHelper class >> msgDtap [ ^ 1 ]
|
||||
|
||||
BSSAPHelper class >> prependManagement: aMsg [
|
||||
"Prepent the BSSAP Management header"
|
||||
| tmp |
|
||||
|
||||
tmp := OrderedCollection new.
|
||||
tmp add: self msgManagemnt.
|
||||
tmp add: aMsg size.
|
||||
aMsg prependByteArray: tmp asByteArray.
|
||||
]
|
||||
|
||||
BSSAPHelper class >> prependDTAP: aMsg dlci: sapi [
|
||||
"Prepend the DTAP header"
|
||||
| tmp |
|
||||
tmp := OrderedCollection new.
|
||||
tmp add: self msgDtap.
|
||||
tmp add: sapi.
|
||||
tmp add: aMsg size.
|
||||
aMsg prependByteArray: tmp asByteArray.
|
||||
]
|
||||
]
|
20
Tests.st
20
Tests.st
|
@ -45,3 +45,23 @@ TestCase subclass: GSM0808Test [
|
|||
self assert: buf toByteArray = res
|
||||
]
|
||||
]
|
||||
|
||||
TestCase subclass: BSSAPTest [
|
||||
testPrependManagment [
|
||||
| msg |
|
||||
msg := Osmo.MessageBuffer new.
|
||||
msg putByteArray: #(1 2 3) asByteArray.
|
||||
|
||||
BSSAPHelper prependManagement: msg.
|
||||
self assert: msg toByteArray = #(0 3 1 2 3) asByteArray.
|
||||
]
|
||||
|
||||
testPrependDTAP [
|
||||
| msg |
|
||||
msg := Osmo.MessageBuffer new.
|
||||
msg putByteArray: #(1 2 3) asByteArray.
|
||||
|
||||
BSSAPHelper prependDTAP: msg dlci: 0.
|
||||
self assert: msg toByteArray = #(1 0 3 1 2 3) asByteArray.
|
||||
]
|
||||
]
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
<prereq>OsmoNetwork</prereq>
|
||||
<prereq>OsmoLogging</prereq>
|
||||
|
||||
<filein>BSSAP.st</filein>
|
||||
<filein>BSSMAP.st</filein>
|
||||
<filein>GSM48.st</filein>
|
||||
<filein>Messages.st</filein>
|
||||
|
@ -12,9 +13,11 @@
|
|||
|
||||
<test>
|
||||
<sunit>OsmoTestPhone.GSM0808Test</sunit>
|
||||
<sunit>OsmoTestPhone.BSSAPTest</sunit>
|
||||
<filein>Tests.st</filein>
|
||||
</test>
|
||||
|
||||
<file>BSSAP.st</file>
|
||||
<file>BSSMAP.st</file>
|
||||
<file>Messages.st</file>
|
||||
<file>SCCPHandler.st</file>
|
||||
|
|
Reference in New Issue