Commit 8f07cad0 authored by balaskoa's avatar balaskoa
Browse files

New testcases have been mapped from titan.core 8


Signed-off-by: default avatarbalaskoa <Jeno.Balasko@ericsson.com>
parent a02dcf16
...@@ -39,6 +39,12 @@ ...@@ -39,6 +39,12 @@
<ExcludeFromBuild>true</ExcludeFromBuild> <ExcludeFromBuild>true</ExcludeFromBuild>
</FileProperties> </FileProperties>
</FileResource> </FileResource>
<FileResource>
<FilePath>src/functionSubref/TvalueofSubref.ttcn</FilePath>
<FileProperties>
<ExcludeFromBuild>true</ExcludeFromBuild>
</FileProperties>
</FileResource>
</FileProperties> </FileProperties>
<FolderProperties> <FolderProperties>
<FolderResource> <FolderResource>
......
...@@ -31,7 +31,10 @@ ...@@ -31,7 +31,10 @@
#TbitstrOper.tc__value_list_bs #fails #TbitstrOper.tc__value_list_bs #fails
#cstr_content.tc_unichar_utf8_mp2 #cstr_content.tc_unichar_utf8_mp2
#TcharstrOper.tc_altstep_cs_idx # bring back the uncommented test! #TcharstrOper.tc_altstep_cs_idx # bring back the uncommented test!
TmultipleRedirects.commMessageDecodedValueRedirect #error JSON encode is missing #TmultipleRedirects.commMessageDecodedValueRedirect #error JSON encode is missing
#TvalueofSubref.control #the file excluded!!
#TfunctionSubref.tc_func_subref_parameter
#TpardTemplateSubref.control # 6 error
[LOGGING] [LOGGING]
......
...@@ -122,6 +122,12 @@ EnumDefBitHexOct ...@@ -122,6 +122,12 @@ EnumDefBitHexOct
#TfloatOperSpecial #TfloatOperSpecial
#functionReference: #functionReference:
#FuncRef #FuncRef
#cont here...
#functionSubref:
TfunctionSubref #22 pass, 1 error (see in single_bugs.cfg)
#TpardTemplateSubref #1 pass, 6 error (see in single_bugs.cfg)
#json (There are testcases commented out in it!! In preinit of JsonTypes it stops with exception) #json (There are testcases commented out in it!! In preinit of JsonTypes it stops with exception)
#AttributeTestcases.control #AttributeTestcases.control
......
File mode changed from 100755 to 100644
This diff is collapsed.
/******************************************************************************
* Copyright (c) 2000-2019 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
* Baranyi, Botond
*
******************************************************************************/
// This module contains tests for using subreferences (field names and array indexes) on
// parameterized templates.
module TpardTemplateSubref {
import from TfunctionSubref all;
/* * * * Parameterized templates * * * */
template Rec t_pard_rec(in template integer p_num, in template charstring p_str) :=
{ num := p_num, str := p_str };
template RoI t_pard_roi(in integer p_init, in integer p_mul) :=
{ p_init, p_init * p_mul, p_init * p_mul * p_mul };
template Uni t_pard_uni(in template octetstring p_val) :=
{ os := p_val };
template Arr t_pard_arr(in template Arr p_val) :=
{ p_val[3], p_val[2], p_val[1], p_val[0] };
template Complex t_pard_complex(in template Rec p_rec, in template RoI p_roi) :=
{ rec := p_rec, roi := p_roi, unis := { { os := t_os }, { i := c_init } } };
/* * * * Constants and templates * * * */
template integer t_int := 10;
template charstring t_cs := ? length(1..4);
const integer c_init := 6;
const integer c_mul := 2;
template octetstring t_os := ('00'O, '11'O, '22'O, '33'O);
/* * * * Helper function * * * */
function f_test_pard_temp(in template charstring p1, in template integer p2,
in template octetstring p3, in template octetstring p4)
{
if (log2str(p1) == log2str(t_cs)) { setverdict(pass); }
else { setverdict(fail, "Expected: ", t_cs, ", got: ", p1); }
if (log2str(p2) == log2str(c_init)) { setverdict(pass); }
else { setverdict(fail, "Expected: ", c_init, ", got: ", p2); }
if (log2str(p3) == log2str(t_os)) { setverdict(pass); }
else { setverdict(fail, "Expected: ", t_os, ", got: ", p3); }
if (log2str(p4) == log2str(t_arr[1])) { setverdict(pass); }
else { setverdict(fail, "Expected: ", t_arr[1], ", got: ", p4); }
}
/* * * * Test cases * * * */
testcase tc_pard_temp_var_assign() runs on CT
{
var template charstring vt1 := t_pard_rec(t_int, t_cs).str;
var template integer vt2 := t_pard_roi(c_init, c_mul)[0];
var template octetstring vt3 := t_pard_uni(t_os).os;
var template octetstring vt4 := t_pard_arr(t_arr)[3];
if (log2str(vt1) == log2str(t_cs)) { setverdict(pass); }
else { setverdict(fail, "Expected: ", t_cs, ", got: ", vt1); }
if (log2str(vt2) == log2str(c_init)) { setverdict(pass); }
else { setverdict(fail, "Expected: ", c_init, ", got: ", vt2); }
if (log2str(vt3) == log2str(t_os)) { setverdict(pass); }
else { setverdict(fail, "Expected: ", t_os, ", got: ", vt3); }
if (log2str(vt4) == log2str(t_arr[0])) { setverdict(pass); }
else { setverdict(fail, "Expected: ", t_arr[0], ", got: ", vt4); }
}
testcase tc_pard_temp_match() runs on CT
{
var charstring v_good1 := "rT.8";
var integer v_good2 := 12;
var octetstring v_good3 := '22'O;
var octetstring v_good4 := '12EF'O;
var integer v_bad1 := 331;
var integer v_bad2 := 7;
var octetstring v_bad3 := '44'O;
var octetstring v_bad4 := 'ABCDEF'O;
if (match(v_good1, t_pard_rec(t_int, t_cs).str)) { setverdict(pass); }
else { setverdict(fail, "Expected ", v_good1, " to match ", t_pard_rec(t_int, t_cs).str); }
if (match(v_good2, t_pard_roi(c_init, c_mul)[1])) { setverdict(pass); }
else { setverdict(fail, "Expected ", v_good2, " to match ", t_pard_roi(c_init, c_mul)[1]); }
if (match(v_good3, t_pard_uni(t_os).os)) { setverdict(pass); }
else { setverdict(fail, "Expected ", v_good3, " to match ", t_pard_uni(t_os).os); }
if (match(v_good4, t_pard_arr(t_arr)[3])) { setverdict(pass); }
else { setverdict(fail, "Expected ", v_good4, " to match ", t_pard_arr(t_arr)[3]); }
if (not match(v_bad1, t_pard_rec(t_int, t_cs).num)) { setverdict(pass); }
else { setverdict(fail, "Expected ", v_bad1, " not to match ", t_pard_rec(t_int, t_cs).num); }
if (not match(v_bad2, t_pard_roi(c_init, c_mul)[2])) { setverdict(pass); }
else { setverdict(fail, "Expected ", v_bad2, " not to match ", t_pard_roi(c_init, c_mul)[2]); }
if (not match(v_bad3, t_pard_uni(t_os).os)) { setverdict(pass); }
else { setverdict(fail, "Expected ", v_bad3, " not to match ", t_pard_uni(t_os).os); }
if (not match(v_bad4, t_pard_arr(t_arr)[1])) { setverdict(pass); }
else { setverdict(fail, "Expected ", v_bad4, " not to match ", t_pard_arr(t_arr)[1]); }
}
testcase tc_pard_temp_value() runs on CT
{
if (isvalue(t_pard_rec(t_int, t_cs).num)) { setverdict(pass); }
else { setverdict(fail, "Expected ", t_pard_rec(t_int, t_cs).num, " to be a value."); }
if (isvalue(t_pard_roi(c_init, c_mul)[1])) { setverdict(pass); }
else { setverdict(fail, "Expected ", t_pard_roi(c_init, c_mul)[1], " to be a value."); }
if (not isvalue(t_pard_uni(t_os).os)) { setverdict(pass); }
else { setverdict(fail, "Expected ", t_pard_uni(t_os).os, " to not be a value."); }
if (isvalue(t_pard_arr(t_arr)[0])) { setverdict(pass); }
else { setverdict(fail, "Expected ", t_pard_arr(t_arr)[0], " to be a value."); }
if (valueof(t_pard_rec(t_int, t_cs).num) == valueof(t_int)) { setverdict(pass); }
else { setverdict(fail, "Expected: ", t_int, ", got: ", t_pard_rec(t_int, t_cs).num); }
if (valueof(t_pard_roi(c_init, c_mul)[0]) == c_init) { setverdict(pass); }
else { setverdict(fail, "Expected: ", c_init, ", got: ", t_pard_roi(c_init, c_mul)[0]); }
if (valueof(t_pard_arr(t_arr)[1]) == valueof(t_arr[2])) { setverdict(pass); }
else { setverdict(fail, "Expected: ", t_arr[2], ", got: ", t_pard_arr(t_arr)[1]); }
}
testcase tc_pard_temp_structure() runs on CT
{
var template Rec rec1 := { num := t_pard_rec(t_int, t_cs).num, str := t_pard_rec(t_int, t_cs).str };
var template Rec rec1_e := { num := t_int, str := t_cs };
var template Rec rec2 := { t_pard_roi(c_init, c_mul)[1], "abc" };
var template Rec rec2_e := { c_init * c_mul, "abc" };
var template RoI roi := { t_pard_roi(c_init, c_mul)[2], (0..infinity) };
var template RoI roi_e := { c_init * c_mul * c_mul, (0..infinity) };
var template Uni uni := { os := t_pard_uni(t_os).os };
var template Uni uni_e := { os := t_os };
var template Arr arr := { [0] := t_pard_arr(t_arr)[3], [1] := t_pard_arr(t_arr)[2],
[2] := t_pard_arr(t_arr)[1], [3] := t_pard_arr(t_arr)[0] }; // == t_arr
if (log2str(rec1) == log2str(rec1_e)) { setverdict(pass); }
else { setverdict(fail, "Expected: ", rec1_e, ", got: ", rec1); }
if (log2str(rec2) == log2str(rec2_e)) { setverdict(pass); }
else { setverdict(fail, "Expected: ", rec2_e, ", got: ", rec2); }
if (log2str(roi) == log2str(roi_e)) { setverdict(pass); }
else { setverdict(fail, "Expected: ", roi_e, ", got: ", roi); }
if (log2str(uni) == log2str(uni_e)) { setverdict(pass); }
else { setverdict(fail, "Expected: ", uni_e, ", got: ", uni); }
if (log2str(arr) == log2str(t_arr)) { setverdict(pass); }
else { setverdict(fail, "Expected: ", t_arr, ", got: ", arr); }
}
testcase tc_pard_temp_parameter() runs on CT
{
f_test_pard_temp(t_pard_rec(t_int, t_cs).str, t_pard_roi(c_init, c_mul)[0],
t_pard_uni(t_os).os, t_pard_arr(t_arr)[2]);
}
testcase tc_pard_temp_send_receive() runs on CT
{
connect(mtc:pt, mtc:pt);
pt.send(t_pard_rec(t_int, t_cs).num);
pt.send(t_pard_roi(c_init, c_mul)[1]);
pt.send('11'O);
pt.send(t_pard_arr(t_arr)[0]);
var default def := activate(as_ct());
var integer bad_int;
var octetstring bad_os;
t.start(1.0);
alt {
[] pt.receive(t_pard_rec(t_int, t_cs).num) { setverdict(pass); }
[] pt.receive(integer:?) -> value bad_int
{ setverdict(fail, "Expected: ", t_pard_rec(t_int, t_cs).num, ", got: ", bad_int); }
}
alt {
[] pt.receive(t_pard_roi(c_init, c_mul)[1]) { setverdict(pass); }
[] pt.receive(integer:?) -> value bad_int
{ setverdict(fail, "Expected: ", t_pard_roi(c_init, c_mul)[1], ", got: ", bad_int); }
}
alt {
[] pt.receive(t_pard_uni(t_os).os) { setverdict(pass); }
[] pt.receive(octetstring:?) -> value bad_os
{ setverdict(fail, "Expected: ", t_pard_uni(t_os).os, ", got: ", bad_os); }
}
alt {
[] pt.receive(t_pard_arr(t_arr)[0]) { setverdict(pass); }
[] pt.receive(octetstring:?) -> value bad_os
{ setverdict(fail, "Expected: ", t_pard_arr(t_arr)[0], ", got: ", bad_os); }
}
deactivate(def);
}
testcase tc_pard_temp_complex() runs on CT
{
var template Rec rec := { t_int, t_cs };
var template RoI roi := { 1, 2, 3 };
var template RoI roi_res := { t_pard_complex(rec, roi).rec.num, t_pard_complex(rec, roi).roi[2],
t_pard_complex(rec, roi).unis[1].i };
var template RoI roi_res_e := { rec.num, roi[2], c_init };
if (log2str(roi_res) == log2str(roi_res_e)) { setverdict(pass); }
else { setverdict(fail, "Expected: ", roi_res_e, ", got: ", roi_res); }
if (match('00'O, t_pard_complex(rec, {}).unis[0].os)) { setverdict(pass); }
else { setverdict(fail, "Expected '00'O to match ", t_pard_complex(rec, {}).unis[0].os); }
if (isvalue(t_pard_complex(t_pard_rec(t_int, t_cs), t_pard_roi(c_init, c_mul)).roi[2])) { setverdict(pass); }
else { setverdict(fail, "Expected ", t_pard_complex(t_pard_rec(t_int, t_cs), t_pard_roi(c_init, c_mul)).roi[2], " to be a value"); }
}
/* * * * Control part * * * */
control {
execute(tc_pard_temp_var_assign());
execute(tc_pard_temp_match());
execute(tc_pard_temp_value());
execute(tc_pard_temp_structure());
execute(tc_pard_temp_parameter());
execute(tc_pard_temp_send_receive());
execute(tc_pard_temp_complex());
}
}
/******************************************************************************
* Copyright (c) 2000-2019 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:
* Baranyi, Botond
*
******************************************************************************/
// This module contains tests for using subreferences (field names and array indexes) on the
// result of a 'valueof' operation.
module TvalueofSubref {
/* * * * Types * * * */
type record Rec {
integer num,
charstring str
}
type record of integer RoI;
type union Uni {
integer i,
float f,
boolean b,
bitstring bs,
hexstring hs,
octetstring os,
charstring cs,
universal charstring ucs,
verdicttype vt,
enumerated { Small, Medium, Large } size
}
type octetstring Arr[4];
type record of Uni RoUni;
type set Complex {
Rec rec,
RoI roi,
RoUni unis
}
type port PT message {
inout integer, octetstring
}
with { extension "internal" };
type component CT {
timer t;
port PT pt;
}
/* * * * Helper functions for certain test cases * * * */
function f_test(in charstring p1, in integer p2, in boolean p3, in octetstring p4)
{
if (p1 == valueof(t_rec.str)) { setverdict(pass); }
else { setverdict(fail, "Expected: ", t_rec.str, ", got: ", p1); }
if (p2 == valueof(t_roi[0])) { setverdict(pass); }
else { setverdict(fail, "Expected: ", t_roi[0], ", got: ", p2); }
if (p3 == valueof(t_unis[2].b)) { setverdict(pass); }
else { setverdict(fail, "Expected: ", t_unis[2].b, ", got: ", p3); }
if (p4 == valueof(t_arr[1])) { setverdict(pass); }
else { setverdict(fail, "Expected: ", t_arr[1], ", got: ", p4); }
}
external function ef_enc_int(in integer x) return octetstring
with { extension "prototype(convert) encode(JSON)" };
external function ef_enc_oct(in octetstring x) return octetstring
with { extension "prototype(convert) encode(JSON)" };
altstep as_ct() runs on CT
{
var integer bad_int;
var octetstring bad_os;
[] pt.receive(integer:?) -> value bad_int {
setverdict(fail, "Expected octetstring value instead of ", bad_int);
}
[] pt.receive(octetstring:?) -> value bad_os {
setverdict(fail, "Expected integer value instead of ", bad_os);
}
[] t.timeout {
setverdict(inconc, "Receive timed out");
}
}
/* * * * Templates * * * */
template Rec t_rec := { num := 3, str := "a0" };
template RoI t_roi := { 1, 2, 4, 8, 16 };
template RoUni t_unis := { { i := -6 }, { f := 0.5 }, { b := true }, { bs := '1101'B }, { hs := '3D7'H },
{ os := '44A1'O }, { cs := "abc" }, { ucs := "víz" }, { vt := error }, { size := Small } };
template Arr t_arr := { '01'O, 'DE'O, 'ABBA'O, '1234EEFF'O };
/* * * * Test cases * * * */
testcase tc_valueof_subref_var_assign() runs on CT
{
var integer x1 := valueof(t_rec).num;
var integer x2 := valueof(t_roi)[4];
var integer x3 := valueof(t_unis[0]).i;
var charstring str1 := valueof(t_rec).str;
var charstring str2 := valueof(t_unis[6]).cs;
var octetstring os := valueof(t_arr)[1];
if (x1 == valueof(t_rec.num)) { setverdict(pass); }
else { setverdict(fail, "Expected: ", t_rec.num, ", got: ", x1); }
if (x2 == valueof(t_roi[4])) { setverdict(pass); }
else { setverdict(fail, "Expected: ", t_roi[4], ", got: ", x2); }
if (x3 == valueof(t_unis[0].i)) { setverdict(pass); }
else { setverdict(fail, "Expected: ", t_unis[0].i, ", got: ", x3); }
if (str1 == valueof(t_rec.str)) { setverdict(pass); }
else { setverdict(fail, "Expected: ", t_rec.str, ", got: ", str1); }
if (str2 == valueof(t_unis[6].cs)) { setverdict(pass); }
else { setverdict(fail, "Expected: ", t_unis[6].cs, ", got: ", str2); }
if (os == valueof(t_arr[1])) { setverdict(pass); }
else { setverdict(fail, "Expected: ", t_roi[1], ", got: ", os); }
}
testcase tc_valueof_subref_equality() runs on CT
{
if (valueof(t_rec).str == valueof(t_rec.str)) { setverdict(pass); }
else { setverdict(fail, "Expected: ", t_rec.str, ", got: ", valueof(t_rec).str); }
if (valueof(t_roi)[2] == valueof(t_roi[2])) { setverdict(pass); }
else { setverdict(fail, "Expected: ", t_roi[2], ", got: ", valueof(t_roi)[2]); }
if (valueof(t_unis[3]).bs == valueof(t_unis[3].bs)) { setverdict(pass); }
else { setverdict(fail, "Expected: ", t_unis[3].bs, ", got: ", valueof(t_unis[3]).bs); }
if (valueof(t_arr)[3] == valueof(t_arr[3])) { setverdict(pass); }
else { setverdict(fail, "Expected: ", t_arr[3], ", got: ", valueof(t_arr)[3]); }
if (valueof(t_rec).num != 100) { setverdict(pass); }
else { setverdict(fail, "Expected anything other than 100"); }
if (valueof(t_roi)[1] != 16) { setverdict(pass); }
else { setverdict(fail, "Expected anything other than 16"); }
if (valueof(t_unis[8]).vt != pass) { setverdict(pass); }
else { setverdict(fail, "Expected anything other than pass"); }
if (valueof(t_arr)[0] != 'DE'O) { setverdict(pass); }
else { setverdict(fail, "Expected anything other than 'DE'O"); }
}
testcase tc_valueof_subref_bound_and_present() runs on CT
{
if (isbound(valueof(t_rec).str)) { setverdict(pass); }
else { setverdict(fail, "Expected bound record field"); }
if (isbound(valueof(t_roi)[2])) { setverdict(pass); }
else { setverdict(fail, "Expected bound record of element"); }
if (isbound(valueof(t_unis[2]).b)) { setverdict(pass); }
else { setverdict(fail, "Expected bound union alternative"); }
if (isbound(valueof(t_arr)[2])) { setverdict(pass); }
else { setverdict(fail, "Expected bound array element"); }
if (ispresent(valueof(t_unis[9]).size)) { setverdict(pass); }
else { setverdict(fail, "Expected present union alternative"); }
}
testcase tc_valueof_subref_math_expr() runs on CT
{
var integer int_expr := -valueof(t_rec).num + valueof(t_roi)[3] * valueof(t_unis[0]).i;
var integer int_expr_e := -valueof(t_rec.num) + valueof(t_roi[3]) * valueof(t_unis[0].i);
var float float_expr := 4.0 / valueof(t_unis[1]).f;
var float float_expr_e := 4.0 / valueof(t_unis[1].f);
if (int_expr == int_expr_e) { setverdict(pass); }
else { setverdict(fail, "Expected: ", int_expr_e, ", got: ", int_expr); }
if (float_expr == float_expr_e) { setverdict(pass); }
else { setverdict(fail, "Expected: ", float_expr_e, ", got: ", float_expr); }
}
testcase tc_valueof_subref_bool_expr() runs on CT
{
var boolean bool_expr := (not valueof(t_unis[2]).b) or (valueof(t_rec).num > 0 and
valueof(t_roi)[2] < 10 xor valueof(t_unis[9]).size >= Medium);
var boolean bool_expr_e := (not valueof(t_unis[2].b)) or (valueof(t_rec.num) > 0 and
valueof(t_roi[2]) < 10 xor valueof(t_unis[9].size) >= Medium);
if (bool_expr == bool_expr_e) { setverdict(pass); }
else { setverdict(fail, "Expected: ", bool_expr_e, ", got: ", bool_expr); }
}
testcase tc_valueof_subref_binary_expr() runs on CT
{
var bitstring bs_expr := valueof(t_unis[3]).bs >> valueof(t_roi)[1];
var bitstring bs_expr_e := valueof(t_unis[3].bs) >> valueof(t_roi[1]);
var hexstring hs_expr := valueof(t_unis[4]).hs <@ valueof(t_rec).num;
var hexstring hs_expr_e := valueof(t_unis[4].hs) <@ valueof(t_rec.num);
var octetstring os_expr := valueof(t_unis[5]).os and4b (not4b valueof(t_arr)[2]);
var octetstring os_expr_e := valueof(t_unis[5].os) and4b (not4b valueof(t_arr[2]));
if (bs_expr == bs_expr_e) { setverdict(pass); }
else { setverdict(fail, "Expected: ", bs_expr_e, ", got: ", bs_expr); }
if (hs_expr == hs_expr_e) { setverdict(pass); }
else { setverdict(fail, "Expected: ", hs_expr_e, ", got: ", hs_expr); }
if (os_expr == os_expr_e) { setverdict(pass); }
else { setverdict(fail, "Expected: ", os_expr_e, ", got: ", os_expr); }
}
testcase tc_valueof_subref_str_concat() runs on CT
{
var bitstring bs_expr := valueof(t_unis[3]).bs & valueof(t_unis[3]).bs;
var bitstring bs_expr_e := valueof(t_unis[3].bs) & valueof(t_unis[3].bs);
var hexstring hs_expr := 'FF'H & valueof(t_unis[4]).hs & 'FF'H;
var hexstring hs_expr_e := 'FF'H & valueof(t_unis[4].hs) & 'FF'H;
var octetstring os_expr := valueof(t_unis[5]).os & valueof(t_arr)[3];
var octetstring os_expr_e := valueof(t_unis[5].os) & valueof(t_arr[3]);
var charstring cs_expr := valueof(t_unis[6]).cs & " " & valueof(t_rec).str;
var charstring cs_expr_e := valueof(t_unis[6].cs) & " " & valueof(t_rec.str);
var universal charstring ucs_expr := "x" & valueof(t_unis[7]).ucs & "x";
var universal charstring ucs_expr_e := "x" & valueof(t_unis[7].ucs) & "x";
if (bs_expr == bs_expr_e) { setverdict(pass); }
else { setverdict(fail, "Expected: ", bs_expr_e, ", got: ", bs_expr); }
if (hs_expr == hs_expr_e) { setverdict(pass); }
else { setverdict(fail, "Expected: ", hs_expr_e, ", got: ", hs_expr); }
if (os_expr == os_expr_e) { setverdict(pass); }
else { setverdict(fail, "Expected: ", os_expr_e, ", got: ", os_expr); }
if (cs_expr == cs_expr_e) { setverdict(pass); }
else { setverdict(fail, "Expected: ", cs_expr_e, ", got: ", cs_expr); }
if (ucs_expr == ucs_expr_e) { setverdict(pass); }
else { setverdict(fail, "Expected: ", ucs_expr_e, ", got: ", ucs_expr); }
}
testcase tc_valueof_subref_str_length() runs on CT
{
if (lengthof(valueof(t_unis[3]).bs) == lengthof(t_unis[3].bs)) { setverdict(pass); }
else { setverdict(fail, "Expected: ", lengthof(t_unis[3].bs), ", got: ", lengthof(valueof(t_unis[3]).bs)); }
if (lengthof(valueof(t_unis[4]).hs) == lengthof(t_unis[4].hs)) { setverdict(pass); }
else { setverdict(fail, "Expected: ", lengthof(t_unis[4].hs), ", got: ", lengthof(valueof(t_unis[4]).hs)); }
if (lengthof(valueof(t_unis[5]).os) == lengthof(t_unis[5].os)) { setverdict(pass); }
else { setverdict(fail, "Expected: ", lengthof(t_unis[5].os), ", got: ", lengthof(valueof(t_unis[5]).os)); }
if (lengthof(valueof(t_arr)[1]) == lengthof(t_arr[1])) { setverdict(pass); }
else { setverdict(fail, "Expected: ", lengthof(t_arr[1]), ", got: ", lengthof(valueof(t_arr)[1])); }
if (lengthof(valueof(t_unis[6]).cs) == lengthof(t_unis[6].cs)) { setverdict(pass); }
else { setverdict(fail, "Expected: ", lengthof(t_unis[6].cs), ", got: ", lengthof(valueof(t_unis[6]).cs)); }
if (lengthof(valueof(t_rec).str) == lengthof(t_rec.str)) { setverdict(pass); }
else { setverdict(fail, "Expected: ", lengthof(t_rec.str), ", got: ", lengthof(valueof(t_rec).str)); }
if (lengthof(valueof(t_unis[7]).ucs) == lengthof(t_unis[7].ucs)) { setverdict(pass); }
else { setverdict(fail, "Expected: ", lengthof(t_unis[7].ucs), ", got: ", lengthof(valueof(t_unis[7]).ucs)); }
}
testcase tc_valueof_subref_str_index() runs on CT
{
var bitstring v_bs := valueof(t_unis[3].bs);
var hexstring v_hs := valueof(t_unis[4].hs);
var octetstring v_os := valueof(t_unis[5].os);
var octetstring v_os2 := valueof(t_arr[2]);
var charstring v_cs := valueof(t_unis[6].cs);
var charstring v_cs2 := valueof(t_rec.str);
var universal charstring v_ucs := valueof(t_unis[7].ucs);
if (valueof(t_unis[3]).bs[2] == v_bs[2]) { setverdict(pass); }
else { setverdict(fail, "Expected: ", v_bs[2], ", got: ", valueof(t_unis[3]).bs[2]); }
if (valueof(t_unis[4]).hs[2] == v_hs[2]) { setverdict(pass); }
else { setverdict(fail, "Expected: ", v_hs[2], ", got: ", valueof(t_unis[4]).hs[2]); }
if (valueof(t_unis[5]).os[1] == v_os[1]) { setverdict(pass); }
else { setverdict(fail, "Expected: ", v_os[1], ", got: ", valueof(t_unis[5]).os[1]); }
if (valueof(t_arr)[2][1] == v_os2[1]) { setverdict(pass); }
else { setverdict(fail, "Expected: ", v_os2[1], ", got: ", valueof(t_arr)[2][1]); }
if (valueof(t_unis[6]).cs[2] == v_cs[2]) { setverdict(pass); }
else { setverdict(fail, "Expected: ", v_cs[2], ", got: ", valueof(t_unis[6]).cs[2]); }
if (valueof(t_rec).str[0] == v_cs2[0]) { setverdict(pass); }
else { setverdict(fail, "Expected: ", v_cs2[0], ", got: ", valueof(t_rec).str[0]); }
if (valueof(t_unis[7]).ucs[2] == v_ucs[2]) { setverdict(pass); }
else { setverdict(fail, "Expected: ", v_ucs[2], ", got: ", valueof(t_unis[7]).ucs[2]); }
}
testcase tc_valueof_subref_log() runs on CT
{
var charstring sep := " | ";
var charstring log_str := log2str(valueof(t_rec).str, sep, valueof(t_roi)[3], sep, valueof(t_unis[9]).size,
sep, valueof(t_arr)[0]);
var charstring log_str_e := log2str(t_rec.str, sep, t_roi[3], sep, t_unis[9].size, sep, t_arr[0]);
if (log_str == log_str_e) { setverdict(pass); }
else { setverdict(fail, "Expected: ", log_str_e, ", got: ", log_str); }
log(valueof(t_rec).str,valueof(t_roi)[3], valueof(t_unis[9]).size, valueof(t_arr)[0]);
}
testcase tc_valueof_subref_structure() runs on CT
{
var Rec rec1 := { num := valueof(t_rec).num, str := valueof(t_rec).str }; // == valueof(t_rec)
var Rec rec2 := { valueof(t_roi)[1], valueof(t_unis[6]).cs };
var Rec rec2_e := { valueof(t_roi[1]), valueof(t_unis[6].cs) };
var RoI roi := { valueof(t_unis[0]).i, 91, valueof(t_roi)[3], 0 };
var RoI roi_e := { valueof(t_unis[0].i), 91, valueof(t_roi[3]), 0 };
var Uni uni := { vt := valueof(t_unis[8]).vt }; // == valueof(t_unis[8])