Commit f2dacd2e authored by Elemer Lelik's avatar Elemer Lelik
Browse files

Initial contribution

parent e0fa3b58
/******************************************************************************
* Copyright (c) 2000-2014 Ericsson Telecom AB
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
******************************************************************************/
module MM_TimesImportee2 {
import from MM_TimesImported all;
}
\ No newline at end of file
/******************************************************************************
* Copyright (c) 2000-2014 Ericsson Telecom AB
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
******************************************************************************/
module TM_CyclomaticComplexity {
import from types all;
// cyclomatic complexity: 4
private testcase t1() runs on c1_CT {
while (true) {
if (true) {}
}
if (false) {}
else {}
}
}
\ No newline at end of file
/******************************************************************************
* Copyright (c) 2000-2014 Ericsson Telecom AB
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
******************************************************************************/
module TM_InEnvy {
import from types all;
private type integer int;
// 3 ref: int, i and i again
private testcase t() runs on c1_CT {
var int i;
while (true) {i := i + 1;}
}
}
\ No newline at end of file
/******************************************************************************
* Copyright (c) 2000-2014 Ericsson Telecom AB
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
******************************************************************************/
module TM_LinesOfCode {
import from types all;
// 3 lines
private testcase t() runs on c1_CT {
var t1 i := 2;
}
}
\ No newline at end of file
/******************************************************************************
* Copyright (c) 2000-2014 Ericsson Telecom AB
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
******************************************************************************/
module TM_Nesting {
import from types all;
// nesting max 4
private testcase t() runs on c1_CT {
var integer i;
while (true) {
if (true) {
i := i + 1;
do {} while(false);
} else {}
}
}
}
\ No newline at end of file
/******************************************************************************
* Copyright (c) 2000-2014 Ericsson Telecom AB
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
******************************************************************************/
module TM_NumberOfParams {
import from types all;
// 3 parameters
private testcase t(t1 a, t2 b, t1 c) runs on c1_CT {
}
}
\ No newline at end of file
/******************************************************************************
* Copyright (c) 2000-2014 Ericsson Telecom AB
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
******************************************************************************/
module TM_OutEnvy {
import from types all;
private type integer int;
// 3 ref: test_port, t1 and c1_CT
private testcase t(test_port p) runs on c1_CT {
var t1 i;
while (true) {i := i + 1;}
}
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<TITAN_Designer_Properties>
<ProjectProperties>
<MakefileSettings>
<generateMakefile>false</generateMakefile>
<targetExecutable>workingdir\Semantic_analizer_Tests.exe</targetExecutable>
<buildLevel>Level0-SemanticCheck</buildLevel>
</MakefileSettings>
<LocalBuildSettings>
<MakefileScript/>
<workingDirectory>workingdir</workingDirectory>
</LocalBuildSettings>
</ProjectProperties>
<ActiveConfiguration>Default</ActiveConfiguration>
</TITAN_Designer_Properties>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Semantic_Analizer_Tests</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.titan.designer.core.TITANBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.titan.designer.core.TITANNature</nature>
</natures>
</projectDescription>
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2000-2014 Ericsson Telecom AB
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Public License v1.0
which accompanies this distribution, and is available at
http://www.eclipse.org/legal/epl-v10.html
-->
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/bin" />
<exclude-output />
<content url="file://$MODULE_DIR$" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
/LogFile1_formatted.log
\ No newline at end of file
2014/Jun/25 01:58:59.123456 Some log message from LogFile1
2014/Jun/25 01:59:59.123456 { a = b, c = " "} Some log message from LogFile1
2014/Jun/25 02:00:59.123456 "{ a = b}"
2014/Jun/25 03:01:59.123456 { a =
b, c = " "
}Some log message from LogFile1
2014/Jun/25 03:05:59.123456 {{{{{{""}}}}}}
2014/Jun/25 03:06:59.123456 "\\ \\ \""
2014/Jun/26 01:55:59.123456 Some log message from LogFile1
2015/Jun/26 01:55:59.123456 Some log message from LogFile1
\ No newline at end of file
2014/Jun/25 01:58:59.123456 Some log message from LogFile1
2014/Jun/25 01:59:59.123456 {
a = b,
c =" "
} Some log message from LogFile1
2014/Jun/25 02:00:59.123456 "{ a = b}"
2014/Jun/25 03:01:59.123456 {
a = b,
c =" "
}Some log message from LogFile1
2014/Jun/25 03:05:59.123456 {
{
{
{
{
{"" }
}
}
}
}
}
2014/Jun/25 03:06:59.123456 "\\ \\ \""
2014/Jun/26 01:55:59.123456 Some log message from LogFile1
2015/Jun/26 01:55:59.123456 Some log message from LogFile1
\ No newline at end of file
/LogFile1_merged.log
\ No newline at end of file
2014/Jun/25 01:58:59.123456 Some log message from LogFile1
2014/Jun/25 01:59:59.123456 Some log message from LogFile1
2014/Jun/25 02:00:59.123456 Some log message from LogFile1
2014/Jun/25 03:01:59.123456 Some log message from LogFile1
2014/Jun/25 03:05:59.123456 Some log message from LogFile1
2014/Jun/25 03:06:59.123456 Some log message from LogFile1
2014/Jun/26 01:55:59.123456 Some log message from LogFile1
2015/Jun/26 01:55:59.123456 Some log message from LogFile1
\ No newline at end of file
2014/Jun/25 01:58:59.123455 LogFile2 Some log message from LogFile2
2014/Jun/25 01:58:59.123456 LogFile1 Some log message from LogFile1
2014/Jun/25 01:59:59.123456 LogFile1 Some log message from LogFile1
2014/Jun/25 01:59:59.123457 LogFile2 Some log message from LogFile2
2014/Jun/25 02:00:59.123456 LogFile1 Some log message from LogFile1
2014/Jun/25 02:00:59.123456 LogFile2 Some log message from LogFile2
2014/Jun/25 03:01:59.123456 LogFile1 Some log message from LogFile1
2014/Jun/25 03:01:59.123456 LogFile2 Some log message from LogFile2
2014/Jun/25 03:05:59.123456 LogFile1 Some log message from LogFile1
2014/Jun/25 03:05:59.123456 LogFile2 Some log message from LogFile2
2014/Jun/25 03:06:59.123456 LogFile1 Some log message from LogFile1
2014/Jun/25 03:06:59.123456 LogFile2 Some log message from LogFile2
2014/Jun/26 01:55:59.123456 LogFile1 Some log message from LogFile1
2015/Jun/26 01:55:59.123456 LogFile1 Some log message from LogFile1
2014/Jun/25 01:58:59.123455 Some log message from LogFile2
2014/Jun/25 01:59:59.123457 Some log message from LogFile2
2014/Jun/25 02:00:59.123456 Some log message from LogFile2
2014/Jun/25 03:01:59.123456 Some log message from LogFile2
2014/Jun/25 03:05:59.123456 Some log message from LogFile2
2014/Jun/25 03:06:59.123456 Some log message from LogFile2
\ No newline at end of file
ASNTypes DEFINITIONS
-- [(AUTOMATIC|EXPLICIT|IMPLICIT) TAGS]
-- the default is EXPLICIT TAGS
AUTOMATIC TAGS ::=
BEGIN
-- EXPORTS <exports clause>;
IMPORTS;
-- MODULE-BODY
ASNNull ::= NULL
ASNInteger ::= INTEGER
ASNReal ::= REAL
ASNBoolean ::= BOOLEAN
ASNBitstring ::= BIT STRING
ASNBMPstring ::= BMPString
ASNGeneralstring ::= GeneralString
ASNGraphicstring ::= GraphicString
ASNIA5string ::= IA5String
ASNNumericstring ::= NumericString
ASNOctetString ::= OCTET STRING
ASNISO646String ::= ISO646String
ASNT61String ::= T61String
ASNPrintablestring ::= PrintableString
ASNTeletexstring ::= TeletexString
ASNUniversalstring ::= UniversalString
ASNUnrestrictedstring ::= CHARACTER STRING
ASNUTF8string ::= UTF8String
ASNVideotexstring ::= VideotexString
ASNVisiblestring ::= VisibleString
ASNGeneralizedTime ::= GeneralizedTime
ASNUTCTime ::= UTCTime
ASNObjectdescriptor ::= ObjectDescriptor
ASNSequenceType ::= SEQUENCE {
field1 INTEGER,
field2 GeneralString}
ASNSetType ::= SET {
field1 INTEGER,
field2 GeneralString}
ASNChoiceType ::= CHOICE {
field1 INTEGER,
field2 GeneralString}
ASNEnumType ::= ENUMERATED {
item1 (0),
item2 (1),
item3 (2) }
ASNSequenceOf ::= SEQUENCE OF INTEGER
ASNSetOf ::= SET OF INTEGER
ASNEmbeddedPDV ::= EMBEDDED PDV
END
ASNValues DEFINITIONS
-- [(AUTOMATIC|EXPLICIT|IMPLICIT) TAGS]
-- the default is EXPLICIT TAGS
AUTOMATIC TAGS ::=
BEGIN
IMPORTS ASNSequenceType, ASNSetType, ASNSequenceOf, ASNSetOf
FROM ASNTypes;
c-ASNboolean1 BOOLEAN ::= TRUE
c-ASNboolean2 BOOLEAN ::= FALSE
c-ASNinteger1 INTEGER ::= 1
NamedNumberType ::= INTEGER { firstvalue(-100), secondvalue(0), othervalue(100) } -- named numbers
c-ASNInteger2 NamedNumberType ::= firstvalue
c-ASNreal1 REAL ::= {mantissa 314159,base 10, exponent -10}
c-ASNreal2 REAL ::= {mantissa 1234,base 2, exponent 1}
c-ASNreal3 REAL ::= PLUS-INFINITY
c-ASNreal4 REAL ::= MINUS-INFINITY
ASNEnumeratedType ::= ENUMERATED {a(2),b(1),..., c(0)}
c-ASNenum ASNEnumeratedType ::= a
c-ASNbitstring1 BIT STRING ::= '0101010101010101'B
c-ASNbitstring2 BIT STRING ::= '01234567890ABCDEF'H
ASNBitstringType ::= BIT STRING{ first(0), second (1), last-in-first-octet(7) }
c-ASNbitstring3 ASNBitstringType ::= {first, last-in-first-octet}
c-ASNoctetstring1 OCTET STRING ::= '1234567890ABCDEF'H
c-ASNoctetstring2 OCTET STRING ::= '01010101'B
c-ASNnull NULL ::= NULL
c-ASNobjid OBJECT IDENTIFIER ::= { itu-t(0) identified-organization(4) etsi(0) reserved(127)
etsi-identified-organization(0) ericsson(5) }
c-roid RELATIVE-OID ::= {iso(1) member-body(2) bsi(826) disc(0) ericsson(1249)}
c-etsi-objid RELATIVE-OID ::= {itu-t(0) identified-organization(4) etsi(0)}
c-etsi-ericsson RELATIVE-OID ::= {reserved(127) etsi-identified-organization(0)
ericsson(5) 3 4}
c11-21b T11 ::= f21 : {etsi-objid etsi-ericsson}
T21 ::= RELATIVE-OID
T11 ::= [APPLICATION 1] CHOICE {
f21 T21
}
c-etsi-desc ObjectDescriptor ::= "European Telecommunications Standards Institute"
c-ASNBMPString1 BMPString ::= "0123456789"
c-ASNGeneralString1 GeneralString ::= "0123456789"
c-ASNGraphicString1 GraphicString ::= "0123456789"
c-ASNTeletexString1 TeletexString ::= "0123456789"
c-ASNT61String1 T61String ::= "0123456789"
c-ASNIA5String1 IA5String ::= "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 add the control characters too"
c-ASNIA5String2 IA5String ::= {3,4} -- tuple format
c-ASNIA5String3 IA5String ::= {1, 1, 1, 1 } -- quadruple format
c-ASNIA5String4 IA5String ::= { "qwerty", {0 , 1}, { 0 , 0 , 0 , 0}, "uiop" } --character string list
c-ASNISO646String1 ISO646String ::= " "
c-ASNNumericString1 NumericString ::= "0123456789 "
c-ASNPrintableString1 PrintableString ::= "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 '()+,-./:=? "
c-ASNCharacterString1 CHARACTER STRING ::= {
identification syntaxes :
{
abstract {qw(0) er(0) ty(3)},
transfer myObjectIdentifierValue1
},
string-value '0123456789ABCDEF'H
}
c-ASNGeneralizedTime1 GeneralizedTime ::= "20030529151410.4"
c-ASNGeneralizedTime2 GeneralizedTime ::= "20030529151410.4Z"
c-ASNGeneralizedTime3 GeneralizedTime ::= "20030529151410.4 -0500"
c-ASNUTCTime1 UTCTime ::= "0305291514Z"
c-ASNUTCTime2 UTCTime ::= "0305291514-0500"
/*ASNSequenceType2 ::= SEQUENCE {
field1 INTEGER,
field2 GeneralString}*/
c-ASNSequence1 ASNSequenceType ::= { field1 1, field2 "akarmi"}
/*ASNSetType2 ::= SET {
field1 INTEGER,
field2 GeneralString}*/
c-ASNSet1 ASNSetType ::= { field1 1, field2 "akarmi"}
--ASNSequenceOf ::= SEQUENCE OF INTEGER
c-ASNSequenceOf ASNSequenceOf ::= { 1, 2, 3}
--ASNSetOf ::= SET OF INTEGER
c-ASNSetOf ASNSetOf ::= { 1, 2, 3}
c-epdv1 EMBEDDED PDV ::= {
identification fixed : NULL,
data-value 'BABEFACE'H
}
c-external1 EXTERNAL ::= {
identification fixed : NULL,
data-value 'BABEFACE'H
}
END
/******************************************************************************
* Copyright (c) 2000-2014 Ericsson Telecom AB
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
******************************************************************************/
module LazyTryCatchTest
{
type component MTCType
{
var integer v_ci := 0;
}
function f_safe_str2int(in charstring pl_int_str, in integer pl_defval) return integer {
//function safe_str2int(in charstring pl_int_str, in integer pl_defval) return integer {
@try {
log(pl_int_str);
return 12;
//return str2int(int_str);
}
@catch(vl_err) {
log(vl_err);
return pl_defval;
}
}
external function ef_throw(in charstring pl_msg);
testcase tc_TCLazy(in integer pl_i) runs on MTCType {
@try {
pl_i := 10 / pl_i;
//somefunction(); // this function might cause other DTEs
setverdict(pass); // this line is reached only if there was no DTE
}
@catch(vl_err) {
if (match(vl_err, pattern "*division by zero*")) {
log("division by zero detected");
setverdict(fail); // the verdict is fail instead of error
} else {
ef_throw(vl_err); // external function used to re-throw the DTE
}
}
}
testcase tc_TClazy2() runs on MTCType {
@try {
for (var integer vl_i:=0; vl_i<100; vl_i:=vl_i+1) {
@try {
log("statements that can cause DTEs");
}
@catch(vl_dte_str) {
if (match(vl_dte_str, pattern "*some pattern for minor errors*")) {
log("minor error ", vl_dte_str, " ignored, continuing load test...");
} else {
ef_throw(vl_dte_str);
}
}
}
setverdict(pass);
}
@catch(vl_dte_msg) {
log("Something went very wrong: ", vl_dte_msg);
setverdict(fail);
}
}
function f_MyFuncDieIfZero() runs on MTCType return integer {
if (v_ci==0) { testcase.stop; } // die if the component variable is zero
return v_ci;
}
function f_MyLazyFunc(in @lazy integer pl_pi) runs on MTCType {
v_ci := 1;
log(pl_pi); // first use of pi -> it is evaluated, ci==1, 3*1=3 is logged
v_ci := 2;
log(pl_pi); // second use of pi -> not evaluated, the value 3 is used again
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment