Skip to content

Commit

Permalink
moved from smalltalkhub
Browse files Browse the repository at this point in the history
  • Loading branch information
dionisiydk committed Jul 15, 2017
1 parent f80446d commit 4fda0a9
Show file tree
Hide file tree
Showing 286 changed files with 2,115 additions and 0 deletions.
5 changes: 5 additions & 0 deletions BaselineOfObjectStatistics.package/.filetree
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"separateMethodMetaAndSource" : false,
"noMethodMetaData" : true,
"useCypressPropertiesFile" : true
}
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
baselines
baseline: spec
<baseline>
spec for: #'common' do: [
spec baseline: 'StateSpecs' with: [
spec
repository: 'github://dionisiydk/StateSpecs:v2.4.x';
loads: 'Core' ].
spec baseline: 'Mocketry' with: [
spec repository: 'github://dionisiydk/Mocketry:v4.0.x' ].
spec
package: 'ObjectStatistics' with: [spec requires: #('StateSpecs')];
package: 'ObjectStatistics-Tests' with: [spec requires: #('ObjectStatistics' 'Mocketry')];
package: 'ObjectStatistics-GTTools' with: [spec requires: #('ObjectStatistics')].
spec
group: 'default' with: #('Core' 'ObjectStatistics-GTTools' 'Tests');
group: 'Core' with: #('ObjectStatistics');
group: 'Tests' with: #('ObjectStatistics-Tests') ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"commentStamp" : "",
"super" : "BaselineOf",
"category" : "BaselineOfObjectStatistics",
"classinstvars" : [ ],
"pools" : [ ],
"classvars" : [ ],
"instvars" : [ ],
"name" : "BaselineOfObjectStatistics",
"type" : "normal"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
SystemOrganization addCategory: #BaselineOfObjectStatistics!
Empty file.
1 change: 1 addition & 0 deletions BaselineOfObjectStatistics.package/monticello.meta/package
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(name 'BaselineOfObjectStatistics')
1 change: 1 addition & 0 deletions BaselineOfObjectStatistics.package/properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ }
5 changes: 5 additions & 0 deletions ObjectStatistics-GTTools.package/.filetree
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"separateMethodMetaAndSource" : false,
"noMethodMetaData" : true,
"useCypressPropertiesFile" : true
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*ObjectStatistics-GTTools
gtInspectorItemsTreeIn: composite
<gtInspectorPresentationOrder: 1>
ObjectStatistics buildInspectorMetricsTreeIn: composite
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*ObjectStatistics-GTTools
inspectorTreeItems
^self sortedSlices
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"name" : "ObjectStatDimension"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*ObjectStatistics-GTTools
gtInspectorItemsTreeIn: composite
<gtInspectorPresentationOrder: 1>
statistics gtInspectorItemsTreeIn: composite
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*ObjectStatistics-GTTools
inspectorTreeItems
^statistics inspectorTreeItems
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"name" : "ObjectStatSlice"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
*ObjectStatistics-GTTools
buildInspectorMetricsTreeIn: composite
| tree |
tree := composite tree
title: 'Metrics';
allowsRecursiveSearch: true;
" shouldExpandToLevel: 0;"

children: [ :receiver | receiver inspectorTreeItems].
self expandInspectorTree: tree.
^tree
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*ObjectStatistics-GTTools
expandInspectorTree: tree
tree rootsExpanded.
tree allExpanded
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*ObjectStatistics-GTTools
gtInspectorItemsTreeIn: composite
<gtInspectorPresentationOrder: 1>

self class buildInspectorMetricsTreeIn: composite
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*ObjectStatistics-GTTools
inspectorTreeItems
dimensions size = 1 ifTrue: [ ^dimensions first inspectorTreeItems ].

^dimensions reject: #isEmpty
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"name" : "ObjectStatistics"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
SystemOrganization addCategory: #'ObjectStatistics-GTTools'!
Empty file.
1 change: 1 addition & 0 deletions ObjectStatistics-GTTools.package/monticello.meta/package
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(name 'ObjectStatistics-GTTools')
1 change: 1 addition & 0 deletions ObjectStatistics-GTTools.package/properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ }
5 changes: 5 additions & 0 deletions ObjectStatistics-Tests.package/.filetree
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"separateMethodMetaAndSource" : false,
"noMethodMetaData" : true,
"useCypressPropertiesFile" : true
}
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
tests
testMeasureObjects

| counter |
counter := ObjectStatCounter new.

(counter measure: Any) should be: 1.
(counter measure: Any) should be: 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"commentStamp" : "",
"super" : "TestCase",
"category" : "ObjectStatistics-Tests",
"classinstvars" : [ ],
"pools" : [ ],
"classvars" : [ ],
"instvars" : [ ],
"name" : "ObjectStatCounterTests",
"type" : "normal"
}
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
tests
testCreationNewMetricForDimension

| metric actual |
metric := ObjectStatDifferentPropertiesCounter for: [:o | o first].

actual := metric newForDimension.

actual should beInstanceOf: metric class.
actual measuredProperties should not be: metric measuredProperties
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
tests
testMeasureObjects

| counter |
counter := ObjectStatDifferentPropertiesCounter for: [:o | o first] .

(counter measure: #(#object)) should be: 1.
(counter measure: #(#object) copy) should be: 0.
(counter measure: #(#object2)) should be: 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
tests
testMeasureObjectsWhenPropertyIsCollection

| counter |
counter := ObjectStatDifferentPropertiesCounter for: [:o | o first] .

(counter measure: #(#object)) should be: 1.
(counter measure: #(#(#object #object2 #object3)) copy) should be: 2.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"commentStamp" : "",
"super" : "TestCase",
"category" : "ObjectStatistics-Tests",
"classinstvars" : [ ],
"pools" : [ ],
"classvars" : [ ],
"instvars" : [ ],
"name" : "ObjectStatDifferentPropertiesCounterTests",
"type" : "normal"
}
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
tests
testCheckThatMetricIsIgnored

| dimension |
dimension := ObjectStatDimension new.
dimension ignoreMetrics: #('metric1Name' 'metric2Name').

dimension should be isIgnoreMetric: (ObjectStatMetric named: 'metric1Name').
dimension should be isIgnoreMetric: (ObjectStatMetric named: 'metric2Name').

dimension should not be isIgnoreMetric: (ObjectStatMetric named: 'someOtherMetric')
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
tests
testConvertingToDimension

| dimension |
dimension := ObjectStatDimension new.

dimension where asObjectStatDimension should be: dimension
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
tests
testCopyForSubDimension

| dimension copy |
dimension := ObjectStatDimension named: 'test dim'.
dimension slices: #currentSlices.

copy := dimension copyForSubDimension.

copy should beInstanceOf: ObjectStatDimension.
copy name should equal: 'test dim'.
copy slices should not be: dimension slices.
copy slices should beInstanceOf: Dictionary
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
tests
testGettingSortedSlices

| dimension actual stat |
stat := ObjectStatistics new.
stat countAllAs: 'strings'.
dimension := [:o | o size] asObjectStatDimension.
dimension overallStatistics: stat.

dimension accumulateAll: #('asd' 'qwe' 'a' 'b' 'c' '1234').

actual := dimension sortedSlices.

actual should haveSize: 3.
actual where first coordinate should be: 1.
actual where second coordinate should be: 3.
actual where last coordinate should be: 4.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
tests
testHasAnyObjectsSpecByDefault

| dimension |
dimension := ObjectStatDimension new.

(dimension objectsSpec == Any) should be: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
tests
testHasEmptySlicesByDefault

| dimension |
dimension := ObjectStatDimension new.

dimension where slices should be isEmpty
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
tests
testHasEmptySubDimensionsByDefault

| dimension |
dimension := ObjectStatDimension new.

dimension where subDimensions should be isEmpty
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
tests
testObjectsAccumulationShouldSkipObjectsWhichNotSatisfiedSpec

| dimension slice |
slice := Mock new.
dimension := ObjectStatDimension by: [ :each | #sliceCoordinate ].
dimension objectsSpec: [ :o | o ~= #object ].

dimension slices at: #sliceCoordinate put: slice.

dimension accumulate: #object.

slice should not receive accumulate: #object
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
tests
testObjectsAccumulationWhenNoSlicesExist

| dimension overallStat slice |
overallStat := Mock new.
dimension := ObjectStatDimension by: [ :each | #sliceCoordinate ].
dimension overallStatistics: overallStat.

dimension accumulate: #object.

slice := dimension sliceFor: #sliceCoordinate.
slice should beInstanceOf: ObjectStatSlice.
slice coordinate should be: #sliceCoordinate.
slice statistics should beReturnedFrom: [overallStat newForDimension: dimension].
slice statistics should receive accumulate: #object
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
tests
testObjectsAccumulationWhenSliceAlreadyExistsForIt

| dimension slice |
slice := Mock new.
dimension := ObjectStatDimension by: [ :each | #sliceCoordinate ].

dimension slices at: #sliceCoordinate put: slice.

dimension accumulate: #object.

slice should receive accumulate: #object
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
tests
testPreparingStatistics

| dimension |
[:subDimension1 :subDimension2 :stat |
dimension := ObjectStatDimension new.
dimension subDimensions: { subDimension1. subDimension2 }.
subDimension1 stub copyForSubDimension willReturn: #newDim1.
subDimension2 stub copyForSubDimension willReturn: #newDim2.

dimension prepareStatistics: stat.

stat should receive addDimension: #newDim1.
stat should receive addDimension: #newDim2.
] runWithMocks
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"commentStamp" : "",
"super" : "TestCase",
"category" : "ObjectStatistics-Tests",
"classinstvars" : [ ],
"pools" : [ ],
"classvars" : [ ],
"instvars" : [ ],
"name" : "ObjectStatDimensionTests",
"type" : "normal"
}
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
tests
testCreationFromBlock

| metric block |
block := [ :o | ].

metric := block asObjectStatMetric.

metric should beInstanceOf: ObjectStatFunctionMetric.
metric functionBlock should be: block
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
tests
testMeasureObjects

| object metric actual |
object := Mock new.
object stub someMetric willReturn: #result.

metric := [ :o | o someMetric ] asObjectStatMetric.

actual := metric measure: object.

actual should be: #result.
Loading

0 comments on commit 4fda0a9

Please sign in to comment.