Skip to content

Instantly share code, notes, and snippets.

@mabdi
Last active July 6, 2021 10:23
Show Gist options
  • Save mabdi/3a18a2b745e2daf3c11f8a032c0226ee to your computer and use it in GitHub Desktop.
Save mabdi/3a18a2b745e2daf3c11f8a032c0226ee to your computer and use it in GitHub Desktop.
| cls n_super methods tmethods allasserts allStatements locs loc_q1_med_q3 asserts asserts_q1|
"Metacello new
baseline: 'Statistics';
repository: 'github://ctSkennerton/Pharo-Statistics/src';
load.
SortedCollection compile: 'quantile: aFloat
| n j lambda |
n := self size.
j := (n * aFloat) floor.
j = 0 ifTrue: [ j:= 1 ].
n = 1 ifTrue: [ ^ self first ].
lambda := n * aFloat - j.
^(1 - lambda * self at: j ) + (lambda * self at: j + 1)'.
"
cls := BlLayoutExactResizerTest.
n_super := (cls allSuperclassesIncluding: TestCase) size.
methods := (cls methods) size.
tmethods := (cls allTestSelectors) size.
allasserts := ((cls methods) flatCollect: [:m | (m ast allChildren select: #isMessage) select: [ :m2 | TestAsserter selectors includes: m2 selector ] ]) size.
allStatements := ((cls allTestSelectors) collect: [:x | (cls lookupSelector: x ) linesOfCode]) sum.
locs := SortedCollection new addAll: ((cls allTestSelectors) collect: [:x | (cls lookupSelector: x ) linesOfCode]); yourself.
loc_q1_med_q3 := { locs firstQuartile. locs median . locs thirdQuartile }.
asserts := ((cls methods) flatCollect: [:m | (m ast allChildren select: #isMessage) select: [ :m2 | TestAsserter selectors includes: m2 selector ] ]) size.
asserts := SortedCollection new addAll: ((cls methods) collect: [:m | ((m ast allChildren select: #isMessage) select: [ :m2 | TestAsserter selectors includes: m2 selector ]) size ]); yourself.
asserts_q1 := { asserts firstQuartile. asserts median . asserts thirdQuartile }.
';' join: (({ n_super. methods. tmethods. allasserts . allStatements. locs firstQuartile. locs median . locs thirdQuartile. asserts firstQuartile. asserts median . asserts thirdQuartile } collect: #asFloat)collect: #asString)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment