From 6c96651ea22711ffa055a43d050de77c04ba4b67 Mon Sep 17 00:00:00 2001 From: Hemal Varambhia Date: Sun, 7 Jul 2019 22:12:23 +0100 Subject: [PATCH 01/19] [issue-106] Improved message names. --- src/Math-Accuracy-Core/PMAccuracy.class.st | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/Math-Accuracy-Core/PMAccuracy.class.st b/src/Math-Accuracy-Core/PMAccuracy.class.st index 01ca179a0..e857cec73 100644 --- a/src/Math-Accuracy-Core/PMAccuracy.class.st +++ b/src/Math-Accuracy-Core/PMAccuracy.class.st @@ -252,24 +252,24 @@ PMAccuracy >> ifSeveralterations: aBlock [ ] { #category : #'initialize-release' } -PMAccuracy >> initNames [ +PMAccuracy >> initRest: aName [ + | initializationMessage | + initializationMessage := ('initialize' , aName) asSymbol. + (self respondsTo: initializationMessage) + ifTrue: [ self perform: initializationMessage ] +] + +{ #category : #'initialize-release' } +PMAccuracy >> initSubclassSelectorNames [ names := (self class allSelectorsBelow: Object) select: [ :s | s beginsWith: #check ] thenCollect: [ :s | s copyFrom: 6 to: s size ]. names := names asArray sort ] -{ #category : #'initialize-release' } -PMAccuracy >> initRest: aName [ - | i | - i := ('initialize' , aName) asSymbol. - (self respondsTo: i) - ifTrue: [ self perform: i ] -] - { #category : #'initialize-release' } PMAccuracy >> initialize [ - self initNames. + self initSubclassSelectorNames. parameters := Dictionary new. arguments := Dictionary new. results := Dictionary new. From 8cdadd5f98a72ff5bc996b3b4abe4767ef6f2af9 Mon Sep 17 00:00:00 2001 From: Hemal Varambhia Date: Sun, 7 Jul 2019 22:25:03 +0100 Subject: [PATCH 02/19] [issue-106] The happy path should not be the guard clause; normally the subclass should respond to the message. --- src/Math-Accuracy-Core/PMAccuracy.class.st | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Math-Accuracy-Core/PMAccuracy.class.st b/src/Math-Accuracy-Core/PMAccuracy.class.st index e857cec73..49e51dd7a 100644 --- a/src/Math-Accuracy-Core/PMAccuracy.class.st +++ b/src/Math-Accuracy-Core/PMAccuracy.class.st @@ -256,7 +256,8 @@ PMAccuracy >> initRest: aName [ | initializationMessage | initializationMessage := ('initialize' , aName) asSymbol. (self respondsTo: initializationMessage) - ifTrue: [ self perform: initializationMessage ] + ifFalse: [ ^ self ]. + self perform: initializationMessage ] { #category : #'initialize-release' } From 79ce907177316290e2069320938be04e50ed63dd Mon Sep 17 00:00:00 2001 From: Hemal Varambhia Date: Sun, 7 Jul 2019 22:31:25 +0100 Subject: [PATCH 03/19] [issue-106] Improved the name of the block variable. --- src/Math-Accuracy-Core/PMAccuracy.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Math-Accuracy-Core/PMAccuracy.class.st b/src/Math-Accuracy-Core/PMAccuracy.class.st index 49e51dd7a..761b783b6 100644 --- a/src/Math-Accuracy-Core/PMAccuracy.class.st +++ b/src/Math-Accuracy-Core/PMAccuracy.class.st @@ -277,7 +277,7 @@ PMAccuracy >> initialize [ aStream := WriteStream with: ''. iterations := 1. dataTree := KeyedTree new . - names do: [ :n | self initRest: n ] + names do: [ :name | self initRest: name ] ] { #category : #accessing } From 81967ac19de5691ab33d08b4fc7058f6fc177133 Mon Sep 17 00:00:00 2001 From: Hemal Varambhia Date: Sun, 7 Jul 2019 22:38:02 +0100 Subject: [PATCH 04/19] [issue-106] Moved related code closer together. initRest goes on to populate parameters, arguments and results. --- src/Math-Accuracy-Core/PMAccuracy.class.st | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Math-Accuracy-Core/PMAccuracy.class.st b/src/Math-Accuracy-Core/PMAccuracy.class.st index 761b783b6..593ccd762 100644 --- a/src/Math-Accuracy-Core/PMAccuracy.class.st +++ b/src/Math-Accuracy-Core/PMAccuracy.class.st @@ -270,14 +270,15 @@ PMAccuracy >> initSubclassSelectorNames [ { #category : #'initialize-release' } PMAccuracy >> initialize [ - self initSubclassSelectorNames. parameters := Dictionary new. arguments := Dictionary new. results := Dictionary new. + self initSubclassSelectorNames. + names do: [ :name | self initRest: name ]. aStream := WriteStream with: ''. iterations := 1. - dataTree := KeyedTree new . - names do: [ :name | self initRest: name ] + dataTree := KeyedTree new. + ] { #category : #accessing } From d2596fc977e33aae1e554a77772d09363e0b116b Mon Sep 17 00:00:00 2001 From: Hemal Varambhia Date: Sun, 7 Jul 2019 22:45:12 +0100 Subject: [PATCH 05/19] [issue-106] The asString message send is redundant. --- src/Math-Accuracy-Core/PMAccuracy.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Math-Accuracy-Core/PMAccuracy.class.st b/src/Math-Accuracy-Core/PMAccuracy.class.st index 593ccd762..f335233ba 100644 --- a/src/Math-Accuracy-Core/PMAccuracy.class.st +++ b/src/Math-Accuracy-Core/PMAccuracy.class.st @@ -212,7 +212,7 @@ PMAccuracy >> findKey [ | s m | s := thisContext sender. m := s sender method selector . - ^(names detect: [:n| m asString endsWith: n] ifNone: [nil]) + ^(names detect: [:n| m endsWith: n] ifNone: [nil]) ifNil: [ m='initialize' ifTrue: ['AllTheRest'] ifFalse: [ m := s method selector asString. From ce8ccbed9c3df126f9240aab4b2308828e4384ac Mon Sep 17 00:00:00 2001 From: Hemal Varambhia Date: Sun, 7 Jul 2019 22:47:09 +0100 Subject: [PATCH 06/19] [issue-106] Improved the name of the temp variable. --- src/Math-Accuracy-Core/PMAccuracy.class.st | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Math-Accuracy-Core/PMAccuracy.class.st b/src/Math-Accuracy-Core/PMAccuracy.class.st index f335233ba..d1bcb4059 100644 --- a/src/Math-Accuracy-Core/PMAccuracy.class.st +++ b/src/Math-Accuracy-Core/PMAccuracy.class.st @@ -209,14 +209,14 @@ PMAccuracy >> extremeCollection: acol max:aBoolean [ { #category : #private } PMAccuracy >> findKey [ - | s m | + | s selector | s := thisContext sender. - m := s sender method selector . - ^(names detect: [:n| m endsWith: n] ifNone: [nil]) - ifNil: [ m='initialize' + selector := s sender method selector . + ^(names detect: [:n| selector endsWith: n] ifNone: [nil]) + ifNil: [ selector='initialize' ifTrue: ['AllTheRest'] - ifFalse: [ m := s method selector asString. - self error: m,' called in wrong context'] ] + ifFalse: [ selector := s method selector asString. + self error: selector,' called in wrong context'] ] ] { #category : #printing } From 8b100f265c08eb2648ff73234a7ab6c1ce48d72b Mon Sep 17 00:00:00 2001 From: Hemal Varambhia Date: Sun, 7 Jul 2019 22:57:34 +0100 Subject: [PATCH 07/19] [issue-106] Improved the names of the block variables. --- src/Math-Accuracy-Core/PMAccuracy.class.st | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Math-Accuracy-Core/PMAccuracy.class.st b/src/Math-Accuracy-Core/PMAccuracy.class.st index d1bcb4059..7e9db7399 100644 --- a/src/Math-Accuracy-Core/PMAccuracy.class.st +++ b/src/Math-Accuracy-Core/PMAccuracy.class.st @@ -212,7 +212,7 @@ PMAccuracy >> findKey [ | s selector | s := thisContext sender. selector := s sender method selector . - ^(names detect: [:n| selector endsWith: n] ifNone: [nil]) + ^(names detect: [:name| selector endsWith: name] ifNone: [nil]) ifNil: [ selector='initialize' ifTrue: ['AllTheRest'] ifFalse: [ selector := s method selector asString. @@ -263,8 +263,8 @@ PMAccuracy >> initRest: aName [ { #category : #'initialize-release' } PMAccuracy >> initSubclassSelectorNames [ names := (self class allSelectorsBelow: Object) - select: [ :s | s beginsWith: #check ] - thenCollect: [ :s | s copyFrom: 6 to: s size ]. + select: [ :selectorName | selectorName beginsWith: #check ] + thenCollect: [ :selectorName | selectorName copyFrom: 6 to: selectorName size ]. names := names asArray sort ] From 0183720c9f86e9b72279e08bec5cd8a5f5c510cc Mon Sep 17 00:00:00 2001 From: Hemal Varambhia Date: Sun, 7 Jul 2019 23:23:02 +0100 Subject: [PATCH 08/19] [issue-106] The asString is redundant as the tests remain green. --- src/Math-Accuracy-Core/PMAccuracy.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Math-Accuracy-Core/PMAccuracy.class.st b/src/Math-Accuracy-Core/PMAccuracy.class.st index 7e9db7399..bc064b5e4 100644 --- a/src/Math-Accuracy-Core/PMAccuracy.class.st +++ b/src/Math-Accuracy-Core/PMAccuracy.class.st @@ -215,7 +215,7 @@ PMAccuracy >> findKey [ ^(names detect: [:name| selector endsWith: name] ifNone: [nil]) ifNil: [ selector='initialize' ifTrue: ['AllTheRest'] - ifFalse: [ selector := s method selector asString. + ifFalse: [ selector := s method selector. self error: selector,' called in wrong context'] ] ] From fdc4862ed85c3b2f3702445883831a054a613ae6 Mon Sep 17 00:00:00 2001 From: Hemal Varambhia Date: Tue, 9 Jul 2019 21:34:50 +0100 Subject: [PATCH 09/19] [issue-106] Extracted code to an intention-revealing method. --- src/Math-Accuracy-Core/PMAccuracy.class.st | 23 ++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/Math-Accuracy-Core/PMAccuracy.class.st b/src/Math-Accuracy-Core/PMAccuracy.class.st index bc064b5e4..d19a5c926 100644 --- a/src/Math-Accuracy-Core/PMAccuracy.class.st +++ b/src/Math-Accuracy-Core/PMAccuracy.class.st @@ -305,6 +305,19 @@ PMAccuracy >> numberOfDifferentResultsAt: aname [ ^ no first isCollection ifTrue: [ no size ] ifFalse: [ 1 ] ] +{ #category : #accessing } +PMAccuracy >> occurrencesOf: key In: aResults UpTo: anInteger [ + | repetitions | + repetitions := 0. + aResults + from: 1 + to: anInteger + do: [ :i | + i = key + ifTrue: [ repetitions := repetitions + 1 ] ]. + ^ repetitions +] + { #category : #accessing } PMAccuracy >> parameter [ | r | @@ -396,15 +409,9 @@ PMAccuracy >> resultsKeyFor: aName AtPosition: anInteger [ key := aResults at: anInteger. key isArray ifFalse: [ ^ aResults ]. - repetitions := 0. - aResults - from: 1 - to: anInteger - 1 - do: [ :i | - i = key - ifTrue: [ repetitions := repetitions + 1 ] ]. + repetitions := self occurrencesOf: key In: aResults UpTo: anInteger - 1. result := (Array new: key size + repetitions) - replaceFrom: 1 + replaceFrom: 1 to: key size with: key startingAt: 1. From 545dd0619ed4b9d2b2db7f650c31c6a4b76f2f60 Mon Sep 17 00:00:00 2001 From: Hemal Varambhia Date: Tue, 9 Jul 2019 22:47:05 +0100 Subject: [PATCH 10/19] [issue-106] Simplified the calculation of the occurence of a key. --- src/Math-Accuracy-Core/PMAccuracy.class.st | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/Math-Accuracy-Core/PMAccuracy.class.st b/src/Math-Accuracy-Core/PMAccuracy.class.st index d19a5c926..34397eef2 100644 --- a/src/Math-Accuracy-Core/PMAccuracy.class.st +++ b/src/Math-Accuracy-Core/PMAccuracy.class.st @@ -308,13 +308,7 @@ PMAccuracy >> numberOfDifferentResultsAt: aname [ { #category : #accessing } PMAccuracy >> occurrencesOf: key In: aResults UpTo: anInteger [ | repetitions | - repetitions := 0. - aResults - from: 1 - to: anInteger - do: [ :i | - i = key - ifTrue: [ repetitions := repetitions + 1 ] ]. + repetitions := (aResults copyFrom: 1 to: anInteger) occurrencesOf: key. ^ repetitions ] From 71b537720aeda6301c7852241d1e699a762d93e0 Mon Sep 17 00:00:00 2001 From: Hemal Varambhia Date: Tue, 9 Jul 2019 22:49:34 +0100 Subject: [PATCH 11/19] [issue-106] Inlined the temporary variable as it is now redundant. --- src/Math-Accuracy-Core/PMAccuracy.class.st | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/Math-Accuracy-Core/PMAccuracy.class.st b/src/Math-Accuracy-Core/PMAccuracy.class.st index 34397eef2..ea45eead3 100644 --- a/src/Math-Accuracy-Core/PMAccuracy.class.st +++ b/src/Math-Accuracy-Core/PMAccuracy.class.st @@ -307,9 +307,7 @@ PMAccuracy >> numberOfDifferentResultsAt: aname [ { #category : #accessing } PMAccuracy >> occurrencesOf: key In: aResults UpTo: anInteger [ - | repetitions | - repetitions := (aResults copyFrom: 1 to: anInteger) occurrencesOf: key. - ^ repetitions + ^ (aResults copyFrom: 1 to: anInteger) occurrencesOf: key ] { #category : #accessing } From 91ef7e1ac7805b1fe550870745ef8b586751a799 Mon Sep 17 00:00:00 2001 From: Hemal Varambhia Date: Fri, 12 Jul 2019 22:11:34 +0100 Subject: [PATCH 12/19] [issue-106] Extracted an code to an intention-revealing local temp and improved ormatting. --- src/Math-Accuracy-Core/PMAccuracy.class.st | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/Math-Accuracy-Core/PMAccuracy.class.st b/src/Math-Accuracy-Core/PMAccuracy.class.st index ea45eead3..ceeb033dd 100644 --- a/src/Math-Accuracy-Core/PMAccuracy.class.st +++ b/src/Math-Accuracy-Core/PMAccuracy.class.st @@ -209,14 +209,17 @@ PMAccuracy >> extremeCollection: acol max:aBoolean [ { #category : #private } PMAccuracy >> findKey [ - | s selector | + | s selector matchingMessage | s := thisContext sender. - selector := s sender method selector . - ^(names detect: [:name| selector endsWith: name] ifNone: [nil]) - ifNil: [ selector='initialize' - ifTrue: ['AllTheRest'] - ifFalse: [ selector := s method selector. - self error: selector,' called in wrong context'] ] + selector := s sender method selector. + matchingMessage := names + detect: [ :name | selector endsWith: name ] + ifNone: [ nil ]. + ^ matchingMessage + ifNil: [ selector = 'initialize' + ifTrue: [ 'AllTheRest' ] + ifFalse: [ selector := s method selector. + self error: selector , ' called in wrong context' ] ] ] { #category : #printing } From dc4a0d6ee37af21f4dd0ce91356ce9f452d6d835 Mon Sep 17 00:00:00 2001 From: Hemal Varambhia Date: Fri, 12 Jul 2019 22:18:26 +0100 Subject: [PATCH 13/19] [issue-106] Inlined the variable as it over wrote the earlier assignment. --- src/Math-Accuracy-Core/PMAccuracy.class.st | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Math-Accuracy-Core/PMAccuracy.class.st b/src/Math-Accuracy-Core/PMAccuracy.class.st index ceeb033dd..096aa7f43 100644 --- a/src/Math-Accuracy-Core/PMAccuracy.class.st +++ b/src/Math-Accuracy-Core/PMAccuracy.class.st @@ -218,8 +218,7 @@ PMAccuracy >> findKey [ ^ matchingMessage ifNil: [ selector = 'initialize' ifTrue: [ 'AllTheRest' ] - ifFalse: [ selector := s method selector. - self error: selector , ' called in wrong context' ] ] + ifFalse: [ self error: s method selector , ' called in wrong context' ] ] ] { #category : #printing } From 234ed4440884b2a9a27d8bed485c90fe72181105 Mon Sep 17 00:00:00 2001 From: Hemal Varambhia Date: Fri, 12 Jul 2019 22:28:25 +0100 Subject: [PATCH 14/19] [issue-106] The initialize call looks like a special case, so transformed it into a guard clause. --- src/Math-Accuracy-Core/PMAccuracy.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Math-Accuracy-Core/PMAccuracy.class.st b/src/Math-Accuracy-Core/PMAccuracy.class.st index 096aa7f43..08c94a6b2 100644 --- a/src/Math-Accuracy-Core/PMAccuracy.class.st +++ b/src/Math-Accuracy-Core/PMAccuracy.class.st @@ -212,12 +212,12 @@ PMAccuracy >> findKey [ | s selector matchingMessage | s := thisContext sender. selector := s sender method selector. + selector = 'initialize' ifTrue: [ ^ 'AllTheRest' ]. matchingMessage := names detect: [ :name | selector endsWith: name ] ifNone: [ nil ]. ^ matchingMessage ifNil: [ selector = 'initialize' - ifTrue: [ 'AllTheRest' ] ifFalse: [ self error: s method selector , ' called in wrong context' ] ] ] From 1a2af4e0048347170d36c9fb111ea908d7df8a7e Mon Sep 17 00:00:00 2001 From: Hemal Varambhia Date: Fri, 12 Jul 2019 22:32:55 +0100 Subject: [PATCH 15/19] [issue-106] Improved code formatting. --- src/Math-Accuracy-Core/PMAccuracy.class.st | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Math-Accuracy-Core/PMAccuracy.class.st b/src/Math-Accuracy-Core/PMAccuracy.class.st index 08c94a6b2..dee01f25d 100644 --- a/src/Math-Accuracy-Core/PMAccuracy.class.st +++ b/src/Math-Accuracy-Core/PMAccuracy.class.st @@ -212,7 +212,8 @@ PMAccuracy >> findKey [ | s selector matchingMessage | s := thisContext sender. selector := s sender method selector. - selector = 'initialize' ifTrue: [ ^ 'AllTheRest' ]. + selector = 'initialize' + ifTrue: [ ^ 'AllTheRest' ]. matchingMessage := names detect: [ :name | selector endsWith: name ] ifNone: [ nil ]. From f40c4d892bdf7584a2096380777bd852d084dffa Mon Sep 17 00:00:00 2001 From: Hemal Varambhia Date: Fri, 12 Jul 2019 22:36:18 +0100 Subject: [PATCH 16/19] [issue-106] The check is redundant now because we have got passed the guard clause. --- src/Math-Accuracy-Core/PMAccuracy.class.st | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Math-Accuracy-Core/PMAccuracy.class.st b/src/Math-Accuracy-Core/PMAccuracy.class.st index dee01f25d..f1ee234d2 100644 --- a/src/Math-Accuracy-Core/PMAccuracy.class.st +++ b/src/Math-Accuracy-Core/PMAccuracy.class.st @@ -218,8 +218,7 @@ PMAccuracy >> findKey [ detect: [ :name | selector endsWith: name ] ifNone: [ nil ]. ^ matchingMessage - ifNil: [ selector = 'initialize' - ifFalse: [ self error: s method selector , ' called in wrong context' ] ] + ifNil: [ self error: s method selector , ' called in wrong context' ] ] { #category : #printing } From a71833cd6b06791b76a9e7803a63a5d706edbe83 Mon Sep 17 00:00:00 2001 From: Hemal Varambhia Date: Sat, 13 Jul 2019 21:31:48 +0100 Subject: [PATCH 17/19] [issue-106] The nil check is unnecessary now given the ifNone: call. The call to join: is for efficiency (O(n) vs O(n^2) for concatenation). This was recommended by Pharo. --- src/Math-Accuracy-Core/PMAccuracy.class.st | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Math-Accuracy-Core/PMAccuracy.class.st b/src/Math-Accuracy-Core/PMAccuracy.class.st index f1ee234d2..e5b7c8038 100644 --- a/src/Math-Accuracy-Core/PMAccuracy.class.st +++ b/src/Math-Accuracy-Core/PMAccuracy.class.st @@ -216,9 +216,8 @@ PMAccuracy >> findKey [ ifTrue: [ ^ 'AllTheRest' ]. matchingMessage := names detect: [ :name | selector endsWith: name ] - ifNone: [ nil ]. + ifNone: [ self error: (s method selector join: ' called in wrong context') ]. ^ matchingMessage - ifNil: [ self error: s method selector , ' called in wrong context' ] ] { #category : #printing } From d6b51054b2e1613015c026f9f3eec891b5ed03eb Mon Sep 17 00:00:00 2001 From: Hemal Varambhia Date: Sat, 13 Jul 2019 22:11:37 +0100 Subject: [PATCH 18/19] [issue-106] Reverted the change as we are only concatenating two strings which is not super inefficient. --- src/Math-Accuracy-Core/PMAccuracy.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Math-Accuracy-Core/PMAccuracy.class.st b/src/Math-Accuracy-Core/PMAccuracy.class.st index e5b7c8038..76d8f8ae3 100644 --- a/src/Math-Accuracy-Core/PMAccuracy.class.st +++ b/src/Math-Accuracy-Core/PMAccuracy.class.st @@ -216,7 +216,7 @@ PMAccuracy >> findKey [ ifTrue: [ ^ 'AllTheRest' ]. matchingMessage := names detect: [ :name | selector endsWith: name ] - ifNone: [ self error: (s method selector join: ' called in wrong context') ]. + ifNone: [ self error: (s method selector , ' called in wrong context') ]. ^ matchingMessage ] From c497a3df44dbf8a9c4c5179bfe44061e76d3c2ed Mon Sep 17 00:00:00 2001 From: Hemal Varambhia Date: Tue, 16 Jul 2019 22:28:05 +0100 Subject: [PATCH 19/19] [issue-106] Removed obselete code. --- src/Math-Accuracy-Core/PMAccuracy.class.st | 2 +- src/Math-Tests-Accuracy/PMAccuracyTest.class.st | 15 --------------- .../PMAccuracyTestExample.class.st | 15 --------------- 3 files changed, 1 insertion(+), 31 deletions(-) diff --git a/src/Math-Accuracy-Core/PMAccuracy.class.st b/src/Math-Accuracy-Core/PMAccuracy.class.st index 76d8f8ae3..1e74de0a5 100644 --- a/src/Math-Accuracy-Core/PMAccuracy.class.st +++ b/src/Math-Accuracy-Core/PMAccuracy.class.st @@ -216,7 +216,7 @@ PMAccuracy >> findKey [ ifTrue: [ ^ 'AllTheRest' ]. matchingMessage := names detect: [ :name | selector endsWith: name ] - ifNone: [ self error: (s method selector , ' called in wrong context') ]. + ifNone: [ '' ]. ^ matchingMessage ] diff --git a/src/Math-Tests-Accuracy/PMAccuracyTest.class.st b/src/Math-Tests-Accuracy/PMAccuracyTest.class.st index d56b08d84..cb68ab31c 100644 --- a/src/Math-Tests-Accuracy/PMAccuracyTest.class.st +++ b/src/Math-Tests-Accuracy/PMAccuracyTest.class.st @@ -38,11 +38,6 @@ PMAccuracyTest >> testArgumentAt [ self assert: (a argumentAt: 'Ccc') equals: #(#(1) #(1.1) #(0.9)) ] -{ #category : #tests } -PMAccuracyTest >> testArgumentError [ - self should: [ a testArgumentError ] raise: Error -] - { #category : #tests } PMAccuracyTest >> testAsArray [ self assert: (a asArray: 'bla') equals: #('bla'). @@ -271,11 +266,6 @@ PMAccuracyTest >> testParameterAt [ self assert: (a parameterAt: 'Fff') isNil ] -{ #category : #tests } -PMAccuracyTest >> testParameterError [ -self should: [a testParameterError ]raise: Error -] - { #category : #tests } PMAccuracyTest >> testPrintOn [ | s | @@ -300,11 +290,6 @@ PMAccuracyTest >> testReport [ self assert: (a report beginsWith: 'Report for: PMAccuracyTestExample') ] -{ #category : #tests } -PMAccuracyTest >> testResultError [ -self should: [a testResultError ]raise: Error -] - { #category : #tests } PMAccuracyTest >> testResultsKeyForAtPosition [ self assert: (a resultsKeyFor: 'Aaa' AtPosition: 2) equals: #(4 4). diff --git a/src/Math-Tests-Accuracy/PMAccuracyTestExample.class.st b/src/Math-Tests-Accuracy/PMAccuracyTestExample.class.st index f536164d0..70c90e4a5 100644 --- a/src/Math-Tests-Accuracy/PMAccuracyTestExample.class.st +++ b/src/Math-Tests-Accuracy/PMAccuracyTestExample.class.st @@ -110,11 +110,6 @@ PMAccuracyTestExample >> tearDown [ count :=count-(1/5). ] -{ #category : #private } -PMAccuracyTestExample >> testArgumentError [ -self argument: #(#(1) #(2)). -] - { #category : #private } PMAccuracyTestExample >> testGetterAaa [ ^{ self parameter .self argument.self resultsAt: 'Aaa'.self numberOfDifferentParametersAt: 'Aaa'.self numberOfDifferentResultsAt:'Aaa'} @@ -124,13 +119,3 @@ PMAccuracyTestExample >> testGetterAaa [ PMAccuracyTestExample >> testGetterBbb [ ^{ self parameter .self argument.self resultsAt: 'Bbb'.self numberOfDifferentParametersAt: 'Bbb'.self numberOfDifferentResultsAt:'Bbb'} ] - -{ #category : #private } -PMAccuracyTestExample >> testParameterError [ -self parameter: #(#(1) #(2)). -] - -{ #category : #private } -PMAccuracyTestExample >> testResultError [ -self result:#(1). -]