aboutsummaryrefslogtreecommitdiff
path: root/spec/practical/bf_spec.cr
diff options
context:
space:
mode:
authorMatthew Hall <hallmatthew314@gmail.com>2023-03-26 15:27:41 +1300
committerMatthew Hall <hallmatthew314@gmail.com>2023-03-26 15:27:41 +1300
commited57fac2de48c7a86536ae22c77540f787d49a81 (patch)
treeef4e2b314a2e39c7327b01cf9fed09edbbc6b91d /spec/practical/bf_spec.cr
parent63dcfef9b99de484a737043afabe8c48d5105eb6 (diff)
Refactoring
Diffstat (limited to 'spec/practical/bf_spec.cr')
-rw-r--r--spec/practical/bf_spec.cr4
1 files changed, 2 insertions, 2 deletions
diff --git a/spec/practical/bf_spec.cr b/spec/practical/bf_spec.cr
index cd14c59..d1ad488 100644
--- a/spec/practical/bf_spec.cr
+++ b/spec/practical/bf_spec.cr
@@ -122,13 +122,13 @@ describe "brainfuck parser" do
end
shift_block = (Parser.token('<') | Parser.token('>')).some.map do |cs|
- left_count = cs.count { |c| c == '<' }
+ left_count = cs.count(&.==('<'))
right_count = cs.size - left_count
{type: BFOpType::Shift, amount: right_count - left_count}
end
add_block = (Parser.token('+') | Parser.token('-')).some.map do |cs|
- minus_count = cs.count { |c| c == '-' }
+ minus_count = cs.count(&.==('-'))
plus_count = cs.size - minus_count
{type: BFOpType::Add, amount: plus_count - minus_count}
end