29 lines
468 B
Ruby
29 lines
468 B
Ruby
if ARGV[0] == "2"
|
|
require_relative "impl_2"
|
|
RESULT = 71503
|
|
else
|
|
require_relative "impl"
|
|
RESULT = 288
|
|
end
|
|
|
|
|
|
INPUT = <<~IN
|
|
Time: 7 15 30
|
|
Distance: 9 40 200
|
|
IN
|
|
|
|
def test_example
|
|
parsed = parse(INPUT)
|
|
result = calculate(parsed)
|
|
|
|
if result == RESULT
|
|
puts "Test successful. Now run with real input"
|
|
puts "ruby day_6/run.rb #{ARGV[0]}"
|
|
else
|
|
puts "Test failed"
|
|
puts "expected \"#{RESULT}\" got \"#{result}\""
|
|
end
|
|
end
|
|
|
|
test_example
|