source: trunk/t3q-examples/checkLogFormat/checkLogFormat.ttcn3 @ 57

Last change on this file since 57 was 55, checked in by phdmakk, 13 years ago
  • updated and improved examples
File size: 2.4 KB
RevLine 
[4]1module checkLogFormatModule {
2
3    function f_1 ()
4    runs on myComponent {
5
6        //incorrect
7        log ( "***" )
[55]8       
9        test();
10        //correct
11        log("*** f_1: INFO: OK - random value = " & bit2str(v_random) & " ***");
12       
13        test();
14        //correct - function calls are ignored
15        log("*** f_1: " & getMyStatus() & "INFO: OK - random value = " & bit2str(v_random) & " ***");
16       
17        test();
18        //incorrect - charstring function call parameters are taken into consideration resulting in
19        //an incorrect log statement format
20        log("*** f_1: " & getMyStatus("1") & "INFO: OK - random value = " & bit2str(v_random) & " ***");
21       
[4]22    }
23
24
25    const integer c_1 := 1;
26
27    testcase t_sendMsg ()
28    runs on myComponent {
29
[39]30                //this should also be correct
31                log("*** t_sendMsg: INFO: Unknown component " & p_variable & " ***");
32                f_2 ();
33
[4]34        // correct
35        log ( "*** t_sendMsg: INFO: Wrong message has been received ***" )
36        f_1 (); //if this statement were absent
37                //and subsequent log processing enabled
38                //the above log sattement will be analyzed
39                //together with the following split log statements
40
41        // also correct, given subsequent log processing is enabled
42        log ( "*** t_sendMsg: " );
43        log ( "INFO: " );
44        log ( "Wrong message has been received ***" );
45        f_1 ();
46
47        //correct , given subsequent log processing is enabled
48        log ( "*** t_sendMsg: " );
49        log ( "INFO: " );
50        log ( f_2 () );
51        log ( "Wrong message has been received ***" );
52        f_1 ();
53
54        // some simple malformed log statements
55        //will be combined as one if subsequent log processing is enabled
56        log ( "*** : INFORMATION: Wrong message has been received ***" )
57        log ( "** t_sendMsg: INFO: Wrong message has been received **" )
58        log ( "*** t_sendMsg22: INFO: Wrong message has been received ***" )
59        log ( "*** t_sendMsg: INFORMATION: Wrong message has been received ***" )
60
61        //correct under different configuration / not combined with the above
62        log ( "*** INFO: Wrong message has been received ***" );
63    }
64
65    control {
66
67        //incorrect
68        log ( ".." );
69
70        //correct, if not combined with the above
71        log ( "*** t_sendMsg22: INFO: Wrong message has been received ***" )
72    }
73}
Note: See TracBrowser for help on using the repository browser.