1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233
|
.******************************************************************************
.* Copyright (c) 2000-2018 Ericsson Telecom AB
.* All rights reserved. This program and the accompanying materials
.* are made available under the terms of the Eclipse Public License v2.0
.* which accompanies this distribution, and is available at
.* https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html
.*
.* Contributors:
.* Balasko, Jeno
.* Beres, Szabolcs
.* Delic, Adam
.* Kovacs, Ferenc
.* Szabados, Kristof
.* Tarasov, Victor
.*
.******************************************************************************/
:text.
:lang eng.
.*
:docname.Test Description
:docno.8/152 91-CRL 113 200/5 Uen
:rev.C
:date.2015-04-27
.*
:prep.ETH/XZR Kristof Szabados (+36 1 437 7256)
:appr.ETH/XZ (Roland Gecse)
:checked.ETHBAAT
.*
:title.Test Description - OER coder
:contents level=3.
.*---------------------------------------------------------------------*
:h1.PREREQUISITES AND PREPARATIONS
.*---------------------------------------------------------------------*
.*---------------------------------------------------------------------*
:h2.Scope of the Test Object
.*---------------------------------------------------------------------*
:xmp tab=1 nokeep.
This TD contains unified test case related to TTCN3 Executor's OER coder function.
Test case implement the OER codings example from specification ISO/IEC 8825-7:2015
(https://www.itu.int/rec/T-REC-X.696-201508-I)
:exmp.
:p.:us.Revision Information:eus.
:xmp nokeep.
:us.History:eus.
REV DATE PREPARED CHANGE
=== ========== ======== ======
A 2003-10-31 ETHEKR New document
B 2007-03-06 EDMDELI Implicit message encoding
C 2007-03-21 EJNOSZA Bugfix in a testcase for implicit msg. enc.
D 2008-10-01 EFERKOV Big integers
E 2010-01-18 EKRISZA Updated for TITAN R8C
F 2011-06-18 EKRISZA Added tests for errors
A 2011-12-12 EKRISZA Updated for release
PB1 2011-01-30 ETHBAAT Editorial changes
A
:exmp.
.*---------------------------------------------------------------------*
:h2.Test Tools
.*---------------------------------------------------------------------*
:p.:us.Software Tools:eus.
:xmp tab=2 nokeep.
SAtester
:exmp.
:np.
.*---------------------------------------------------------------------*
:h1.REQUIREMENT-BASED TESTS
.*---------------------------------------------------------------------*
.*---------------------------------------------------------------------*
:h2.Testing OER encodings
.*---------------------------------------------------------------------*
.*---------------------------------------------------------------------*
:h3. Example of OER encodings from ISO/IEC 8825-7:2015 Annex A
.*---------------------------------------------------------------------*
:xmp tab=0.
<TC - ISO/IEC 8825-7:2015 Annex A – Example of OER encodings>
<STATIC:ASN>
TempA
DEFINITIONS ::=
BEGIN
IMPORTS;
Date ::= [APPLICATION 3] IMPLICIT VisibleString -- YYYYMMDD
EmployeeNumber ::= [APPLICATION 2] IMPLICIT INTEGER
Name ::= [APPLICATION 1] IMPLICIT SEQUENCE {
givenName VisibleString,
initial VisibleString,
familyName VisibleString }
ChildInformation ::= SET {
name Name,
dateOfBirth [0] Date}
Record ::= [APPLICATION 0] IMPLICIT SET {
name Name,
title [0] VisibleString,
number EmployeeNumber,
dateOfHire [1] Date,
nameOfSpouse [2] Name,
children [3] IMPLICIT SEQUENCE OF ChildInformation DEFAULT {} }
END
<STATIC>
type component Test_CT {}
<TTCN_TC:PURE_EXEC>
import from TempA all;
external function enc_OER_Date(in Date pdu) return octetstring with { extension "prototype(convert) encode(OER)" }
external function dec_OER_Date(in octetstring stream) return Date with { extension "prototype(convert) decode(OER)" }
external function enc_OER_EmployeeNumber(in EmployeeNumber pdu) return octetstring with { extension "prototype(convert) encode(OER)" }
external function dec_OER_EmployeeNumber(in octetstring stream) return EmployeeNumber with { extension "prototype(convert) decode(OER)" }
external function enc_OER_Name(in Name pdu) return octetstring with { extension "prototype(convert) encode(OER)" }
external function dec_OER_Name(in octetstring stream) return Name with { extension "prototype(convert) decode(OER)" }
external function enc_OER_ChildInformation(in ChildInformation pdu) return octetstring with { extension "prototype(convert) encode(OER)" }
external function dec_OER_ChildInformation(in octetstring stream) return ChildInformation with { extension "prototype(convert) decode(OER)" }
external function enc_OER_Record(in Record pdu) return octetstring with { extension "prototype(convert) encode(OER)" }
external function dec_OER_Record(in octetstring stream) return Record with { extension "prototype(convert) decode(OER)" }
//*********************************************
// TESTCASES
//*********************************************
testcase tc_OER_encoding_of_Date() runs on Test_CT {
const Date date := "19710917"
const octetstring raw_encoded := '083139373130393137'O;
if (enc_OER_Date(date) == raw_encoded) {setverdict(pass);} else {setverdict(fail);}
if (dec_OER_Date(raw_encoded) == date) {setverdict(pass);} else {setverdict(fail);}
}
testcase tc_OER_encoding_of_EmployeeNumber() runs on Test_CT {
const EmployeeNumber empl_num := 51
if (enc_OER_EmployeeNumber(empl_num) == '0133'O) {setverdict(pass);} else {setverdict(fail);}
}
testcase tc_OER_encoding_of_Name() runs on Test_CT {
const Name name := {
givenName := "John",
initial := "P",
familyName := "Smith"
}
const octetstring raw_encoded := '044A6F686E015005536D697468'O;
if (enc_OER_Name(name) == raw_encoded) {setverdict(pass);} else {setverdict(fail);}
if (dec_OER_Name(raw_encoded) == name) {setverdict(pass);} else {setverdict(fail);}
}
testcase tc_OER_ChildInformation() runs on Test_CT {
const ChildInformation child := {
name := {
givenName := "Ralph",
initial := "T",
familyName := "Smith"
},
dateOfBirth := "19571111"
}
const octetstring raw_encoded := '0552616C7068015405536D697468083139353731313131'O;
if (enc_OER_ChildInformation(child) == raw_encoded) {setverdict(pass);} else {setverdict(fail);}
if (dec_OER_ChildInformation(raw_encoded) == child) {setverdict(pass);} else {setverdict(fail);}
}
testcase tc_OER_Record() runs on Test_CT {
const octetstring raw_encoded :=
'80044A6F686E015005536D6974680133084469726563746F72083139373130393137044D617279015405536D69746801020552616C7068015405536D69746808313935373131313105537573616E0142054A6F6E6573083139353930373137'O;
const Record rec := {
name := {
givenName := "John",
initial := "P",
familyName := "Smith"},
title := "Director",
number := 51,
dateOfHire := "19710917",
nameOfSpouse := {
givenName := "Mary",
initial := "T",
familyName := "Smith"},
children := {
{ name := {
givenName := "Ralph",
initial := "T",
familyName := "Smith"},
dateOfBirth := "19571111" },
{ name := {
givenName := "Susan",
initial := "B",
familyName := "Jones"},
dateOfBirth := "19590717"}
}
}
if (enc_OER_Record(rec) == raw_encoded) {setverdict(pass);} else {setverdict(fail);}
if (dec_OER_Record(raw_encoded) == rec) {setverdict(pass);} else {setverdict(fail);}
}
//*********************************************
// CONTROL PART
//*********************************************
control {
execute(tc_OER_encoding_of_Date());
execute(tc_OER_encoding_of_EmployeeNumber());
execute(tc_OER_encoding_of_Name());
execute(tc_OER_ChildInformation());
execute(tc_OER_Record());
}
<RESULT>
Overall verdict: pass
<END_TC>
|