1
0
Fork 0

Test: Add test cases for some simple stuff...

This commit is contained in:
Holger Hans Peter Freyther 2010-10-16 19:28:35 +02:00
parent ffcb975825
commit 457f4406a5
3 changed files with 38 additions and 5 deletions

10
SCCP.st
View File

@ -39,18 +39,18 @@ Object subclass: SCCPAddrReference [
SCCPAddrReference class >> store: anAddress on: aMsg [
"Store the threee bytes of an sccp address on a messagebuffer"
aMsg putByte: ((anAddress bitAnd: 16r00FF0000) bitShift: -16).
aMsg putByte: ((anAddress bitAnd: 16r0000FF00) bitShift: -8).
aMsg putByte: ((anAddress bitAnd: 16r000000FF) bitShift: -0).
aMsg putByte: ((anAddress bitAnd: 16r0000FF00) bitShift: -8).
aMsg putByte: ((anAddress bitAnd: 16r00FF0000) bitShift: -16).
]
SCCPAddrReference class >> fromCData: anArray [
"Parse from an CArray"
| oct1 oct2 oct3 |
oct1 := (anArray at: 0) bitShift: 16.
oct1 := (anArray at: 0) bitShift: 0.
oct2 := (anArray at: 1) bitShift: 8.
oct3 := (anArray at: 2) bitShift: 0.
oct3 := (anArray at: 2) bitShift: 16.
^ (oct1 bitOr: oct2) bitOr: oct3
]
@ -78,7 +78,7 @@ Object subclass: SCCPConnectionReleased [
SCCPAddrReference store: dst on: msg.
SCCPAddrReference store: src on: msg.
msg putByte: cause.
msg putByte: 0.
msg putByte: 1.
msg putByte: SCCPHelper pncEoO.
^ msg.

27
Tests.st Normal file
View File

@ -0,0 +1,27 @@
"Test Case for Osmo-Network"
TestCase subclass: SCCPTests [
SCCPTests class >> packageNamesUnderTest [
<category: 'accessing'>
^ #('OsmoNetwork')
]
testReleasedFormat [
| rlsd msg |
rlsd := SCCPConnectionReleased initWith: 16r1F0A01 dest: 16r401 cause: 16rFE.
msg := rlsd toMessage toByteArray.
self assert: msg = #(4 1 4 0 1 16r0A 16r1F 16rFE 1 0) asByteArray
]
]
TestCase subclass: IPATests [
IPATests class >> packageNamesUnderTest [
<category: 'accessing'>
^ #('OsmoNetwork')
]
testSize [
self assert: IPASCCPState sizeof = 23.
]
]

View File

@ -10,6 +10,12 @@
<filein>MessageBuffer.st</filein>
<filein>SCCP.st</filein>
<test>
<sunit>Osmo.SCCPTests</sunit>
<sunit>Osmo.IPATests</sunit>
<filein>Tests.st</filein>
</test>
<file>Extensions.st</file>
<file>IPAConstants.st</file>