Skip to content

Commit

Permalink
handle empty case in some metric tests
Browse files Browse the repository at this point in the history
  • Loading branch information
LinqLover committed Jan 5, 2025
1 parent 99d36f2 commit af18f78
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
private
averageHierarchyHeightOf: aSLSystemTestObject

^ ((aSLSystemTestObject rootClasses collect:
[:class | class resultOf: #heightOfInheritanceTree: ]) sum) / (aSLSystemTestObject rootClasses size)
^ (((aSLSystemTestObject rootClasses ifEmpty: [^ Float nan])
collect: [:class | class resultOf: #heightOfInheritanceTree:]) sum)
/ aSLSystemTestObject rootClasses size
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
private
averageNumberOfDerivedClassesOf: aSLSystemTestObject


^ ((aSLSystemTestObject allClasses collect:
[:class | class testObject subclasses size]) sum ) / (aSLSystemTestObject resultOf: #classCount:)
^ ((aSLSystemTestObject allClasses ifEmpty: [^ Float nan])
collect: [:class | class testObject subclasses size]) sum
/ (aSLSystemTestObject resultOf: #classCount:)
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
private
systemCALLS: aSLSystemTestObject

^((aSLSystemTestObject allClasses collect:
^(((aSLSystemTestObject allClasses ifEmpty: [^ Float nan]) collect:
[:class | (class methods ifEmpty: [{0}] ifNotEmpty: [(class methods collect:
[:method | (method resultOf: #methodCallers:) itemCount])])
sum ])
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
private
systemCYCLO: aSLSystemTestObject

^((aSLSystemTestObject allClasses collect:
^(((aSLSystemTestObject allClasses ifEmpty: [^ Float nan]) collect:
[:class | (class methods ifEmpty: [{0}] ifNotEmpty: [(class methods collect:
[:method | (method resultOf: #methodCYCLO:) result])])
sum ])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
"defaultCategory" : "AT 5/7/2008 21:30" },
"instance" : {
"averageHierarchyHeight:" : "ct 12/19/2024 20:25",
"averageHierarchyHeightOf:" : "ct 12/19/2024 20:25",
"averageHierarchyHeightOf:" : "ct 1/5/2025 03:43",
"averageNumberOfDerivedClasses:" : "NA 7/31/2015 19:27",
"averageNumberOfDerivedClassesOf:" : "NA 7/30/2015 12:32",
"averageNumberOfDerivedClassesOf:" : "ct 1/5/2025 03:44",
"classNamespaceResult:" : "BD 6/29/2018 12:47",
"collectNamespaces:" : "AT 5/27/2008 18:14",
"commonStartOf:" : "BD 6/29/2018 12:16",
Expand All @@ -34,6 +34,6 @@
"overviewPyramidMetric:" : "ct 12/20/2024 01:17",
"printOn:" : "NH 6/24/2015 14:11",
"qualityResult:" : "BD 7/4/2018 19:45",
"systemCALLS:" : "SH 6/18/2015 11:54",
"systemCYCLO:" : "SH 6/18/2015 11:49",
"systemCALLS:" : "ct 1/5/2025 03:44",
"systemCYCLO:" : "ct 1/5/2025 03:45",
"systemFANOUT:" : "BD 7/25/2018 16:17" } }

0 comments on commit af18f78

Please sign in to comment.