diff --git a/Tests.st b/Tests.st index 1a97c6b..034055e 100644 --- a/Tests.st +++ b/Tests.st @@ -25,6 +25,15 @@ TestCase subclass: SCCPTests [ ^ #('OsmoNetwork') ] + testCreateForSSN [ + | addr | + addr := SCCPAddress createForSSN: 'hlr'. + self assert: addr subSystemNumber = SCCPAddress ssnHLR. + self assert: addr routedOnSSN. + self assert: addr globalTitle isNil. + self assert: addr pointCode isNil. + ] + testPNCCreate [ | pnc | diff --git a/sccp/SCCPAddress.st b/sccp/SCCPAddress.st index 5c1c809..2e22fbb 100644 --- a/sccp/SCCPAddress.st +++ b/sccp/SCCPAddress.st @@ -41,10 +41,7 @@ Object subclass: SCCPAddress [ SCCPAddress class >> createWith: ssn [ - ^ (SCCPAddress new) - ssn: ssn; - routedOnSSN: true; - yourself + ^self createWith: ssn pointCode: nil ] SCCPAddress class >> createWith: ssn poi: aPointCode [ @@ -62,6 +59,11 @@ Object subclass: SCCPAddress [ yourself ] + SCCPAddress class >> createForSSN: aSymbol [ + + ^ self createWith: (self perform: ('ssn', aSymbol asUppercase) asSymbol) + ] + SCCPAddress class >> parseFrom: aByteArray [ | routed_ssn gti_ind gti len ai ssn pointCode dat |