Skip to content

Commit

Permalink
Fixing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jordanmontt committed Oct 23, 2023
1 parent dfafd2e commit 341b169
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions src/IllimaniProfiler-Tests/IllAllocationRateProfilerTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,39 @@ IllAllocationRateProfilerTest >> profilerClass [

^ IllAllocationRateProfiler
]

{ #category : 'tests' }
IllAllocationRateProfilerTest >> testSamplingRate [

| allocatedByteSrings |

profiler
samplingRate: 33;
profileOn: [ 100 timesRepeat: [ ByteString new ] ].

"We don't have the classes on this profiler"
allocatedByteSrings := profiler objectAllocations size.

"We are cheking in this range becase the profiler makes some allocations that are
necessary for the profiler to work, like Durations objects. So we cannot check that the
allocations are exacty 1/3 of the total."
self assert: (allocatedByteSrings >= 33) & (allocatedByteSrings < 40)
]

{ #category : 'tests' }
IllAllocationRateProfilerTest >> testSamplingRateOtherPercentage [

| allocatedByteSrings |

profiler
samplingRate: 75;
profileOn: [ 100 timesRepeat: [ ByteString new ] ].

"We don't have the class on this profiler"
allocatedByteSrings := profiler objectAllocations size.

"We are cheking in this range becase the profiler makes some allocations that are
necessary for the profiler to work, like Durations objects. So we cannot chack that the
allocations are exacty 1/3 of the total."
self assert: (allocatedByteSrings >= 75) & (allocatedByteSrings < 80)
]

0 comments on commit 341b169

Please sign in to comment.