Skip to content
Snippets Groups Projects
Commit cdcaa818 authored by balaskoa's avatar balaskoa
Browse files

New testcases for handling TitanUniversalCharString_Element


Signed-off-by: default avatarbalaskoa <Jeno.Balasko@ericsson.com>
Change-Id: I6f5060032b0feda06f64764dba8ec6dfe2809db7
parent 0cbca390
No related branches found
No related tags found
No related merge requests found
...@@ -57,7 +57,7 @@ testcase tc_ucharstr_assign_comp1() runs on ucharstrOper_comptype { ...@@ -57,7 +57,7 @@ testcase tc_ucharstr_assign_comp1() runs on ucharstrOper_comptype {
} else { } else {
setverdict(fail,"expected ", exp, " got ",u); setverdict(fail,"expected ", exp, " got ",u);
} }
//check side effect: //check side effect:
u:= "2"; u:= "2";
if (u == "2") { if (u == "2") {
setverdict(pass) setverdict(pass)
...@@ -600,6 +600,87 @@ testcase ucharstr_Bug520457() runs on ucharstrOper_comptype { ...@@ -600,6 +600,87 @@ testcase ucharstr_Bug520457() runs on ucharstrOper_comptype {
setverdict(pass); setverdict(pass);
} }
// === String_Element tests ===
type component CT{
port UCSPort UCS
timer T
}
type port UCSPort message {
inout universal charstring
} with { extension "internal" }
// String_Element in func. arg.
function f_ucs(in universal charstring ucs) return universal charstring {
return ucs;
}
testcase tc_ucs() runs on CT {
var universal charstring vl_ucs1 := char(0,0,0,1) & char(0,0,0,20), vl_ucs2
vl_ucs2 := f_ucs(vl_ucs1[1]);
if( vl_ucs2 == char(0,0,0,20)) {setverdict(pass)} else { setverdict(fail)}
}
//ucs / altstep
altstep as_ucs(in universal charstring str) runs on CT {
var template universal charstring vl_str := ?
var universal charstring r;
[] UCS.receive(vl_str) -> value r { if ( r == str) { setverdict(pass) } }
[] T.timeout { setverdict(fail, "timeout")}
}
testcase tc_altstep_ucs() runs on CT {
var universal charstring vl_str := char(0,0,0,1) & char(0,0,0,20);
connect(self:UCS, self:UCS);
T.start(1.0);
UCS.send(vl_str);
as_ucs(vl_str);
T.stop;
}
testcase tc_altstep_ucs_idx() runs on CT {
var universal charstring vl_str := char(0,0,0,1) & char(0,0,0,20)
T.start(1.0);
connect(self:UCS, self:UCS);
UCS.send(vl_str[0]); //<====== This is compiled for an erroneous code
as_ucs(vl_str[0]);
T.stop;
}
altstep as_ucs_template(in template universal charstring str) runs on CT {
var template universal charstring vl_str := ?;
var universal charstring r;
[] UCS.receive(vl_str) -> value r { if ( r == valueof(str)) { setverdict(pass) } }
[] T.timeout { setverdict(fail, "timeout")}
}
testcase tc_altstep_ucs_template() runs on CT {
var template universal charstring vl_str := char(0,0,0,1) & char(0,0,0,20);
connect(self:UCS, self:UCS);
T.start(1.0);
UCS.send(vl_str);
as_ucs_template(vl_str);
T.stop;
}
testcase tc__value_list_ucs() runs on CT {
var universal charstring vl_cs1 := char(0,0,0,1) & char(0,0,0,20), vl_cs2
var template universal charstring vlt_cs := (vl_cs1[0], vl_cs1[1],vl_cs1); //<====== ok
vl_cs2 := char(0,0,0,1);
if( match(vl_cs2,vlt_cs)) {setverdict(pass)} else { setverdict(fail)}
vl_cs2 := char(0,0,0,20);
if( match(vl_cs2,vlt_cs)) {setverdict(pass)} else { setverdict(fail)}
}
testcase tc__match_ucs_idx() runs on CT {
var universal charstring vl_cs1 := char(0,0,0,1) & char(0,0,0,20);
var template universal charstring vlt_cs := ( char(0,0,0,1), char(0,0,0,20)); //ok
if( match(vl_cs1[0],vlt_cs)) {setverdict(pass)} else { setverdict(fail)}
}
control { control {
const universal charstring cl_1 := char(0, 0, 0, 0) const universal charstring cl_1 := char(0, 0, 0, 0)
const universal charstring cl_2 := "abcxyz" const universal charstring cl_2 := "abcxyz"
...@@ -635,5 +716,12 @@ control { ...@@ -635,5 +716,12 @@ control {
execute(ucharstrIsbound()); execute(ucharstrIsbound());
execute(CR_TR00018474()); execute(CR_TR00018474());
execute(ucharstr_Bug520457()); execute(ucharstr_Bug520457());
execute(tc_ucs());
execute(tc_altstep_ucs());
execute(tc_altstep_ucs_idx());
execute(tc_altstep_ucs_template());
execute(tc__value_list_ucs());
execute(tc__match_ucs_idx());
} }
} }
...@@ -410,16 +410,6 @@ testcase tc_indexing_HT70680() runs on empty ...@@ -410,16 +410,6 @@ testcase tc_indexing_HT70680() runs on empty
} }
function f_ucs(in universal charstring ucs) return universal charstring {
return ucs;
}
testcase tc_ucs() runs on empty {
var universal charstring vl_ucs1 := char(0,0,0,1) & char(0,0,0,20), vl_ucs2
vl_ucs2 := f_ucs(vl_ucs1[1]);
if( vl_ucs2 == char(0,0,0,20)) {setverdict(pass)} else { setverdict(fail)}
}
control { control {
execute(tc_charstring_content()); execute(tc_charstring_content());
execute(tc_cpp_test()); execute(tc_cpp_test());
...@@ -431,7 +421,6 @@ control { ...@@ -431,7 +421,6 @@ control {
execute(tc_unichar_utf8_mp2()); execute(tc_unichar_utf8_mp2());
execute(tc_unichar_utf8_template()); execute(tc_unichar_utf8_template());
execute(tc_indexing_HT70680()); execute(tc_indexing_HT70680());
execute(tc_ucs());
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment