smalltalk
/
osmo-st-gsm
Archived
1
0
Fork 0
This repository has been archived on 2022-02-17. You can view files and clone it, but cannot push or open issues or pull requests.
osmo-st-gsm/Tests.st

68 lines
1.8 KiB
Smalltalk
Raw Normal View History

TestCase subclass: GSM0808Test [
testLAI [
| lai res |
res := #(16r72 16rF4 16r80) asByteArray.
lai := LAI generateLAI: 274 mnc: 8.
self assert: lai = res.
]
testCellIE [
| ie res msg |
res := #(5 8 0 114 244 128 32 18 117 48) asByteArray.
msg := Osmo.MessageBuffer new.
ie := GSMCellIdentifier initWith: 274 mnc: 8 lac: 8210 ci: 30000.
ie storeOn: msg.
self assert: msg toByteArray = res.
]
testLayer3IE [
| ie res msg |
res := #(23 3 1 2 3) asByteArray.
msg := Osmo.MessageBuffer new.
ie := GSMLayer3Info initWith: #(1 2 3) asByteArray.
ie storeOn: msg.
self assert: msg toByteArray = res.
]
testComplL3 [
| msg buf ie res |
msg := IEMessage initWith: GSM0808Helper msgComplL3.
msg addIe: (GSMCellIdentifier initWith: 274 mnc: 8 lac: 8210 ci: 30000).
msg addIe: (GSMLayer3Info initWith: #(1 2 3) asByteArray).
buf := Osmo.MessageBuffer new.
msg storeOn: buf.
res := #(16r57 16r05 16r08 16r00 16r72 16rF4 16r80 16r20 16r12
16r75 16r30 16r17 16r03 16r01 16r02 16r03) asByteArray.
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.
]
]