smalltalk
/
osmo-st-mgcp
Archived
1
0
Fork 0

Add >>#endpointNumber and add some test cases for it.

This commit is contained in:
Holger Hans Peter Freyther 2014-08-09 21:15:20 +02:00
parent aa8d9b64c6
commit 0ffe0afcb5
2 changed files with 9 additions and 0 deletions

View File

@ -39,6 +39,11 @@ Object subclass: MGCPEndpoint [
^ trunk endpointName: nr. ^ trunk endpointName: nr.
] ]
endpointNumber [
<category: 'accessing'>
^ nr
]
multiplex [ multiplex [
<category: 'names'> <category: 'names'>
^ trunk multiplexFor: nr. ^ trunk multiplexFor: nr.

View File

@ -115,8 +115,10 @@ TestCase subclass: MGCPCommandTest [
| trunk | | trunk |
trunk := MGCPDSTrunk createWithDest: '0.0.0.0' trunkNr: 3. trunk := MGCPDSTrunk createWithDest: '0.0.0.0' trunkNr: 3.
self assert: (self trunk endpointAt: 1) endpointNumber equals: 1.
self assert: (self trunk endpointAt: 1) multiplex = 0. self assert: (self trunk endpointAt: 1) multiplex = 0.
self assert: (self trunk endpointAt: 1) timeslot = 1. self assert: (self trunk endpointAt: 1) timeslot = 1.
self assert: (self trunk endpointAt: 31) endpointNumber equals: 31.
self assert: (self trunk endpointAt: 31) multiplex = 0. self assert: (self trunk endpointAt: 31) multiplex = 0.
self assert: (self trunk endpointAt: 31) timeslot = 31. self assert: (self trunk endpointAt: 31) timeslot = 31.
@ -282,6 +284,7 @@ TestCase subclass: MGCPEndpointAllocTest [
"Initial..." "Initial..."
self assert: endp isUnused. self assert: endp isUnused.
self assert: endp endpointNumber equals: 1.
"Reserve..." "Reserve..."
endp reserve. endp reserve.
@ -332,6 +335,7 @@ TestCase subclass: MGCPEndpointAllocTest [
self assert: (trunk allocateEndpointIfFailure: [true]). self assert: (trunk allocateEndpointIfFailure: [true]).
"now free some endpoints" "now free some endpoints"
self assert: (trunk endpointAt: 20) endpointNumber equals: 20.
(trunk endpointAt: 20) free. (trunk endpointAt: 20) free.
(trunk endpointAt: 5) free. (trunk endpointAt: 5) free.
endp := (trunk allocateEndpointIfFailure: []). endp := (trunk allocateEndpointIfFailure: []).