--- Begin Message ---Op 2-9-2020 om 12:38 schreef Richard O'Keefe:
There is simply no point in "taking the first nine numbers out".And there shouldn't BE a test for the string being empty, anywhere.'' '-' '---' and so on should all be handled the same way.
Oh well, what stops you doing
digits := aString select: [:each | each ~= $-].digits size = 10 ifFalse: [^false].lastDigit := digits la ost.digits := digits copyFrom: 1 to: 9.( (lastDigit = $X or: [lastDigit isDigit]) and: [
digits allSatisfy: #isDigit]) ifFalse: [^false].
Now my code does not do this, but it is just 16 lines of code withnothing that it would make sense to extract.
Nothing only that I could not think of this one for myself.
If I do it the TDD way I come more on the way Im currently thinking
but does this case then be covered
test14_EmptyIsbn
| result |
result := isbnVerifierCalculator isValidIsbn: ''.
self assert: result equals: false
and still I have to do the calcualation to see if it's valid.
If I understand the code well I can use the digits variable ?
Roelof
--- End Message ---
Re: [Pharo-users] Can it do this way ?
Roelof Wobben via Pharo-users Wed, 02 Sep 2020 03:53:02 -0700
- [Pharo-users] Can it do this way ? Roelof Wobben via Pharo-users
- Re: [Pharo-users] Can it do this way ? Richard O'Keefe
- Re: [Pharo-users] Can it do this wa... Roelof Wobben via Pharo-users
- Re: [Pharo-users] Can it do this wa... Richard O'Keefe
- Re: [Pharo-users] Can it do thi... Roelof Wobben via Pharo-users
- Re: [Pharo-users] Can it do... Roelof Wobben via Pharo-users
- Re: [Pharo-users] Can it do thi... Richard O'Keefe
- Re: [Pharo-users] Can it do... Roelof Wobben via Pharo-users
- Re: [Pharo-users] Can ... Roelof Wobben via Pharo-users
- Re: [Pharo-users] ... Steffen Märcker
- Re: [Pharo-use... Roelof Wobben via Pharo-users
- Re: [Pharo-use... Steffen Märcker
- Re: [Pharo-use... Roelof Wobben via Pharo-users
- Re: [Pharo-use... Steffen Märcker
- Re: [Pharo-use... Steffen Märcker