--- /dev/null
+A DEFINITIONS
+
+-- [(AUTOMATIC|EXPLICIT|IMPLICIT) TAGS]
+-- the default is EXPLICIT TAGS
+ AUTOMATIC TAGS ::=
+
+BEGIN
+-- EXPORTS <exports clause>;
+IMPORTS;
+-- MODULE-BODY
+
+-- BOOLEAN
+ASN1MyBooleanType ::= BOOLEAN
+myBooleanasn1Value1 ASN1MyBooleanType ::= FALSE
+myBooleanasn1Value2 BOOLEAN ::= TRUE
+
+-- BIT STRING
+MyBitstringType ::= BIT STRING
+myBitstringValue1 MyBitstringType ::= '0101010101010101'B
+myBitstringValue2 BIT STRING ::= '1010101010101010'B
+-- OCTET STRING
+MyOctetStringType ::= OCTET STRING
+myOctetstringValue1 MyOctetStringType ::= 'ABCDEF0123456789'H
+myOctetstringValue2 OCTET STRING ::= '1234567890ABCDEF'H
+
+MyPrintableString ::= PrintableString
+
+MyIntegerType1 ::= INTEGER
+myInteger MyIntegerType1 ::= 13
+MyRealType1 ::= REAL
+myReal MyRealType1 ::= 3.1415
+
+
+END
\ No newline at end of file
# boolean
mpb1 := mpb2;
mpb2 := mpuni2.bval;
+#mpb2 := not mpb2; #not works, not required
# objid
mpobjid2 := mpobjid1;
mptarray2 := mptarray3;
mptarray3 := mparray1;
+##### asn1 #########
+tsp_TRUE := tsp_FALSE;
+tsp_FALSE := false;
+#tsp3_RESULT1 := tsp_TRUE or tsp_FALSE; not required
+#tsp3_RESULT2 := tsp_TRUE and tsp_FALSE; not required
+tsp_asnbitstr1 := '0'B
+tsp_asnbitstr2 := '01'B
+tsp_asnbitstr3 := tsp_asnbitstr1 & tsp_asnbitstr2 & '0101'B;
+tsp_asnos1 := '12'O
+tsp_asnos2 := 'EF'O
+tsp_asnos3 := tsp_asnos1 & tsp_asnos2 & '0123456789'O
+tsp_asnstr1 :="Laci"
+tsp_asnstr2 :="1()"
+tsp_asnstr3 := tsp_asnstr1 & tsp_asnstr2 & "tail"
+
+tsp_asnint1 := +1
+tsp_asnint2 := 2*tsp_asnint1
+tsp_asnint3 := tsp_asnint1 + tsp_asnint2
+tsp_asnint3 := (tsp_asnint1 + tsp_asnint2)*2-10/tsp_asnint1 #3*2 -10/1=-4
+
+tsp_asnreal1 := +1.0
+tsp_asnreal2 := 2.0 * tsp_asnreal1
+tsp_asnreal3 := (tsp_asnreal1 + tsp_asnreal2)*2.0- 10.0/tsp_asnreal1 #= -4.0
+#tsp_asnreal3 := (tsp_asnreal1 + tsp_asnreal2)*2.0-10.0/tsp_asnreal1 #FIXME: This line is not accepted by the executor
[EXECUTE]
references.control
+#references.tc_asn1_bool
+#references.tc_asn1_bitstr
// This module contains tests for referencing other (or the same) module parameters
// in module parameter initialization (in the configuration file)
+import from A all;
/******** Types ********/
type record Rec {
integer num,
modulepar template TwoStrings mptarray2 := { "one", "two" };
modulepar template TwoStrings mptarray3 := { [1] := ?, [0] := "x" };
+/*****ASN.1 types*******/
+modulepar ASN1MyBooleanType tsp_TRUE := false;
+modulepar ASN1MyBooleanType tsp_FALSE:= true;
+modulepar ASN1MyBooleanType tsp_R1 := false;
+modulepar ASN1MyBooleanType tsp_RESULT2 := false;
+modulepar MyBitstringType tsp_asnbitstr1 := ''B;
+modulepar MyBitstringType tsp_asnbitstr2 := ''B;
+modulepar MyBitstringType tsp_asnbitstr3 := ''B;
+modulepar MyOctetStringType tsp_asnos1 := '01'O;
+modulepar MyOctetStringType tsp_asnos2 := '02'O;
+modulepar MyOctetStringType tsp_asnos3 := '03'O;
+
+modulepar MyPrintableString tsp_asnstr1 := "default1"
+modulepar MyPrintableString tsp_asnstr2 := "d2"
+modulepar MyPrintableString tsp_asnstr3 := "d3"
+
+modulepar MyIntegerType1 tsp_asnint1 :=0;
+modulepar MyIntegerType1 tsp_asnint2 :=0;
+modulepar MyIntegerType1 tsp_asnint3 :=0;
+
+modulepar MyRealType1 tsp_asnreal1 := 0.0
+modulepar MyRealType1 tsp_asnreal2 := 0.0
+modulepar MyRealType1 tsp_asnreal3 := 0.0
+
/******** Test cases (for values) ********/
testcase tc_ref_integer() runs on CT
{
setverdict(pass);
}
+//********** ASN.1 *******************
+
+testcase tc_asn1_bool() runs on CT {
+ if(tsp_TRUE == true ){
+ setverdict(pass)
+ } else {
+ setverdict(fail, "true expected, false got")
+ }
+ if(tsp_FALSE == false ){
+ setverdict(pass)
+ } else {
+ setverdict(fail, "false expected, true got")
+ }
+}
+testcase tc_asn1_bitstr() runs on CT {
+ if(tsp_asnbitstr3 == '0010101'B) {
+ setverdict(pass);
+ } else {
+ setverdict(fail, "BIT STRING concat error")
+ }
+}
+
+testcase tc_asn1_octetstr() runs on CT {
+ if(tsp_asnos3 == '12EF0123456789'O){
+ setverdict(pass);
+ } else {
+ setverdict(fail, "OCTET STRING concat error")
+ }
+}
+
+testcase tc_asn1_charstr() runs on CT {
+ if(tsp_asnstr3 == "Laci1()tail"){
+ setverdict(pass);
+ } else {
+ setverdict(fail, "PrintableString concat error")
+ }
+}
+
+testcase tc_asn1_integer() runs on CT {
+ if(tsp_asnint3 == -4) {
+ setverdict(pass)
+ } else {
+ setverdict(fail,"INTEGER calc error in cfg file")
+ }
+}
+
+testcase tc_asn1_real() runs on CT {
+ var float eps := 0.01;
+ log("tsp_asnreal1:",tsp_asnreal1)
+ log("tsp_asnreal2:",tsp_asnreal2)
+ log("tsp_asnreal3:",tsp_asnreal3)
+ if((-eps < tsp_asnreal3-(-4.0)) and (tsp_asnreal3-(-4.0) < eps) ) {
+ setverdict(pass)
+ } else {
+ setverdict(fail,"REAL calc error in cfg file")
+ }
+}
control {
execute(tc_ref_integer());
execute(tc_ref_float());
execute(tc_ref_empty_record_template());
execute(tc_ref_union_template());
execute(tc_ref_array_template());
+ execute(tc_asn1_bool());
+ execute(tc_asn1_bitstr());
+ execute(tc_asn1_octetstr());
+ execute(tc_asn1_charstr());
+ execute(tc_asn1_integer());
+ //execute(tc_asn1_real());
}
}