Skip to content

Commit

Permalink
awk/scrabble-score: 2nd iteration
Browse files Browse the repository at this point in the history
  • Loading branch information
vpayno committed Sep 11, 2023
1 parent d5d692b commit bed84b9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 23 deletions.
37 changes: 18 additions & 19 deletions awk/scrabble-score/run-tests-awk.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,26 +29,25 @@ gawk: warning: function `assertEquals' defined but never called directly
gawk: warning: function `assert' defined but never called directly
gawk: ./awkunit.awk:26: warning: reference to uninitialized variable `_assert_exit'

real 0m0.003s
real 0m0.005s
user 0m0.003s
sys 0m0.000s
sys 0m0.002s

gawk --lint --file=./scrabble-score.awk < /dev/null > /dev/null
gawk: ./scrabble-score.awk:21: warning: `switch' is a gawk extension
gawk: ./scrabble-score.awk:22: warning: `case' is a gawk extension
gawk: ./scrabble-score.awk:44: warning: `default' is a gawk extension
gawk: warning: function `is_color' defined but never called directly
gawk: ./scrabble-score.awk:17: warning: `switch' is a gawk extension
gawk: ./scrabble-score.awk:18: warning: `case' is a gawk extension
gawk: ./scrabble-score.awk:40: warning: `default' is a gawk extension

real 0m0.003s
real 0m0.005s
user 0m0.002s
sys 0m0.001s
sys 0m0.003s

gawk --lint --file=./test-cases.awk < /dev/null > /dev/null
gawk: ./test-cases.awk:8: warning: subscript of array `cases' is null string

real 0m0.003s
user 0m0.002s
sys 0m0.000s
real 0m0.004s
user 0m0.001s
sys 0m0.003s

exit 0

Expand All @@ -69,9 +68,9 @@ ok 10 empty input
ok 11 entire alphabet available
ok 12 bonus: blank tile counts as zero

real 0m0.447s
user 0m0.288s
sys 0m0.178s
real 0m0.506s
user 0m0.343s
sys 0m0.194s

exit 0

Expand Down Expand Up @@ -291,9 +290,9 @@ Test 37:

37 out of 37 tests passed!

real 0m0.007s
user 0m0.003s
sys 0m0.004s
real 0m0.008s
user 0m0.002s
sys 0m0.006s

Tests Passed!

Expand All @@ -303,8 +302,8 @@ exit 0

Running: misspell .

real 0m0.042s
user 0m0.044s
real 0m0.028s
user 0m0.029s
sys 0m0.017s

===============================================================================
Expand Down
4 changes: 0 additions & 4 deletions awk/scrabble-score/scrabble-score.awk
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
#!/usr/bin/gawk --bignum --lint --file

function is_color(color) {
return match(color, /^(black|brown|red|orange|yellow|green|blue|violet|grey|white)?$/)
}

function scrabbleScore(input) {
uppercase = ""
score = 0
Expand Down

0 comments on commit bed84b9

Please sign in to comment.