Commit e3d2cdd0 authored by BenceJanosSzabo's avatar BenceJanosSzabo
Browse files

Added OER negative testing and a fix (Bug 526890) (Bug 526889)



Change-Id: I35b1df71fd2a62eaef3c4cf66789da58ac63b5be
Signed-off-by: default avatarBenceJanosSzabo <bence.janos.szabo@ericsson.com>
parent ff67ec64
......@@ -221,9 +221,15 @@ public:
bool is_subtype_notempty() const
{ size_limit_t sl;
return (subtype==ST_INTEGER && integer_st && !integer_st->is_empty()) ||
(subtype==ST_BITSTRING && bitstring_st && !bitstring_st->is_empty()) ||
(subtype==ST_HEXSTRING && hexstring_st && !hexstring_st->is_empty()) ||
(subtype==ST_OCTETSTRING && octetstring_st && !octetstring_st->is_empty()) ||
(subtype==ST_BITSTRING && bitstring_st && !bitstring_st->is_empty() &&
bitstring_st->get_size_limit(false, sl) == TTRUE &&
bitstring_st->get_size_limit(true, sl) == TTRUE) ||
(subtype==ST_HEXSTRING && hexstring_st && !hexstring_st->is_empty() &&
hexstring_st->get_size_limit(false, sl) == TTRUE &&
hexstring_st->get_size_limit(true, sl) == TTRUE) ||
(subtype==ST_OCTETSTRING && octetstring_st && !octetstring_st->is_empty() &&
octetstring_st->get_size_limit(false, sl) == TTRUE &&
octetstring_st->get_size_limit(true, sl) == TTRUE) ||
(subtype==ST_CHARSTRING && charstring_st &&
charstring_st->get_size_limit(false, sl) == TTRUE &&
charstring_st->get_size_limit(true, sl) == TTRUE) ||
......
......@@ -2371,8 +2371,11 @@ void defUnionClass(struct_def const *sdef, output_struct *output)
if (oer_needed) {
// OER encode
src = mputprintf(src,
"int %s::OER_encode(const TTCN_Typedescriptor_t&, TTCN_Buffer& p_buf) const\n"
"int %s::OER_encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf) const\n"
"{\n", name);
if (use_runtime_2) {
src = mputstr(src, " if (err_descr) return OER_encode_negtest(err_descr, p_td, p_buf);\n");
}
src = mputstr(src, " switch(union_selection) {\n");
for (i = 0; i < sdef->nElements; ++i) {
src = mputprintf(src, " case %s_%s:\n", selection_prefix, sdef->elements[i].name);
......@@ -2410,12 +2413,61 @@ void defUnionClass(struct_def const *sdef, output_struct *output)
"int OER_encode_negtest(const Erroneous_descriptor_t*, "
"const TTCN_Typedescriptor_t&, TTCN_Buffer&) const;\n");
src = mputprintf(src,
"int %s::OER_encode_negtest(const Erroneous_descriptor_t*, "
"const TTCN_Typedescriptor_t&, TTCN_Buffer&) const {\n"
" return 0;\n"
"}\n"
"int %s::OER_encode_negtest(const Erroneous_descriptor_t* p_err_descr, "
"const TTCN_Typedescriptor_t&, TTCN_Buffer& p_buf) const {\n"
, name);
//todo
if (sdef->nElements > 0) {
src = mputstr(src,
" const Erroneous_values_t* err_vals = NULL;\n"
" const Erroneous_descriptor_t* emb_descr = NULL;\n"
" switch(union_selection) {\n");
for (i = 0; i < sdef->nElements; ++i) {
src = mputprintf(src,
" case %s_%s:\n"
" err_vals = p_err_descr->get_field_err_values(%d);\n"
" emb_descr = p_err_descr->get_field_emb_descr(%d);\n"
" if (NULL != err_vals && NULL != err_vals->value) {\n"
" if (NULL != err_vals->value->errval) {\n"
" if(err_vals->value->raw){\n"
" err_vals->value->errval->OER_encode_negtest_raw(p_buf);\n"
" } else {\n"
" if (NULL == err_vals->value->type_descr) {\n"
" TTCN_error(\"internal error: erroneous value typedescriptor missing\");\n"
" }\n"
" encode_oer_tag(*err_vals->value->type_descr->ber, p_buf);\n"
" err_vals->value->errval->OER_encode(*err_vals->value->type_descr, p_buf);\n"
" }\n"
" }\n"
" } else {\n"
" if (NULL != emb_descr) {\n"
" field_%s->OER_encode_negtest(emb_descr, %s_descr_, p_buf);\n"
" } else {\n"
" field_%s->OER_encode(%s_descr_, p_buf);\n"
" }\n"
" }\n"
" break;\n"
, selection_prefix, sdef->elements[i].name, (int)i, (int)i
, sdef->elements[i].name, sdef->elements[i].typedescrname
, sdef->elements[i].name, sdef->elements[i].typedescrname);
}
src = mputprintf(src,
" default:\n"
" TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_UNBOUND, \n"
" \"Encoding an unbound value of type %s.\");\n"
" return -1;\n"
" }\n\n"
" return 0;\n"
"}\n\n"
, dispname);
}
else {
src = mputprintf(src,
" TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_UNBOUND, \n"
" \"Cannot encode union of type %s, because it has zero alternatives.\");\n"
" return -1;\n"
"}\n\n", dispname);
}
}
// OER decode
src = mputprintf(src,
......
......@@ -808,6 +808,15 @@ int OCTETSTRING::JSON_encode_negtest_raw(JSON_Tokenizer& p_tok) const
}
return 0;
}
int OCTETSTRING::OER_encode_negtest_raw(TTCN_Buffer& p_buf) const
{
if (val_ptr != NULL) {
p_buf.put_os(*this);
return val_ptr->n_octets;
}
return 0;
}
#endif
boolean OCTETSTRING::BER_decode_TLV(const TTCN_Typedescriptor_t& p_td,
......
......@@ -161,6 +161,7 @@ public:
* Used during the negative testing of the JSON encoder.
* @return The number of bytes added. */
int JSON_encode_negtest_raw(JSON_Tokenizer&) const;
int OER_encode_negtest_raw(TTCN_Buffer&) const;
#endif
boolean BER_decode_TLV(const TTCN_Typedescriptor_t& p_td,
const ASN_BER_TLV_t& p_tlv, unsigned L_form);
......
......@@ -1666,6 +1666,11 @@ int Record_Of_Type::JSON_decode(const TTCN_Typedescriptor_t& p_td, JSON_Tokenize
}
int Record_Of_Type::OER_encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf) const {
if (err_descr) {
return OER_encode_negtest(err_descr, p_td, p_buf);
}
if (!is_bound()) {
TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_UNBOUND,
"Encoding an unbound %s of value.", is_set() ? "set" : "record");
......@@ -1678,8 +1683,102 @@ int Record_Of_Type::OER_encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p
return 0;
}
int Record_Of_Type::OER_encode_negtest(const Erroneous_descriptor_t*, const TTCN_Typedescriptor_t&, TTCN_Buffer&) const {
//TODO
int Record_Of_Type::OER_encode_negtest(const Erroneous_descriptor_t* p_err_descr, const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf) const {
if (!is_bound()) {
TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_UNBOUND,
"Encoding an unbound %s of value.", is_set() ? "set" : "record");
return -1;
}
int values_idx = 0;
int nof_elems = get_nof_elements();
for (int i = 0; i < get_nof_elements(); ++i) {
const Erroneous_values_t* err_vals = p_err_descr->next_field_err_values(i, values_idx);
if (-1 != p_err_descr->omit_before && p_err_descr->omit_before > i) {
nof_elems--;
continue;
}
if (NULL != err_vals && NULL != err_vals->before) {
if (err_vals->before->raw == FALSE) {
nof_elems++;
}
}
if (NULL != err_vals && NULL != err_vals->after) {
if (err_vals->after->raw == FALSE) {
nof_elems++;
}
}
if (-1 != p_err_descr->omit_after && p_err_descr->omit_after < i) {
nof_elems--;
continue;
}
}
encode_oer_length(nof_elems, p_buf, TRUE);
values_idx = 0;
int edescr_idx = 0;
for (int i = 0; i < get_nof_elements(); ++i) {
if (-1 != p_err_descr->omit_before && p_err_descr->omit_before > i) {
continue;
}
const Erroneous_values_t* err_vals = p_err_descr->next_field_err_values(i, values_idx);
const Erroneous_descriptor_t* emb_descr = p_err_descr->next_field_emb_descr(i, edescr_idx);
if (NULL != err_vals && NULL != err_vals->before) {
if (NULL == err_vals->before->errval) {
TTCN_error("internal error: erroneous before value missing");
}
if (err_vals->before->raw) {
err_vals->before->errval->OER_encode_negtest_raw(p_buf);
} else {
if (NULL == err_vals->before->type_descr) {
TTCN_error("internal error: erroneous before typedescriptor missing");
}
err_vals->before->errval->OER_encode(*(err_vals->before->type_descr), p_buf);
}
}
if (NULL != err_vals && NULL != err_vals->value) {
if (NULL != err_vals->value->errval) {
if (err_vals->value->raw) {
err_vals->value->errval->OER_encode_negtest_raw(p_buf);
} else {
if (NULL == err_vals->value->type_descr) {
TTCN_error("internal error: erroneous before typedescriptor missing");
}
err_vals->value->errval->OER_encode(*(err_vals->value->type_descr), p_buf);
}
}
}
else {
if (NULL != emb_descr) {
get_at(i)->OER_encode_negtest(emb_descr, *p_td.oftype_descr, p_buf);
} else {
get_at(i)->OER_encode(*p_td.oftype_descr, p_buf);
}
}
if (NULL != err_vals && NULL != err_vals->after) {
if (NULL == err_vals->after->errval) {
TTCN_error("internal error: erroneous after value missing");
}
if (err_vals->after->raw) {
err_vals->after->errval->OER_encode_negtest_raw(p_buf);
} else {
if (NULL == err_vals->after->type_descr) {
TTCN_error("internal error: erroneous before typedescriptor missing");
}
err_vals->after->errval->OER_encode(*(err_vals->after->type_descr), p_buf);
}
}
if (-1 != p_err_descr->omit_after && p_err_descr->omit_after <= i) {
break;
}
}
return 0;
}
......@@ -6147,7 +6246,12 @@ int Record_Type::JSON_decode(const TTCN_Typedescriptor_t& p_td, JSON_Tokenizer&
return (int)dec_len;
}
int Record_Type::OER_encode(const TTCN_Typedescriptor_t&, TTCN_Buffer& p_buf) const {
int Record_Type::OER_encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf) const {
if (err_descr) {
return OER_encode_negtest(err_descr, p_td, p_buf);
}
if (!is_bound()) {
TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_UNBOUND,
"Encoding an unbound %s value.", is_set() ? "set" : "record");
......@@ -6182,8 +6286,101 @@ int Record_Type::OER_encode(const TTCN_Typedescriptor_t&, TTCN_Buffer& p_buf) co
return 0;
}
int Record_Type::OER_encode_negtest(const Erroneous_descriptor_t*, const TTCN_Typedescriptor_t&, TTCN_Buffer&) const {
//TODO
int Record_Type::OER_encode_negtest(const Erroneous_descriptor_t* p_err_descr, const TTCN_Typedescriptor_t&, TTCN_Buffer& p_buf) const {
int values_idx = 0;
int edescr_idx = 0;
int field_count = get_count();
int next_default_idx = 0;
const default_struct* default_indexes = get_default_indexes();
int pos = 8;
char c = 0;
for (int i = 0; i < field_count; i++) {
boolean is_default_field = default_indexes && (default_indexes[next_default_idx].index==i);
if (is_default_field) {
next_default_idx++;
}
if (get_at(i)->is_optional() || is_default_field) {
pos--;
const Erroneous_values_t* err_vals = p_err_descr->next_field_err_values(i, values_idx);
int present = 1;
if ((NULL != err_vals && NULL != err_vals->value && NULL == err_vals->value->errval) || !get_at(i)->is_present()) {
present = 0;
}
c += present << pos;
if (pos == 0) {
p_buf.put_c(c);
pos = 8;
c = 0;
}
}
}
if (pos != 8) {
p_buf.put_c(c);
}
values_idx = 0;
for (int i = 0; i < field_count; ++i) {
if (-1 != p_err_descr->omit_before && p_err_descr->omit_before > i) {
continue;
}
const Erroneous_values_t* err_vals = p_err_descr->next_field_err_values(i, values_idx);
const Erroneous_descriptor_t* emb_descr = p_err_descr->next_field_emb_descr(i, edescr_idx);
if (NULL != err_vals && NULL != err_vals->before) {
if (NULL == err_vals->before->errval) {
TTCN_error("internal error: erroneous before value missing");
}
if (err_vals->before->raw) {
err_vals->before->errval->OER_encode_negtest_raw(p_buf);
} else {
if (NULL == err_vals->before->type_descr) {
TTCN_error("internal error: erroneous before typedescriptor missing");
}
// it's an extra field
err_vals->before->errval->OER_encode(*(err_vals->before->type_descr), p_buf);
}
}
if (NULL != err_vals && NULL != err_vals->value) {
if (NULL != err_vals->value->errval) {
if (err_vals->value->raw) {
err_vals->value->errval->OER_encode_negtest_raw(p_buf);
} else {
if (NULL == err_vals->value->type_descr) {
TTCN_error("internal error: erroneous before typedescriptor missing");
}
err_vals->value->errval->OER_encode(*(err_vals->value->type_descr), p_buf);
}
}
} else {
if (NULL != fld_descr(i)->oer || get_at(i)->is_present()) {
if (NULL != emb_descr) {
get_at(i)->OER_encode_negtest(emb_descr, *fld_descr(i), p_buf);
} else {
get_at(i)->OER_encode(*fld_descr(i), p_buf);
}
}
}
if (NULL != err_vals && NULL != err_vals->after) {
if (NULL == err_vals->after->errval) {
TTCN_error("internal error: erroneous after value missing");
}
if (err_vals->after->raw) {
err_vals->after->errval->OER_encode_negtest_raw(p_buf);
} else {
if (NULL == err_vals->after->type_descr) {
TTCN_error("internal error: erroneous before typedescriptor missing");
}
// it's an extra field
err_vals->after->errval->OER_encode(*(err_vals->after->type_descr), p_buf);
}
}
if (-1 != p_err_descr->omit_after && p_err_descr->omit_after <= i) {
break;
}
}
return 0;
}
......
......@@ -43,6 +43,10 @@ Unsigned8byteInt ::= INTEGER (0..18446744073709551615)
Signed8byteInt ::= INTEGER (-9223372036854775808..9223372036854775807)
-- Some compile only check
OperationReturnID-CIP ::= [1] OCTET STRING ('010001'H)
OperationReturnID-CIP2 ::= [1] BIT STRING ('010001'B)
MyEnum ::= ENUMERATED
{
e0 (0),
......
......@@ -42,7 +42,7 @@ TTCN3_MODULES = negtest.ttcn NegTestTestcases.ttcn \
NegTest_TEXT_Types.ttcn NegTest_TEXT_Testcases.ttcn \
NegTest_RAW_Types.ttcn NegTest_RAW_Testcases.ttcn \
www_XmlTest_org_negativeTest_XML_Types.ttcn NegTest_XML_Testcases.ttcn XSD.ttcn UsefulTtcn3Types.ttcn \
NegTest_JSON.ttcn NegTest_Update.ttcn
NegTest_JSON.ttcn NegTest_Update.ttcn NegTest_OER.ttcn
ASN1_MODULES = Types.asn NegTestTypes.asn
......@@ -117,6 +117,9 @@ run5: $(TARGET)
run6: $(TARGET)
./$(TARGET) NegTest_JSON.cfg
run7: $(TARGET)
./$(TARGET) NegTest_OER.cfg
ifeq ($(findstring n,$(MAKEFLAGS)),)
ifeq ($(filter clean check compile archive diag,$(MAKECMDGOALS)),)
......
......@@ -66,6 +66,8 @@ MySeqInt3 ::= SEQUENCE { i INTEGER, j INTEGER, k INTEGER }
MySeqInt4 ::= SEQUENCE { i INTEGER, j INTEGER, k INTEGER, l INTEGER }
MySeqInt4opt ::= SEQUENCE { i INTEGER, j INTEGER, k INTEGER, l INTEGER OPTIONAL}
MySeqInt5opt ::= SEQUENCE { i INTEGER, j INTEGER, k INTEGER, l INTEGER, m INTEGER OPTIONAL}
MySeqIntOpt ::= SEQUENCE { i INTEGER, j INTEGER, k INTEGER, l INTEGER OPTIONAL}
MySeqIntDef ::= SEQUENCE { i INTEGER, j INTEGER, k INTEGER, l INTEGER DEFAULT 4}
MySeqReal ::= SEQUENCE { x REAL }
MySeqReal2 ::= SEQUENCE { x REAL, y REAL OPTIONAL}
......
###############################################################################
# Copyright (c) 2000-2017 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
#
# Contributors:
# Szabo, Bence Janos
#
###############################################################################
[LOGGING]
LogFile := "NegTest_OER.log"
ConsoleMask := TTCN_ERROR | TTCN_TESTCASE | TTCN_STATISTICS | TTCN_WARNING
FileMask := TTCN_ERROR | TTCN_TESTCASE | TTCN_STATISTICS | TTCN_WARNING | TTCN_USER | DEBUG_ENCDEC | VERDICTOP
SourceInfoFormat := Stack
LogEventTypes := Detailed
[EXECUTE]
NegTest_OER.control
/******************************************************************************
* Copyright (c) 2000-2017 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
*
* Contributors:
* Szabo, Bence Janos
*
******************************************************************************/
// This module tests the 'negative testing' feature of the OER encoder.
module NegTest_OER {
import from NegTestTypes all;
type component CT {}
/************ Encoding functions ************/
external function f_enc_msb(in MySeqBool x) return octetstring
with { extension "prototype(convert) encode(OER)" }
external function f_enc_msi4(in MySeqInt4 x) return octetstring
with { extension "prototype(convert) encode(OER)" }
external function f_enc_opt(in MySeqIntOpt x) return octetstring
with { extension "prototype(convert) encode(OER)" }
external function f_enc_def(in MySeqIntDef x) return octetstring
with { extension "prototype(convert) encode(OER)" }
external function f_enc_MySetIntSeqIntSeqInt2SeqReal2(in MySetIntSeqIntSeqInt2SeqReal2 x) return octetstring
with { extension "prototype(convert) encode(OER)" }
external function f_enc_MySeqOfInt(in MySeqOfInt x) return octetstring
with { extension "prototype(convert) encode(OER)" }
external function f_enc_MyUnionBasicTypes(in MyUnionBasicTypes x) return octetstring
with { extension "prototype(convert) encode(OER)" }
/************* Erroneous values *************/
const MySeqBool msb1 := { b := false } with { erroneous(b) "value := true" };
const MySeqBool msb2 := { b := false } with { erroneous(b) "value := integer:1" };
const MySeqBool msb3 := { b := false } with { erroneous(b) "value := omit" };
const MySeqInt4 msi1 := { i := 1, j := 2, k := 3, l := 4 } with { erroneous(k) "before := omit all" };
const MySeqInt4 msi2 := { i := 1, j := 2, k := 3, l := 4 } with { erroneous(j) "after := omit all" };
const MySeqInt4 msi3 := { i := 1, j := 2, k := 3, l := 4 } with { erroneous(j) "value(raw) := 'ABCDEF'O" };
const MySeqInt4 msi4 := { i := 1, j := 2, k := 3, l := 4 } with { erroneous(j) "after(raw) := 'ABCDEF'O" };
const MySeqInt4 msi5 := { i := 1, j := 2, k := 3, l := 4 } with { erroneous(j) "before(raw) := 'ABCDEF'O" };
const MySeqInt4 msi6 := { i := 1, j := 2, k := 3, l := 4 } with { erroneous(j) "after := integer:8" };
const MySeqInt4 msi7 := { i := 1, j := 2, k := 3, l := 4 } with { erroneous(j) "before := integer:8" };
const MySeqIntOpt msiaod1 := {i := 1, j := 2, k := 3, l := 4} with { erroneous(j) "value := omit" };
const MySeqIntDef msiaod2 := {i := 1, j := 2, k := 3, l := 4} with { erroneous(j) "value := omit" };
const MySeqIntDef msiaod3 := {i := 1, j := 2, k := 3, l := 4} with { erroneous(l) "value := omit" };
const MySetIntSeqIntSeqInt2SeqReal2 msisiqisr := { i := 2, jkl := {i := 3, jk := {i := 4, j := 5}}, xy := {x := 1.0, y := 2.0}}
with { erroneous(i) "value := 1";
erroneous(jkl.i) "value := 2";
erroneous(jkl.jk.j) "value := 4";}
const MySeqOfInt msoi1 := {1,2,3,4} with {erroneous([0]) "value := 2"};
const MySeqOfInt msoi2 := {1,2,3,4} with {erroneous([1]) "value := omit"};
const MySeqOfInt msoi3 := {1,2,3,4} with {erroneous([1]) "value := MyCharstring:\"asd\""};
const MySeqOfInt msoi4 := {1,2,3,4} with {erroneous([2]) "before := omit all"};
const MySeqOfInt msoi5 := {1,2,3,4} with {erroneous([1]) "after := omit all"};
const MySeqOfInt msoi6 := {1,2,3,4} with {erroneous([2]) "value(raw) := 'ABCDEF'O"};
const MySeqOfInt msoi7 := {1,2,3,4} with {erroneous([2]) "before(raw) := 'ABCDEF'O"};
const MySeqOfInt msoi8 := {1,2,3,4} with {erroneous([2]) "after(raw) := 'ABCDEF'O"};
const MySeqOfInt msoi9 := {1,2,3,4} with {erroneous([2]) "after := MyCharstring:\"asd\""};
const MySeqOfInt msoi10 := {1,2,3,4} with {erroneous([2]) "before := MyCharstring:\"asd\""};
const MyUnionBasicTypes mubt1 := { i := 1 } with {erroneous(i) "value := 2"};
const MyUnionBasicTypes mubt2 := { i := 1 } with {erroneous(i) "value := MyCharstring:\"asd\""};
const MyUnionBasicTypes mubt3 := { i := 1 } with {erroneous(i) "value := omit"};
const MyUnionBasicTypes mubt4 := { i := 1 } with {erroneous(i) "value(raw) := 'ABCD'O"};
/******** Test cases for records ********/
testcase tc_record_change_value() runs on CT {
var octetstring res := f_enc_msb(msb1);
log(res);
if ('FF'O == res) { setverdict(pass); }
else { setverdict(fail, res); }
res := f_enc_msb(msb2);
log(res);
if ('0101'O == res) { setverdict(pass); }
else { setverdict(fail, res); }
res := f_enc_msb(msb3);
log(res);
if (''O == res) { setverdict(pass); }
else { setverdict(fail, res); }
}
testcase tc_record_omit_before_after() runs on CT {
var octetstring res := f_enc_msi4(msi1);
log(res);
if ('01030104'O == res) { setverdict(pass); }
else { setverdict(fail, res); }
res := f_enc_msi4(msi2);
log(res);
if ('01010102'O == res) { setverdict(pass); }
else { setverdict(fail, res); }
}
testcase tc_record_raw() runs on CT {
var octetstring res := f_enc_msi4(msi3);
log(res);
if ('0101ABCDEF01030104'O == res) { setverdict(pass); }
else { setverdict(fail, res); }
res := f_enc_msi4(msi4);
log(res);
if ('01010102ABCDEF01030104'O == res) { setverdict(pass); }
else { setverdict(fail, res); }
res := f_enc_msi4(msi5);
log(res);
if ('0101ABCDEF010201030104'O == res) { setverdict(pass); }
else { setverdict(fail, res); }
}
testcase tc_record_insert() runs on CT {
var octetstring res := f_enc_msi4(msi6);
log(res);
if ('01010102010801030104'O == res) { setverdict(pass); }
else { setverdict(fail, res); }
res := f_enc_msi4(msi7);
log(res);
if ('01010108010201030104'O == res) { setverdict(pass); }
else { setverdict(fail, res); }
}
testcase tc_record_optional() runs on CT {
var octetstring res := f_enc_opt(msiaod1);
log(res);
if ('80010101030104'O == res) { setverdict(pass); }
else { setverdict(fail, res); }
res := f_enc_def(msiaod2);
log(res);
if ('80010101030104'O == res) { setverdict(pass); }
else { setverdict(fail, res); }
res := f_enc_def(msiaod3);
log(res);
if ('00010101020103'O == res) { setverdict(pass); }
else { setverdict(fail, res); }
}
testcase tc_record_deep() runs on CT {
var octetstring res := f_enc_MySetIntSeqIntSeqInt2SeqReal2(msisiqisr);
log(res);
if ('800101010201040104800603312E452B300603322E452B30'O == res) { setverdict(pass); }
else { setverdict(fail, res); }
}
/******** Test cases for record-ofs ********/
testcase tc_record_of_change_value() runs on CT {
var octetstring res := f_enc_MySeqOfInt(msoi1);
log(res);
if ('01040102010201030104'O == res) { setverdict(pass); }