RegressionTests__CoverageInstrumentationTest.st
author Claus Gittinger <cg@exept.de>
Tue, 09 Jul 2019 18:53:03 +0200
changeset 2327 bf482d49aeaf
parent 1447 2351db93aa5b
child 1500 d406a10b2965
permissions -rw-r--r--
#QUALITY by exept class: RegressionTests::StringTests added: #test82c_expanding
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
     1
"{ Package: 'stx:goodies/regression' }"
567
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     2
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     3
"{ NameSpace: RegressionTests }"
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     4
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     5
TestCase subclass:#CoverageInstrumentationTest
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     6
	instanceVariableNames:''
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     7
	classVariableNames:''
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     8
	poolDictionaries:''
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     9
	category:'tests-Regression'
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    10
!
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    11
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    12
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    13
!CoverageInstrumentationTest methodsFor:'testFunctions'!
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    14
747
0b1b5e48be6f class: RegressionTests::CoverageInstrumentationTest
Claus Gittinger <cg@exept.de>
parents: 746
diff changeset
    15
calledByF6
0b1b5e48be6f class: RegressionTests::CoverageInstrumentationTest
Claus Gittinger <cg@exept.de>
parents: 746
diff changeset
    16
    'dummy'
0b1b5e48be6f class: RegressionTests::CoverageInstrumentationTest
Claus Gittinger <cg@exept.de>
parents: 746
diff changeset
    17
!
0b1b5e48be6f class: RegressionTests::CoverageInstrumentationTest
Claus Gittinger <cg@exept.de>
parents: 746
diff changeset
    18
567
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    19
f1
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    20
    ^ 1234
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    21
!
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    23
f2:aBoolean
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    24
    aBoolean ifTrue:[
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
    25
	^ 1234
567
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    26
    ].
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    27
    ^ 2345
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    28
!
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    29
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    30
f3:aBoolean
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    31
    aBoolean ifTrue:[
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
    32
	^ 1234  "both should be executed with a true arg, and coverage should see that"
567
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    33
    ] ifFalse:[
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
    34
	^ 2345  "bith should be executed with a true arg, and coverage should see that"
567
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    35
    ].
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    36
    ^ 3456
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    37
!
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    38
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    39
f4:aBoolean
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    40
    aBoolean ifFalse:[
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
    41
	^ 1234  "should not be executed with a true arg, and coverage should see that"
746
4ac3ed420d3e class: RegressionTests::CoverageInstrumentationTest
Claus Gittinger <cg@exept.de>
parents: 628
diff changeset
    42
    ].
4ac3ed420d3e class: RegressionTests::CoverageInstrumentationTest
Claus Gittinger <cg@exept.de>
parents: 628
diff changeset
    43
!
4ac3ed420d3e class: RegressionTests::CoverageInstrumentationTest
Claus Gittinger <cg@exept.de>
parents: 628
diff changeset
    44
4ac3ed420d3e class: RegressionTests::CoverageInstrumentationTest
Claus Gittinger <cg@exept.de>
parents: 628
diff changeset
    45
f5:loopCount
4ac3ed420d3e class: RegressionTests::CoverageInstrumentationTest
Claus Gittinger <cg@exept.de>
parents: 628
diff changeset
    46
    1 to:loopCount do:[:i |
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
    47
	1 + 2   "should be executed 10 times, and coverage should see that"
567
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    48
    ].
747
0b1b5e48be6f class: RegressionTests::CoverageInstrumentationTest
Claus Gittinger <cg@exept.de>
parents: 746
diff changeset
    49
!
0b1b5e48be6f class: RegressionTests::CoverageInstrumentationTest
Claus Gittinger <cg@exept.de>
parents: 746
diff changeset
    50
0b1b5e48be6f class: RegressionTests::CoverageInstrumentationTest
Claus Gittinger <cg@exept.de>
parents: 746
diff changeset
    51
f6:loopCount
0b1b5e48be6f class: RegressionTests::CoverageInstrumentationTest
Claus Gittinger <cg@exept.de>
parents: 746
diff changeset
    52
    1 to:loopCount do:[:i |
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
    53
	self calledByF6
747
0b1b5e48be6f class: RegressionTests::CoverageInstrumentationTest
Claus Gittinger <cg@exept.de>
parents: 746
diff changeset
    54
    ].
567
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    55
! !
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    56
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    57
!CoverageInstrumentationTest methodsFor:'tests'!
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    58
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    59
test_01_instrumentation
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    60
    |m1|
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    61
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    62
    self class recompile:#f1 usingCompilerClass:InstrumentingCompiler.
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    63
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    64
    m1 := (self class compiledMethodAt:#f1).
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    65
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    66
    self assert:(m1 hasBeenCalled not).
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    67
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    68
    "/ execute
746
4ac3ed420d3e class: RegressionTests::CoverageInstrumentationTest
Claus Gittinger <cg@exept.de>
parents: 628
diff changeset
    69
    InstrumentationContext runForCoverage:[
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
    70
	self f1.
628
b248c1c1fec4 changed:
Claus Gittinger <cg@exept.de>
parents: 567
diff changeset
    71
    ].
567
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    72
    self assert:(m1 hasBeenCalled).
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    73
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    74
    "
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    75
     self new test_01_instrumentation
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    76
    "
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    77
!
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    78
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    79
test_02_instrumentation
628
b248c1c1fec4 changed:
Claus Gittinger <cg@exept.de>
parents: 567
diff changeset
    80
    |m2 context|
567
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    81
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    82
    self class recompile:#f2: usingCompilerClass:InstrumentingCompiler.
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    83
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    84
    m2 := (self class compiledMethodAt:#f2:).
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    85
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    86
    self assert:(m2 hasBeenCalled not).
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    87
    self assert:(m2 blockInvocationInfo size == 1).
997
7a764234c8da class: RegressionTests::CoverageInstrumentationTest
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 747
diff changeset
    88
    self assert:(m2 statementInvocationInfo size == 3).
567
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    89
    self assert:(m2 blockInvocationInfo conform:[:i | i hasBeenExecuted not]).
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    90
    self assert:(m2 statementInvocationInfo conform:[:i | i hasBeenExecuted not]).
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    91
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    92
    "/ execute
628
b248c1c1fec4 changed:
Claus Gittinger <cg@exept.de>
parents: 567
diff changeset
    93
    context := InstrumentationContext new.
746
4ac3ed420d3e class: RegressionTests::CoverageInstrumentationTest
Claus Gittinger <cg@exept.de>
parents: 628
diff changeset
    94
    context runForCoverage:[
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
    95
	self f2:true.
628
b248c1c1fec4 changed:
Claus Gittinger <cg@exept.de>
parents: 567
diff changeset
    96
    ].
567
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    97
    self assert:(m2 hasBeenCalled).
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    98
    self assert:(m2 blockInvocationInfo conform:[:i | i hasBeenExecuted]).
997
7a764234c8da class: RegressionTests::CoverageInstrumentationTest
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 747
diff changeset
    99
    self assert:(m2 statementInvocationInfo first hasBeenExecuted).
7a764234c8da class: RegressionTests::CoverageInstrumentationTest
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 747
diff changeset
   100
    self assert:(m2 statementInvocationInfo second hasBeenExecuted).
7a764234c8da class: RegressionTests::CoverageInstrumentationTest
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 747
diff changeset
   101
    self assert:(m2 statementInvocationInfo third hasBeenExecuted not).
567
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   102
628
b248c1c1fec4 changed:
Claus Gittinger <cg@exept.de>
parents: 567
diff changeset
   103
    "/ execute in the same context
746
4ac3ed420d3e class: RegressionTests::CoverageInstrumentationTest
Claus Gittinger <cg@exept.de>
parents: 628
diff changeset
   104
    context runForCoverage:[
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
   105
	self f2:false.
628
b248c1c1fec4 changed:
Claus Gittinger <cg@exept.de>
parents: 567
diff changeset
   106
    ].
567
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   107
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   108
    self assert:(m2 hasBeenCalled).
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   109
    self assert:(m2 blockInvocationInfo conform:[:i | i hasBeenExecuted]).
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   110
    self assert:(m2 statementInvocationInfo conform:[:i | i hasBeenExecuted]).
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   111
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   112
    "
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   113
     self new test_02_instrumentation
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   114
    "
997
7a764234c8da class: RegressionTests::CoverageInstrumentationTest
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 747
diff changeset
   115
7a764234c8da class: RegressionTests::CoverageInstrumentationTest
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 747
diff changeset
   116
    "Modified: / 12-09-2013 / 16:12:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
567
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   117
!
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   118
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   119
test_03_instrumentation
628
b248c1c1fec4 changed:
Claus Gittinger <cg@exept.de>
parents: 567
diff changeset
   120
    |m3 context|
567
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   121
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   122
    self class recompile:#f3: usingCompilerClass:InstrumentingCompiler.
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   123
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   124
    m3 := (self class compiledMethodAt:#f3:).
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   125
746
4ac3ed420d3e class: RegressionTests::CoverageInstrumentationTest
Claus Gittinger <cg@exept.de>
parents: 628
diff changeset
   126
    "/ before execution
567
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   127
    self assert:(m3 hasBeenCalled not).
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   128
    self assert:(m3 blockInvocationInfo size == 2).
997
7a764234c8da class: RegressionTests::CoverageInstrumentationTest
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 747
diff changeset
   129
    self assert:(m3 statementInvocationInfo size == 4).
567
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   130
    self assert:(m3 blockInvocationInfo conform:[:i | i hasBeenExecuted not]).
746
4ac3ed420d3e class: RegressionTests::CoverageInstrumentationTest
Claus Gittinger <cg@exept.de>
parents: 628
diff changeset
   131
    self assert:(m3 blockInvocationInfo conform:[:i | i count == 0]).
567
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   132
    self assert:(m3 statementInvocationInfo conform:[:i | i hasBeenExecuted not]).
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   133
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   134
    "/ execute
628
b248c1c1fec4 changed:
Claus Gittinger <cg@exept.de>
parents: 567
diff changeset
   135
    context := InstrumentationContext new.
746
4ac3ed420d3e class: RegressionTests::CoverageInstrumentationTest
Claus Gittinger <cg@exept.de>
parents: 628
diff changeset
   136
    context runForCoverage:[
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
   137
	self f3:true.
628
b248c1c1fec4 changed:
Claus Gittinger <cg@exept.de>
parents: 567
diff changeset
   138
    ].
567
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   139
746
4ac3ed420d3e class: RegressionTests::CoverageInstrumentationTest
Claus Gittinger <cg@exept.de>
parents: 628
diff changeset
   140
    "/ one block should have been invoked, the other not"
567
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   141
    self assert:(m3 hasBeenCalled).
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   142
    self assert:(m3 blockInvocationInfo count:[:i | i hasBeenExecuted]) = 1.
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   143
    self assert:(m3 blockInvocationInfo count:[:i | i hasBeenExecuted not]) = 1.
997
7a764234c8da class: RegressionTests::CoverageInstrumentationTest
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 747
diff changeset
   144
    self assert:(m3 statementInvocationInfo first hasBeenExecuted).
7a764234c8da class: RegressionTests::CoverageInstrumentationTest
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 747
diff changeset
   145
    self assert:(m3 statementInvocationInfo second hasBeenExecuted).
7a764234c8da class: RegressionTests::CoverageInstrumentationTest
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 747
diff changeset
   146
    self assert:(m3 statementInvocationInfo third hasBeenExecuted not).
7a764234c8da class: RegressionTests::CoverageInstrumentationTest
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 747
diff changeset
   147
    self assert:(m3 statementInvocationInfo fourth hasBeenExecuted not).
567
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   148
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   149
    "/ execute
746
4ac3ed420d3e class: RegressionTests::CoverageInstrumentationTest
Claus Gittinger <cg@exept.de>
parents: 628
diff changeset
   150
    context runForCoverage:[
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
   151
	self f3:false.
628
b248c1c1fec4 changed:
Claus Gittinger <cg@exept.de>
parents: 567
diff changeset
   152
    ].
567
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   153
746
4ac3ed420d3e class: RegressionTests::CoverageInstrumentationTest
Claus Gittinger <cg@exept.de>
parents: 628
diff changeset
   154
    "/ both blocks should have been invoked"
567
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   155
    self assert:(m3 hasBeenCalled).
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   156
    self assert:(m3 blockInvocationInfo count:[:i | i hasBeenExecuted]) = 2.
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   157
    self assert:(m3 blockInvocationInfo count:[:i | i hasBeenExecuted not]) = 0.
746
4ac3ed420d3e class: RegressionTests::CoverageInstrumentationTest
Claus Gittinger <cg@exept.de>
parents: 628
diff changeset
   158
    self assert:(m3 blockInvocationInfo conform:[:i | i count == 1]).
997
7a764234c8da class: RegressionTests::CoverageInstrumentationTest
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 747
diff changeset
   159
    self assert:(m3 statementInvocationInfo first hasBeenExecuted).
7a764234c8da class: RegressionTests::CoverageInstrumentationTest
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 747
diff changeset
   160
    self assert:(m3 statementInvocationInfo second hasBeenExecuted).
7a764234c8da class: RegressionTests::CoverageInstrumentationTest
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 747
diff changeset
   161
    self assert:(m3 statementInvocationInfo third hasBeenExecuted).
7a764234c8da class: RegressionTests::CoverageInstrumentationTest
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 747
diff changeset
   162
    self assert:(m3 statementInvocationInfo fourth hasBeenExecuted not).
7a764234c8da class: RegressionTests::CoverageInstrumentationTest
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 747
diff changeset
   163
567
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   164
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   165
    "
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   166
     self new test_03_instrumentation
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   167
    "
997
7a764234c8da class: RegressionTests::CoverageInstrumentationTest
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 747
diff changeset
   168
7a764234c8da class: RegressionTests::CoverageInstrumentationTest
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 747
diff changeset
   169
    "Modified: / 12-09-2013 / 16:19:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
567
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   170
!
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   171
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   172
test_04_instrumentation
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   173
    |m4|
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   174
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   175
    self class recompile:#f4: usingCompilerClass:InstrumentingCompiler.
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   176
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   177
    m4 := (self class compiledMethodAt:#f4:).
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   178
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   179
    self assert:(m4 hasBeenCalled not).
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   180
    self assert:(m4 blockInvocationInfo size == 1).
997
7a764234c8da class: RegressionTests::CoverageInstrumentationTest
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 747
diff changeset
   181
    self assert:(m4 statementInvocationInfo size == 2).
567
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   182
    self assert:(m4 blockInvocationInfo conform:[:i | i hasBeenExecuted not]).
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   183
    self assert:(m4 statementInvocationInfo conform:[:i | i hasBeenExecuted not]).
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   184
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   185
    "/ execute
746
4ac3ed420d3e class: RegressionTests::CoverageInstrumentationTest
Claus Gittinger <cg@exept.de>
parents: 628
diff changeset
   186
    InstrumentationContext runForCoverage:[
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
   187
	self f4:true.
628
b248c1c1fec4 changed:
Claus Gittinger <cg@exept.de>
parents: 567
diff changeset
   188
    ].
567
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   189
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   190
    self assert:(m4 hasBeenCalled).
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   191
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   192
    "
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   193
     self new test_04_instrumentation
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   194
    "
997
7a764234c8da class: RegressionTests::CoverageInstrumentationTest
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 747
diff changeset
   195
7a764234c8da class: RegressionTests::CoverageInstrumentationTest
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 747
diff changeset
   196
    "Modified: / 12-09-2013 / 16:19:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
746
4ac3ed420d3e class: RegressionTests::CoverageInstrumentationTest
Claus Gittinger <cg@exept.de>
parents: 628
diff changeset
   197
!
4ac3ed420d3e class: RegressionTests::CoverageInstrumentationTest
Claus Gittinger <cg@exept.de>
parents: 628
diff changeset
   198
4ac3ed420d3e class: RegressionTests::CoverageInstrumentationTest
Claus Gittinger <cg@exept.de>
parents: 628
diff changeset
   199
test_05_instrumentation_loop_count
4ac3ed420d3e class: RegressionTests::CoverageInstrumentationTest
Claus Gittinger <cg@exept.de>
parents: 628
diff changeset
   200
    |m5|
4ac3ed420d3e class: RegressionTests::CoverageInstrumentationTest
Claus Gittinger <cg@exept.de>
parents: 628
diff changeset
   201
4ac3ed420d3e class: RegressionTests::CoverageInstrumentationTest
Claus Gittinger <cg@exept.de>
parents: 628
diff changeset
   202
    self class recompile:#f5: usingCompilerClass:InstrumentingCompiler.
4ac3ed420d3e class: RegressionTests::CoverageInstrumentationTest
Claus Gittinger <cg@exept.de>
parents: 628
diff changeset
   203
4ac3ed420d3e class: RegressionTests::CoverageInstrumentationTest
Claus Gittinger <cg@exept.de>
parents: 628
diff changeset
   204
    m5 := (self class compiledMethodAt:#f5:).
4ac3ed420d3e class: RegressionTests::CoverageInstrumentationTest
Claus Gittinger <cg@exept.de>
parents: 628
diff changeset
   205
4ac3ed420d3e class: RegressionTests::CoverageInstrumentationTest
Claus Gittinger <cg@exept.de>
parents: 628
diff changeset
   206
    self assert:(m5 hasBeenCalled not).
4ac3ed420d3e class: RegressionTests::CoverageInstrumentationTest
Claus Gittinger <cg@exept.de>
parents: 628
diff changeset
   207
    self assert:(m5 blockInvocationInfo size == 1).
4ac3ed420d3e class: RegressionTests::CoverageInstrumentationTest
Claus Gittinger <cg@exept.de>
parents: 628
diff changeset
   208
4ac3ed420d3e class: RegressionTests::CoverageInstrumentationTest
Claus Gittinger <cg@exept.de>
parents: 628
diff changeset
   209
    "/ execute
4ac3ed420d3e class: RegressionTests::CoverageInstrumentationTest
Claus Gittinger <cg@exept.de>
parents: 628
diff changeset
   210
    InstrumentationContext run:[
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
   211
	self f5:10.
746
4ac3ed420d3e class: RegressionTests::CoverageInstrumentationTest
Claus Gittinger <cg@exept.de>
parents: 628
diff changeset
   212
    ].
4ac3ed420d3e class: RegressionTests::CoverageInstrumentationTest
Claus Gittinger <cg@exept.de>
parents: 628
diff changeset
   213
4ac3ed420d3e class: RegressionTests::CoverageInstrumentationTest
Claus Gittinger <cg@exept.de>
parents: 628
diff changeset
   214
    self assert:(m5 hasBeenCalled).
4ac3ed420d3e class: RegressionTests::CoverageInstrumentationTest
Claus Gittinger <cg@exept.de>
parents: 628
diff changeset
   215
    self assert:(m5 blockInvocationInfo first count == 10).
4ac3ed420d3e class: RegressionTests::CoverageInstrumentationTest
Claus Gittinger <cg@exept.de>
parents: 628
diff changeset
   216
    self assert:(m5 hasBeenCalled).
4ac3ed420d3e class: RegressionTests::CoverageInstrumentationTest
Claus Gittinger <cg@exept.de>
parents: 628
diff changeset
   217
4ac3ed420d3e class: RegressionTests::CoverageInstrumentationTest
Claus Gittinger <cg@exept.de>
parents: 628
diff changeset
   218
    "
4ac3ed420d3e class: RegressionTests::CoverageInstrumentationTest
Claus Gittinger <cg@exept.de>
parents: 628
diff changeset
   219
     self new test_05_instrumentation
4ac3ed420d3e class: RegressionTests::CoverageInstrumentationTest
Claus Gittinger <cg@exept.de>
parents: 628
diff changeset
   220
    "
747
0b1b5e48be6f class: RegressionTests::CoverageInstrumentationTest
Claus Gittinger <cg@exept.de>
parents: 746
diff changeset
   221
!
0b1b5e48be6f class: RegressionTests::CoverageInstrumentationTest
Claus Gittinger <cg@exept.de>
parents: 746
diff changeset
   222
0b1b5e48be6f class: RegressionTests::CoverageInstrumentationTest
Claus Gittinger <cg@exept.de>
parents: 746
diff changeset
   223
test_06_instrumentation_methodInvokationCount
0b1b5e48be6f class: RegressionTests::CoverageInstrumentationTest
Claus Gittinger <cg@exept.de>
parents: 746
diff changeset
   224
    |m|
0b1b5e48be6f class: RegressionTests::CoverageInstrumentationTest
Claus Gittinger <cg@exept.de>
parents: 746
diff changeset
   225
0b1b5e48be6f class: RegressionTests::CoverageInstrumentationTest
Claus Gittinger <cg@exept.de>
parents: 746
diff changeset
   226
    self class recompile:#f6: usingCompilerClass:InstrumentingCompiler.
0b1b5e48be6f class: RegressionTests::CoverageInstrumentationTest
Claus Gittinger <cg@exept.de>
parents: 746
diff changeset
   227
    self class recompile:#calledByF6 usingCompilerClass:InstrumentingCompiler.
0b1b5e48be6f class: RegressionTests::CoverageInstrumentationTest
Claus Gittinger <cg@exept.de>
parents: 746
diff changeset
   228
0b1b5e48be6f class: RegressionTests::CoverageInstrumentationTest
Claus Gittinger <cg@exept.de>
parents: 746
diff changeset
   229
    m := (self class compiledMethodAt:#calledByF6).
0b1b5e48be6f class: RegressionTests::CoverageInstrumentationTest
Claus Gittinger <cg@exept.de>
parents: 746
diff changeset
   230
0b1b5e48be6f class: RegressionTests::CoverageInstrumentationTest
Claus Gittinger <cg@exept.de>
parents: 746
diff changeset
   231
    self assert:(m hasBeenCalled not).
0b1b5e48be6f class: RegressionTests::CoverageInstrumentationTest
Claus Gittinger <cg@exept.de>
parents: 746
diff changeset
   232
    self assert:(m methodInvocationInfo hasBeenCalled not).
0b1b5e48be6f class: RegressionTests::CoverageInstrumentationTest
Claus Gittinger <cg@exept.de>
parents: 746
diff changeset
   233
    self assert:(m hasBeenCalled not).
0b1b5e48be6f class: RegressionTests::CoverageInstrumentationTest
Claus Gittinger <cg@exept.de>
parents: 746
diff changeset
   234
    self assert:(m methodInvocationInfo count == 0).
0b1b5e48be6f class: RegressionTests::CoverageInstrumentationTest
Claus Gittinger <cg@exept.de>
parents: 746
diff changeset
   235
0b1b5e48be6f class: RegressionTests::CoverageInstrumentationTest
Claus Gittinger <cg@exept.de>
parents: 746
diff changeset
   236
    "/ execute
0b1b5e48be6f class: RegressionTests::CoverageInstrumentationTest
Claus Gittinger <cg@exept.de>
parents: 746
diff changeset
   237
    InstrumentationContext run:[
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
   238
	self f6:10.
747
0b1b5e48be6f class: RegressionTests::CoverageInstrumentationTest
Claus Gittinger <cg@exept.de>
parents: 746
diff changeset
   239
    ].
0b1b5e48be6f class: RegressionTests::CoverageInstrumentationTest
Claus Gittinger <cg@exept.de>
parents: 746
diff changeset
   240
0b1b5e48be6f class: RegressionTests::CoverageInstrumentationTest
Claus Gittinger <cg@exept.de>
parents: 746
diff changeset
   241
    self assert:(m hasBeenCalled).
0b1b5e48be6f class: RegressionTests::CoverageInstrumentationTest
Claus Gittinger <cg@exept.de>
parents: 746
diff changeset
   242
    self assert:(m methodInvocationInfo count == 10).
0b1b5e48be6f class: RegressionTests::CoverageInstrumentationTest
Claus Gittinger <cg@exept.de>
parents: 746
diff changeset
   243
0b1b5e48be6f class: RegressionTests::CoverageInstrumentationTest
Claus Gittinger <cg@exept.de>
parents: 746
diff changeset
   244
    "
0b1b5e48be6f class: RegressionTests::CoverageInstrumentationTest
Claus Gittinger <cg@exept.de>
parents: 746
diff changeset
   245
     self new test_06_instrumentation_methodInvokationCount
0b1b5e48be6f class: RegressionTests::CoverageInstrumentationTest
Claus Gittinger <cg@exept.de>
parents: 746
diff changeset
   246
    "
567
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   247
! !
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   248
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   249
!CoverageInstrumentationTest class methodsFor:'documentation'!
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   250
747
0b1b5e48be6f class: RegressionTests::CoverageInstrumentationTest
Claus Gittinger <cg@exept.de>
parents: 746
diff changeset
   251
version
0b1b5e48be6f class: RegressionTests::CoverageInstrumentationTest
Claus Gittinger <cg@exept.de>
parents: 746
diff changeset
   252
    ^ '$Header$'
0b1b5e48be6f class: RegressionTests::CoverageInstrumentationTest
Claus Gittinger <cg@exept.de>
parents: 746
diff changeset
   253
!
0b1b5e48be6f class: RegressionTests::CoverageInstrumentationTest
Claus Gittinger <cg@exept.de>
parents: 746
diff changeset
   254
567
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   255
version_CVS
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   256
    ^ '$Header$'
e245ebd95922 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   257
! !
997
7a764234c8da class: RegressionTests::CoverageInstrumentationTest
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 747
diff changeset
   258