Commit | Line | Data |
---|---|---|
970ed795 | 1 | /****************************************************************************** |
3abe9331 | 2 | * Copyright (c) 2000-2015 Ericsson Telecom AB |
970ed795 EL |
3 | * All rights reserved. This program and the accompanying materials |
4 | * are made available under the terms of the Eclipse Public License v1.0 | |
5 | * which accompanies this distribution, and is available at | |
6 | * http://www.eclipse.org/legal/epl-v10.html | |
7 | ******************************************************************************/ | |
8 | module HO21968 { | |
9 | ||
10 | import from titan_HO21968_prefix all; | |
11 | external function enc_pfx(in MySeqPrefix par) return octetstring | |
12 | with { extension "prototype(convert) encode(XER:XER_EXTENDED)" } | |
13 | ||
14 | const MySeqPrefix sp := { | |
15 | i_list := {} | |
16 | } | |
17 | ||
18 | import from titan_HO21968_noprefix all; | |
19 | external function enc_nopfx(in MySeq par) return octetstring | |
20 | with { extension "prototype(convert) encode(XER:XER_EXTENDED)" } | |
21 | ||
22 | const MySeq sn := { | |
23 | i_list := {} | |
24 | } | |
25 | ||
26 | type component C {} | |
27 | ||
28 | ||
29 | // Check that the result of both encodings | |
30 | // 1. Look like the beginning of XML (first character is '<') | |
31 | // 2. Do not look like a made-up prefix ("tq") | |
32 | testcase tcp() runs on C { | |
33 | var octetstring encoded; | |
34 | encoded := enc_pfx(sp); | |
35 | log(encoded); | |
36 | if (encoded[0]==char2oct("<")) { setverdict(pass); } | |
37 | else { setverdict(fail); } | |
38 | if (encoded[1]==char2oct("t") and encoded[2]==char2oct("q")) { setverdict(fail); } | |
39 | else { setverdict(pass); } | |
40 | } | |
41 | ||
42 | testcase tcn() runs on C { | |
43 | var octetstring encoded; | |
44 | encoded := enc_nopfx(sn); | |
45 | log(encoded); | |
46 | if (encoded[0]==char2oct("<")) { setverdict(pass); } | |
47 | else { setverdict(fail); } | |
48 | if (encoded[1]==char2oct("t") and encoded[2]==char2oct("q")) { setverdict(fail); } | |
49 | else { setverdict(pass); } | |
50 | } | |
51 | ||
52 | control { | |
53 | execute(tcp()) | |
54 | execute(tcn()) | |
55 | } | |
56 | ||
57 | } |