| 1 |
/****************************************************************************** |
| 2 |
* Copyright (c) 2000-2021 Ericsson Telecom AB |
| 3 |
* All rights reserved. This program and the accompanying materials |
| 4 |
* are made available under the terms of the Eclipse Public License v2.0 |
| 5 |
* which accompanies this distribution, and is available at |
| 6 |
* https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html |
| 7 |
* |
| 8 |
* Contributors: |
| 9 |
* Balasko, Jeno |
| 10 |
* Raduly, Csaba |
| 11 |
* |
| 12 |
******************************************************************************/ |
| 13 |
module HQ48576Test |
| 14 |
{ |
| 15 |
import from schemas_ericsson_com_pg_hlr_13_5 all; |
| 16 |
|
| 17 |
type component C {} |
| 18 |
|
| 19 |
external function enc_imsi(in ImsiType i) return octetstring |
| 20 |
with { extension "prototype(convert) encode(XER:XER_EXTENDED)" } |
| 21 |
|
| 22 |
external function dec_imsi(in octetstring stream) return ImsiType |
| 23 |
with { extension "prototype (convert) decode(XER:XER_EXTENDED)" } |
| 24 |
|
| 25 |
const charstring c_cali := "<imsiType xmlns='http://schemas.ericsson.com/pg/hlr/13.5/' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xsi:type='xsd:string'>califragilistic</imsiType>\n\n"; |
| 26 |
const octetstring o_cali := char2oct(c_cali); |
| 27 |
|
| 28 |
const charstring c_all := "<imsiType xmlns='http://schemas.ericsson.com/pg/hlr/13.5/'>ALL</imsiType>\n\n"; |
| 29 |
const octetstring o_all := char2oct(c_all); |
| 30 |
|
| 31 |
// Go through the motions with one type. |
| 32 |
// The point of this test is to chec that xsd2ttcn does not crash. |
| 33 |
testcase tc1() runs on C |
| 34 |
{ |
| 35 |
var ImsiType v_result; |
| 36 |
var ImsiType v_imsi := { alt_ := "califragilistic" }; |
| 37 |
var octetstring o := enc_imsi(v_imsi); |
| 38 |
action(o); |
| 39 |
if (match(o, o_cali)) { setverdict(pass); } |
| 40 |
else { setverdict(fail, match(o, o_cali)); } |
| 41 |
v_result := dec_imsi(o); |
| 42 |
if (match(v_result, v_imsi)) { setverdict(pass); } |
| 43 |
else { setverdict(fail, match(v_result, v_imsi)); } |
| 44 |
|
| 45 |
|
| 46 |
v_imsi := { alt_1 := aLL } |
| 47 |
o := enc_imsi(v_imsi); |
| 48 |
action(o); |
| 49 |
if (match(o, o_all)) { setverdict(pass); } |
| 50 |
else { setverdict(fail, match(o, o_all)); } |
| 51 |
v_result := dec_imsi(o); |
| 52 |
// Will be encoded into the first field (alt_) |
| 53 |
var charstring all_ := "ALL"; |
| 54 |
v_imsi := { alt_ := all_ } |
| 55 |
if (match(v_result, v_imsi)) { setverdict(pass); } |
| 56 |
else { setverdict(fail, match(v_result, v_imsi)); } |
| 57 |
} |
| 58 |
|
| 59 |
control { |
| 60 |
execute(tc1()); |
| 61 |
} |
| 62 |
|
| 63 |
} |
| 64 |
|