Skip to content

Commit

Permalink
Port FEN to outputTestsWithSep()
Browse files Browse the repository at this point in the history
One step closer to killing []Run as the hole contract.
  • Loading branch information
JRaspass committed Sep 22, 2024
1 parent 04d78c6 commit 4d21049
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions hole/forsyth-edwards-notation.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ func forsythEdwardsNotation() []Run {
strings.Join(shuffle([]string{"2k1N3", "7r", "8", "2B5", "3rb3", "4n3", "1R6", "4K3"}), "/") + " w - - 0 50",
})

var buf strings.Builder
tests := make([]test, len(args))

for i, arg := range args {
if i > 0 {
buf.WriteString("\n\n")
}
var buf strings.Builder

for i, c := range arg {
if c == ' ' {
break
Expand All @@ -36,7 +36,9 @@ func forsythEdwardsNotation() []Run {
buf.WriteRune(pieceMap[c])
}
}

tests[i] = test{in: arg, out: buf.String()}
}

return []Run{{Args: args, Answer: strings.TrimRight(buf.String(), "\n")}}
return outputTestsWithSep("\n\n", tests)
}

0 comments on commit 4d21049

Please sign in to comment.