aoc2023/day_3/test.rb

37 lines
536 B
Ruby
Raw Normal View History

2023-12-03 17:52:16 +01:00
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