Commit e5e59942 authored by balaskoa's avatar balaskoa
Browse files

predefFunctions part updated


Signed-off-by: default avatarbalaskoa <Jeno.Balasko@ericsson.com>
parent 92665d91
......@@ -9,6 +9,7 @@
[EXECUTE]
all_from_with_functions #TODO: JSON enc-dec function handling,
encdec_OK #TODO: JSON, BER encoder
[ORDERED_INCLUDE]
[LOGGING]
......
[MODULE_PARAMETERS]
# This section shall contain the values of all parameters that are defined in your TTCN-3 modules.
[LOGGING]
# In this section you can specify the name of the log file and the classes of events
# you want to log into the file or display on console (standard error).
LogFile := "logs/%e.%h-%r.%s"
FileMask := LOG_ALL #|TESTCASE | STATISTICS #|LOG_ALL #| DEBUG | MATCHING
ConsoleMask := ERROR | WARNING | TESTCASE | STATISTICS #| PORTEVENT | USER
LogSourceInfo := Yes
AppendFile := No
TimeStampFormat := Time
LogEventTypes := No
SourceInfoFormat := Single
LogEntityName := Yes
[EXECUTE]
#==all from:==
all_from_complement
......@@ -34,21 +19,55 @@ sapc.control
#AttributeTestcases.control
#JsonTestcases.control
#predefFunctions
bit_to_OK.control
bit_to_SW.control
char_to_OK.control
char_to_SW.control
#encdec_OK #BER encoding, JSON encoding, copied into single_bugs
enum_to_OK.control
enum_to_SW.control
float_to_OK.control
float_to_SW.control
hex_to_OK.control
hex_to_SW.control
int_to_OK.control
int_to_SW.control
isprecho_OK.control
length_of_OK
length_of_SW
oct_to_OK.control
oct_to_SW.control
replacer_OK.control
replacer_SW.control
rotter_OK.control
rotter_SW.control
shifty_OK.control
shifty_SW.control
size_of_OK.control
size_of_SW.control
str_to_OK.control
str_to_SW.control
sub_str_OK.control
sub_str_SW.control
tcname_OK.control
tcname_SW.control
### RAW ###
Annex_E_variants.control
Bug521125.control
Bug522656.control
Bug546231.control #the newest test, pass
Bug546231.control
Bug547385.control
CSN1_LH.control
gtpctest.control
Lengthto_Offset.control #bugfixed compilation err.
Lengthto_Offset.control
#RAW/Examples:
RAW_Test.control
#RAW/ForceOmit
ForceOmit
#RAW/HN25015
HN25015.control #pass, fixed RAW decoding error
HN25015.control
#RAW/HQ49956:
Test.control
#RAW/HS16977_Test
......@@ -63,99 +82,72 @@ RAW_bitstring_test
RAW_integer_test
#RAW/ustr
ustr.control
RAWCodingAttributes.control
#################
hex_to_OK.control
#functions.control
TtemplateAnytype.control
TtemplateInt.control
replacer_OK.control
TintOper.control
TtemplateFloat.control
TbasicStatem.control
hex_to_SW.control
TtemplateChar.control
#tryCatch_Functions.control
TtemplateBool.control
float_to_OK.control
int_to_SW.control
all_from_subtype.control
all_from_with_functions.control
TcharOper.control
all_from_var.control
float_to_SW.control
TcontrolTimer.control
TrecofOper.control
int_to_OK.control
SelectUnion.control
TtemplateEnum.control
TcharstrOper.control
TtemplateRec.control
rotter_SW.control
TassignmentNotation.control
IsTemplateKind.control
rotter_OK.control
ExclusiveRangeTemplate.control
size_of_SW.control
TtemplateBitstr.control
all_from_subset.control
size_of_OK.control
TucharstrOper.control
TsetofMatch.control
ThexstrOper.control
bit_to_SW.control
TunionOper.control
TrecordOper.control
TenumOper.control
tcname_SW.control
TanytypeOper.control
TfloatOper.control
TbitstrOper.control
all_from_superset.control
bit_to_OK.control
TobjidOper.control
#imported_templates.control
TsetOper.control
tcname_OK.control
char_to_OK.control
TtemplateSetof.control
TboolOper.control
enum_to_OK.control
shifty_SW.control
ToctetstrOper.control
TfloatOperSpecial.control
char_to_SW.control
FuncRef.control
isprecho_OK.control
shifty_OK.control
TtemplateUnion.control
TarrayOper.control
#everything.control
#types.control
sub_str_SW.control
TdefaultOper.control
str_to_SW.control
all_from_complement.control
TlostTimer.control
RAWCodingAttributes.control
#TtemplateRecAsn.control
enum_to_SW.control
all_from_permutation.control
TtemplateSet.control
oct_to_SW.control
sapc.control
TtemplateRecof.control
#ASN_Definitions.control
oct_to_OK.control
sub_str_OK.control
TanytypeWrapOper.control
#ImportedTemplates.control
TsetofOper.control
all_from.control
str_to_OK.control
replacer_SW.control
[LOGGING]
# In this section you can specify the name of the log file and the classes of events
# you want to log into the file or display on console (standard error).
LogFile := "logs/%e.%h-%r.%s"
FileMask := LOG_ALL #|TESTCASE | STATISTICS #|LOG_ALL #| DEBUG | MATCHING
ConsoleMask := ERROR | WARNING | TESTCASE | STATISTICS #| PORTEVENT | USER
LogSourceInfo := Yes
AppendFile := No
TimeStampFormat := Time
LogEventTypes := No
SourceInfoFormat := Single
LogEntityName := Yes
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
/******************************************************************************
* 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
* Ormandi, Matyas
* Raduly, Csaba
*
******************************************************************************/
module encdec_OK {
type component PDTestComponent {};
/*--- ENCVALUE_DECVALUE -----------------------------------------*/
type float ed_MyFloat with { encode "BER:2002" variant "length accept short" };
type integer ed_MyInt with { encode "TEXT" };
type bitstring ed_MyBitstring with { encode "RAW" };
group beer {
type record ed_MyRecord {
ed_MyInt i,
ed_MyFloat f optional,
ed_MyFloat f2 optional,
ed_MyBitstring bstr,
set {
ed_MyInt i,
ed_MyFloat f optional
} tr
}
type enumerated quark { up, down, top, bottom, strange, charm }
template quark t_q := charm;
type record of ed_MyFloat ed_Floaters;
type union ed_MyChoice {
ed_MyInt i,
ed_MyFloat f,
ed_MyFloat f2,
ed_MyBitstring bstr,
set {
ed_MyInt i,
ed_MyFloat f optional
} tr
}
} with { encode "XML" }; // TTCN types don't usually have BER, so use XML
template ed_MyRecord t_MyRecord := {
i := 17,
f := omit,
f2 := omit,
bstr := ''B,
tr := { i := 13, f := 3.1415926535 }
}
template ed_Floaters t_f := { 0.0, 1.1, 2.2, 3.3 }
template ed_MyChoice t_MyChoice := {
tr := { i := 13, f := 3.1415926535 }
}
const charstring expected :=
"<ed_MyRecord>\n" &
"\t<i>17</i>\n" &
"\t<bstr/>\n" &
"\t<tr>\n" &
"\t\t<i>13</i>\n" &
"\t\t<f>3.141593</f>\n" &
"\t</tr>\n" &
"</ed_MyRecord>\n\n";
function dec(in bitstring bs) return boolean
{
var ed_MyBitstring edres;
var integer i;
var bitstring b := '11110000'B;
bs := b;
log(b);
i := decvalue(bs, edres);
log(bs);
return (bs != b); // bs here needs to be changed locally, within the function (shadow copy)
}
testcase dec_within_func() runs on PDTestComponent
{
var bitstring bs := '01010101'B;
if (dec(bs)) {setverdict(pass);}
else {setverdict(fail);}
if (bs == '01010101'B) // shouldn't be changed because of the in parameter passing
{setverdict(pass);}
else {setverdict(fail);}
}
const ed_MyRecord edconst4 := { i := 1, f := 1.0, f2 := 0.0, bstr := '00000001'B, tr := { i := 1, f := 1.0 } };
testcase enc_dec_value() runs on PDTestComponent {
var ed_MyFloat edvar1 := 23E-25;
var ed_MyInt edvar2 := 2345;
var ed_MyBitstring edvar3 := '01010101'B;
log(edvar3);
var ed_MyRecord edvar4 := { i := 1, f := 1.0, f2 := 0.0, bstr := '00000001'B, tr := { i := 1, f := 1.0 } };
var bitstring edvar_bs1 := encvalue(edvar1);
var bitstring edvar_bs2 := encvalue(edvar2);
var bitstring edvar_bs3 := encvalue(edvar3);
log(edvar_bs3);
var bitstring edvar_bs4_1 := encvalue(edvar4.i);
var bitstring edvar_bs4_2 := encvalue(edvar4.f);
var bitstring edvar_bs4_3 := encvalue(edvar4.f2);
var bitstring edvar_bs4_4 := encvalue(edvar4.bstr);
var bitstring edvar_bs4_5 := encvalue(edvar4.tr.i);
var bitstring edvar_bs4_6 := encvalue(edvar4.tr.f);
// encvalue of a const should be the same as encvalue of a variable
// Tests for HN69319 (encvalue of an optional field of a const record)
if (edvar_bs4_1 == encvalue(edconst4.i)){setverdict(pass);}
else {setverdict(fail);}
if (edvar_bs4_2 == encvalue(edconst4.f)){setverdict(pass);}
else {setverdict(fail);}
if (edvar_bs4_3 == encvalue(edconst4.f2)){setverdict(pass);}
else {setverdict(fail);}
if (edvar_bs4_4 == encvalue(edconst4.bstr)){setverdict(pass);}
else {setverdict(fail);}
if (edvar_bs4_5 == encvalue(edconst4.tr.i)){setverdict(pass);}
else {setverdict(fail);}
if (edvar_bs4_6 == encvalue(edconst4.tr.f)){setverdict(pass);}
else {setverdict(fail);}
var integer i := 1;
var ed_MyFloat edres1;
var ed_MyInt edres2;
var ed_MyBitstring edres3;
var ed_MyRecord edres4;
i := decvalue(edvar_bs1, edres1);
i := decvalue(edvar_bs2, edres2);
i := decvalue(edvar_bs3, edres3);
log(edres3);
i := decvalue(edvar_bs4_1, edres4.i);
i := decvalue(edvar_bs4_2, edres4.f);
i := decvalue(edvar_bs4_3, edres4.f2);
i := decvalue(edvar_bs4_4, edres4.bstr);
i := decvalue(edvar_bs4_5, edres4.tr.i);
i := decvalue(edvar_bs4_6, edres4.tr.f);
if (edvar1 == edres1)
{setverdict(pass);}
else {setverdict(fail);}
if (edvar2 == edres2)
{setverdict(pass);}
else {setverdict(fail);}
if (edvar3 == edres3)
{setverdict(pass);}
else {setverdict(fail);}
if (edvar4 == edres4)
{setverdict(pass);}
else {setverdict(fail);}
var bitstring edtmpl_1 := encvalue(t_MyRecord);
if (bit2oct(edtmpl_1) == char2oct(expected))
{setverdict(pass);}
else {setverdict(fail);}
var bitstring edtmpl_2 := encvalue(ed_MyRecord : {
i := 17,
f := omit,
f2 := omit,
bstr := ''B,
tr := { i := 13, f := 3.1415926535 }
});
if (bit2oct(edtmpl_2) == char2oct(expected))
{setverdict(pass);}
else {setverdict(fail);}
// enum not really affected
var bitstring edtmpl_3 := encvalue( quark: strange );
edtmpl_3 := encvalue( t_q );
log(bit2oct(edtmpl_3));
// record-of
var bitstring edtmpl_4 := encvalue(t_f);
log(bit2oct(edtmpl_4));
// choice
var bitstring edtmpl_5 := encvalue(t_MyChoice);
log(bit2oct(edtmpl_5));
}
control {
execute (enc_dec_value());
execute (dec_within_func());
}
}
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
/******************************************************************************
* 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
* Raduly, Csaba
*
******************************************************************************/
module length_of_OK {
type component PDTestComponent {};
/*--- LENGTH OF BITSTRING --------------------------------------------------*/
const bitstring lofb := '1110001100'B
const bitstring lofb1 := ''B
modulepar integer lofbi := lengthof(lofb & lofb)
modulepar integer lofbi1 := lengthof(substr(lofb,0,lengthof(lofb)))
modulepar integer lofbi2 := lengthof(substr(lofb,0,lengthof(lofb)/2))
modulepar integer lofbi3 := lengthof(lofb & lofb1)
modulepar integer lofbi4 := lengthof(lofb1 & lofb1)
modulepar integer lofbi5 := lengthof(substr(lofb1,0,lengthof(lofb1)))
testcase lengthof_bitstr() runs on PDTestComponent{
if ((lofbi == 2*lengthof(lofb))
and (lofbi == lengthof(lofb & lofb)))
{setverdict(pass);}
else {setverdict(fail);}
if ((lofbi1 == lengthof(lofb))
and (lofbi1 == lengthof(substr(lofb,0,lengthof(lofb)))))
{setverdict(pass);}
else {setverdict(fail);}
if ((lofbi2 == 5)
and (lofbi2 == lengthof(substr(lofb,0,lengthof(lofb)/2))))
{setverdict(pass);}
else {setverdict(fail);}
if ((lofbi3 == 10)
and (lofbi3 == lengthof(lofb & lofb1)))
{setverdict(pass);}
else {setverdict(fail);}
if ((lofbi4 == 0)
and (lofbi4 == lengthof(lofb1 & lofb1)))
{setverdict(pass);}
else {setverdict(fail);}
if ((lofbi5 == 0)
and (lofbi5 == lengthof(substr(lofb1,0,lengthof(lofb1)))))
{setverdict(pass);}
else {setverdict(fail);}
var integer j;
var bitstring bb,b := ''B;
for (j:=0; j<lengthof(lofb); j:=j+1) {
b := b & lofb
if (lengthof(b) == (j+1)*lengthof(lofb))
{setverdict(pass);}
else {setverdict(fail);}
}
for (j:=lengthof(b); j>=0; j:=j-1) {
bb := substr(b,0,j)
if (lengthof(bb) == j)
{setverdict(pass);}
else {setverdict(fail);}
}
b := ''B
for (j:=1; j<4096; j:=j+1) {
b := b & int2bit(j,12)
if (lengthof(b) == j*12)
{setverdict(pass);}
else {setverdict(fail);}
bb :=int2bit(j,j)
if (lengthof(bb) == j)
{setverdict(pass);}
else {setverdict(fail);}
}
}
/*--- LENGTH OF HEXSTRING --------------------------------------------------*/
const hexstring lofh := '1110001100'H
const hexstring lofh1 := ''H
modulepar integer lofhi := lengthof(lofh & lofh)
modulepar integer lofhi1 := lengthof(substr(lofh,0,lengthof(lofh)))
modulepar integer lofhi2 := lengthof(substr(lofh,0,lengthof(lofh)/2))
modulepar integer lofhi3 := lengthof(lofh & lofh1)
modulepar integer lofhi4 := lengthof(lofh1 & lofh1)
modulepar integer lofhi5 := lengthof(substr(lofh1,0,lengthof(lofh1)))
testcase lengthof_hexstr() runs on PDTestComponent{
if ((lofhi == 2*lengthof(lofh))
and (lofhi == lengthof(lofh & lofh)))
{setverdict(pass);}
else {setverdict(fail);}
if ((lofhi1 == lengthof(lofh))
and (lofhi1 == lengthof(substr(lofh,0,lengthof(lofh)))))
{setverdict(pass);}
else {setverdict(fail);}
if ((lofhi2 == 5)
and (lofhi2 == lengthof(substr(lofh,0,lengthof(lofh)/2))))
{setverdict(pass);}
else {setverdict(fail);}
if ((lofhi3 == 10)
and (lofhi3 == lengthof(lofh & lofh1)))
{setverdict(pass);}
else {setverdict(fail);}
if ((lofhi4 == 0)
and (lofhi4 == lengthof(lofh1 & lofh1)))
{setverdict(pass);}
else {setverdict(fail);}
if ((lofhi5 == 0)
and (lofhi5 == lengthof(substr(lofh1,0,lengthof(lofh1)))))
{setverdict(pass);}
else {setverdict(fail);}
var integer j;
var hexstring hh,h := ''H;
for (j:=0; j<lengthof(lofh); j:=j+1) {
h := h & lofh
if (lengthof(h) == (j+1)*lengthof(lofh))
{setverdict(pass);}
else {setverdict(fail);}
}
for (j:=lengthof(h); j>=0; j:=j-1) {
hh := substr(h,0,j)
if (lengthof(hh) == j)
{setverdict(pass);}
else {setverdict(fail);}
}
h := ''H
for (j:=1; j<4096; j:=j+1) {
h := h & int2hex(j,12)
if (lengthof(h) == j*12)
{setverdict(pass);}
else {setverdict(fail);}
hh :=int2hex(j,j)
if (lengthof(hh) == j)
{setverdict(pass);}
else {setverdict(fail);}
}
}
/*--- LENGTH OF OCTETSTRING --------------------------------------------------*/
const octetstring lofo := '11111100000011110000'O
const octetstring lofo1 := ''O
modulepar integer lofoi := lengthof(lofo & lofo)
modulepar integer lofoi1 := lengthof(substr(lofo,0,lengthof(lofo)))
modulepar integer lofoi2 := lengthof(substr(lofo,0,lengthof(lofo)/2))
modulepar integer lofoi3 := lengthof(lofo & lofo1)
modulepar integer lofoi4 := lengthof(lofo1 & lofo1)
modulepar integer lofoi5 := lengthof(substr(lofo1,0,lengthof(lofo1)))
testcase lengthof_octetstr() runs on PDTestComponent{
if ((lofoi == 2*lengthof(lofo))
and (lofoi == lengthof(lofo & lofo)))
{setverdict(pass);}
else {setverdict(fail);}
if ((lofoi1 == lengthof(lofo))