/****************************************************************************** * Copyright (c) 2000-2015 Ericsson Telecom AB * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html ******************************************************************************/ module AnnexB2Template { //import from XSD language "XML" all; import from AnnexB2 all; import from Flattener { function flatten }; modulepar boolean AnnexB2Template_verbose := false; #define verbose AnnexB2Template_verbose #include "../macros.ttcnin" type component ic3 {} template C0 t_C0:= { a1 :=1, a2 :=2.0, base :=-1 } const C0container c0ct := { fld1 := { 3, 1.4, 0 } } DECLARE_EXER_ENCODERS(C0, c0); DECLARE_XER_ENCODERS(C0, c0); DECLARE_EXER_ENCODERS(C0container, c0c); DECLARE_XER_ENCODERS(C0container, c0x); DECLARE_EXER_ENCODERS(Cu, cu); DECLARE_XER_ENCODERS(Cu, cu); const universal charstring c0xml := "-1\n\n"; const universal charstring c0nestedstr := "\n" & "\t0\n" & "\n\n" ; const Cu cuval := { "What you say!" } const universal charstring cuxml := "What you say!\n\n"; testcase enc_c0() runs on ic3 { CHECK_METHOD(exer_enc_c0, valueof(t_C0), c0xml); CHECK_METHOD(exer_enc_cu, cuval, cuxml); CHECK_METHOD(exer_enc_c0c, c0ct, c0nestedstr); } testcase dec_c0() runs on ic3 { CHECK_DECODE(exer_dec_cu, cuxml, Cu, cuval); CHECK_DECODE(exer_dec_c0, c0xml, C0, valueof(t_C0)); CHECK_DECODE(exer_dec_c0c, c0nestedstr, C0container, c0ct); CHECK_DECODE(exer_dec_c0c, flatten(c0nestedstr), C0container, c0ct); } DECLARE_XER_ENCODERS(strings, ss); DECLARE_EXER_ENCODERS(strings, ss); const universal charstring three_stooges := "\n" & "\tLarry\n" & "\tCurly\n" & "\tMoe\n" & "\n\n"; const universal charstring three_stooges_b := "\n" & "\t\n" & "\t\tLarry\n" & "\t\tCurly\n" & "\t\tMoe\n" & "\t\n" & "\n\n"; const strings stooges := {{"Larry", "Curly", "Moe"}} testcase enc_strings() runs on ic3 { CHECK_METHOD(exer_enc_ss, stooges, three_stooges); CHECK_METHOD(bxer_enc_ss, stooges, three_stooges_b); var universal charstring three_stooges_c := flatten(three_stooges_b); CHECK_METHOD(cxer_enc_ss, stooges, three_stooges_c); } testcase dec_stooges() runs on ic3 { CHECK_DECODE(exer_dec_ss, three_stooges, strings, stooges); CHECK_DECODE(exer_dec_ss, flatten(three_stooges), strings, stooges); CHECK_DECODE(bxer_dec_ss, three_stooges_b, strings, stooges); } control { execute(enc_c0()); execute(dec_c0()); execute(enc_strings()); execute(dec_stooges()); } } /* -1 */