37 lines
536 B
Ruby
37 lines
536 B
Ruby
if ARGV[0] == "2"
|
|
require_relative "impl_2"
|
|
RESULT = 467835
|
|
else
|
|
require_relative "impl"
|
|
RESULT = 4361
|
|
end
|
|
|
|
|
|
INPUT = <<~IN
|
|
467..114..
|
|
...*......
|
|
..35..633.
|
|
......#...
|
|
617*......
|
|
.....+.58.
|
|
..592.....
|
|
......755.
|
|
...$.*....
|
|
.664.598..
|
|
IN
|
|
|
|
def test_example
|
|
parsed = parse(INPUT)
|
|
result = calculate(parsed)
|
|
|
|
if result == RESULT
|
|
puts "Test successful. Now run with real input"
|
|
puts "ruby day_3/run.rb #{ARGV[0]}"
|
|
else
|
|
puts "Test failed"
|
|
puts "expected \"#{RESULT}\" got \"#{result}\""
|
|
end
|
|
end
|
|
|
|
test_example
|