asn.1 testcases have been added to modulpar reference test
authorbalaskoa <jeno.balasko@ericsson.com>
Tue, 7 Jun 2016 12:00:33 +0000 (14:00 +0200)
committerbalaskoa <jeno.balasko@ericsson.com>
Tue, 7 Jun 2016 12:02:10 +0000 (14:02 +0200)
Signed-off-by: balaskoa <jeno.balasko@ericsson.com>
regression_test/cfgFile/module_parameters/references/A.asn [new file with mode: 0644]
regression_test/cfgFile/module_parameters/references/references.cfg
regression_test/cfgFile/module_parameters/references/references.ttcn

diff --git a/regression_test/cfgFile/module_parameters/references/A.asn b/regression_test/cfgFile/module_parameters/references/A.asn
new file mode 100644 (file)
index 0000000..86a5036
--- /dev/null
@@ -0,0 +1,34 @@
+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
index 56cb9b1c93c0f6b95a81bdd29c9111a65edf6174..f1b73d368483cfd7a8e89923925e19dced568de4 100644 (file)
@@ -54,6 +54,7 @@ mpucs2 := "űrhajó" & mpcs1 & char(mp1 + 1, 5, mp1 * 5, 5) & "x";
 # boolean
 mpb1 := mpb2;
 mpb2 := mpuni2.bval;
+#mpb2 := not mpb2; #not works, not required
 
 # objid
 mpobjid2 := mpobjid1;
@@ -176,5 +177,31 @@ mptarray1 := mptarray2 ifpresent;
 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
index 97389553a4165a6eabb4572436bff4bf8a916957..85f541cc082071d513f08c7443f7fc81efcbf234 100644 (file)
@@ -15,6 +15,7 @@ module references {
 // 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,
@@ -161,6 +162,30 @@ modulepar template TwoStrings mptarray1;
 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
 {
@@ -664,6 +689,63 @@ testcase tc_ref_array_template() 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());
@@ -701,6 +783,12 @@ control {
   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());
 }
 
 }
This page took 0.034007 seconds and 5 git commands to generate.