| 1 | module checkLogFormatModule { |
|---|
| 2 | |
|---|
| 3 | function f_1 () |
|---|
| 4 | runs on myComponent { |
|---|
| 5 | |
|---|
| 6 | //incorrect |
|---|
| 7 | log ( "***" ) |
|---|
| 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 | |
|---|
| 22 | } |
|---|
| 23 | |
|---|
| 24 | |
|---|
| 25 | const integer c_1 := 1; |
|---|
| 26 | |
|---|
| 27 | testcase t_sendMsg () |
|---|
| 28 | runs on myComponent { |
|---|
| 29 | |
|---|
| 30 | //this should also be correct |
|---|
| 31 | log("*** t_sendMsg: INFO: Unknown component " & p_variable & " ***"); |
|---|
| 32 | f_2 (); |
|---|
| 33 | |
|---|
| 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 | } |
|---|