aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOliver Smith <osmith@sysmocom.de>2019-06-07 12:27:33 +0200
committerOliver Smith <osmith@sysmocom.de>2019-06-07 12:34:46 +0200
commit05e8a9676732428aab5f9e39e4ecd48d6d98ca99 (patch)
tree73fa419dd8da95ad0de67de5f29acaec6b2bcfe3
parenta37d3002165517e8d0a3965a54dcf9a6b0dd3cb0 (diff)
standalone: add inverted match
-rw-r--r--hlr/HLR_Tests.ttcn15
1 files changed, 10 insertions, 5 deletions
diff --git a/hlr/HLR_Tests.ttcn b/hlr/HLR_Tests.ttcn
index b6bd1adc..21089ddf 100644
--- a/hlr/HLR_Tests.ttcn
+++ b/hlr/HLR_Tests.ttcn
@@ -294,10 +294,15 @@ function f_gen_subs() runs on test_CT return HlrSubscriberList {
return sl;
}
-function f_vty_transceive_match(TELNETasp_PT pt, charstring cmd, template charstring exp_ret) {
+function f_vty_transceive_match(TELNETasp_PT pt, charstring cmd, template charstring exp_ret,
+ boolean invert := false) {
var charstring ret := f_vty_transceive_ret(pt, cmd);
- if (not match(ret, exp_ret)) {
- setverdict(fail, "Non-matching VTY response: ", ret);
+ var boolean is_match := match(ret, exp_ret);
+ if (is_match and invert) {
+ setverdict(fail, "Non-matching VTY response: ", ret, ", should *not* have matched: ", exp_ret);
+ mtc.stop;
+ } else if (not is_match and not invert) {
+ setverdict(fail, "Non-matching VTY response: ", ret, ", should have matched: ", exp_ret);
mtc.stop;
}
}
@@ -346,9 +351,9 @@ function f_vty_subscr_delete(TELNETasp_PT VTY, HlrSubscriber sub) {
}
/* perform 'show' on subscriber; match result with pattern 'exp' */
-function f_vty_subscr_show(TELNETasp_PT VTY, HlrSubscriber sub, template charstring exp) {
+function f_vty_subscr_show(TELNETasp_PT VTY, HlrSubscriber sub, template charstring exp, boolean invert := false) {
var charstring prefix := valueof(t_subscr_prefix(sub.imsi));
- f_vty_transceive_match(VTY, prefix & "show", exp);
+ f_vty_transceive_match(VTY, prefix & "show", exp, invert);
}