Skip to content

Commit

Permalink
Fix Codenarc warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
amedee committed Dec 11, 2023
1 parent 03a747e commit 39a4f66
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ class Day01 {

static move = { String instruction ->
switch (instruction) {
case "(":
case '(':
return 1
case ")":
case ')':
return -1
default:
return 0
Expand All @@ -21,4 +21,4 @@ class Day01 {
.sum()
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,51 +10,51 @@ import static be.amedee.adventofcode.aoc2015.day01.Day01.move
class Day01Test extends Specification {

@Shared
String input = getClass().getResource("input").getText("UTF-8")
String input = getClass().getResource('input').getText('UTF-8')

@Unroll
def "one move in elevator"(String instruction, int direction) {
def 'one move in elevator'(String instruction, int direction) {
expect:
move(instruction) == direction

where:
instruction | direction
"(" | 1
")" | -1
"" | 0
"*" | 0
"(())" | 0
"()()" | 0
"(((" | 0
"(()(()(" | 0
"))(((((" | 0
"())" | 0
"))(" | 0
")))" | 0
")())())" | 0
'(' | 1
')' | -1
'' | 0
'*' | 0
'(())' | 0
'()()' | 0
'(((' | 0
'(()(()(' | 0
'))(((((' | 0
'())' | 0
'))(' | 0
')))' | 0
')())())' | 0
null | 0
}

@Unroll
def "several moves in elevator"(String instructions, int floor) {
def 'several moves in elevator'(String instructions, int floor) {
expect:
followInstructions(instructions) == floor

where:
instructions | floor
"(" | 1
")" | -1
"" | 0
"*" | 0
"(())" | 0
"()()" | 0
"(((" | 3
"(()(()(" | 3
"))(((((" | 3
"())" | -1
"))(" | -1
")))" | -3
")())())" | -3
'(' | 1
')' | -1
'' | 0
'*' | 0
'(())' | 0
'()()' | 0
'(((' | 3
'(()(()(' | 3
'))(((((' | 3
'())' | -1
'))(' | -1
')))' | -3
')())())' | -3
null | 0
/**
* Solution in Bash:
Expand Down

0 comments on commit 39a4f66

Please sign in to comment.