1
0
Fork 0

ipa: Move the IPATests to a new file

This commit is contained in:
Holger Hans Peter Freyther 2012-07-29 09:57:46 +02:00
parent 02ad06bad6
commit 9939be4ff3
3 changed files with 71 additions and 52 deletions

70
IPATests.st Normal file
View File

@ -0,0 +1,70 @@
"
(C) 2010-2011 by Holger Hans Peter Freyther
All Rights Reserved
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
"
TestCase subclass: IPATests [
| called |
IPATests class >> packageNamesUnderTest [
<category: 'accessing'>
^ #('OsmoNetwork')
]
testSize [
self assert: IPASCCPState sizeof = 25.
]
testMux [
| data mux |
mux := IPAMuxer new.
data := {
{mux prepareNext: #(1 2 3) with: IPAConstants protocolOML.
#(0 3 255 1 2 3) asByteArray}.
{mux prepareNext: #(1 2 3) with: IPAConstants protocolOsmoMGCP.
#(0 4 238 1 1 2 3) asByteArray}.
}.
data do: [:each |
self assert: each first = each second.]
]
testDispatch [
| dispatch |
<category: 'dispatch-test'>
called := false.
dispatch := IPADispatcher new
addHandler: 16r23 on: self with: #dispatchcallback:;
yourself.
dispatch dispatch: 16r23 with: 'data'.
self assert: called.
called := false.
dispatch
addHandler: 16r42 on: [:msg | called := msg = 'data' ];
dispatch: 16r42 with: 'data'.
self assert: called.
]
dispatchcallback: aData [
<category: 'dispatch-test'>
called := aData = 'data'.
]
]

View File

@ -200,58 +200,6 @@ TestCase subclass: SCCPTests [
]
]
TestCase subclass: IPATests [
| called |
IPATests class >> packageNamesUnderTest [
<category: 'accessing'>
^ #('OsmoNetwork')
]
testSize [
self assert: IPASCCPState sizeof = 25.
]
testMux [
| data mux |
mux := IPAMuxer new.
data := {
{mux prepareNext: #(1 2 3) with: IPAConstants protocolOML.
#(0 3 255 1 2 3) asByteArray}.
{mux prepareNext: #(1 2 3) with: IPAConstants protocolOsmoMGCP.
#(0 4 238 1 1 2 3) asByteArray}.
}.
data do: [:each |
self assert: each first = each second.]
]
testDispatch [
| dispatch |
<category: 'dispatch-test'>
called := false.
dispatch := IPADispatcher new
addHandler: 16r23 on: self with: #dispatchcallback:;
yourself.
dispatch dispatch: 16r23 with: 'data'.
self assert: called.
called := false.
dispatch
addHandler: 16r42 on: [:msg | called := msg = 'data' ];
dispatch: 16r42 with: 'data'.
self assert: called.
]
dispatchcallback: aData [
<category: 'dispatch-test'>
called := aData = 'data'.
]
]
TestCase subclass: MessageBufferTest [
testAdd [
| msg1 msg2 msg3 msg_master |

View File

@ -26,6 +26,7 @@
<sunit>Osmo.ISUPGeneratedTest</sunit>
<filein>Tests.st</filein>
<filein>ISUPTests.st</filein>
<filein>IPATests.st</filein>
</test>