tests/testthat/test-day05.R

test_that("Day 5", {
  example <- '0,9 -> 5,9
8,0 -> 0,8
9,4 -> 3,4
2,2 -> 2,1
7,0 -> 7,4
6,4 -> 2,0
0,9 -> 2,9
3,4 -> 1,4
0,0 -> 8,8
5,5 -> 8,2'
  lines <- read_segments(textConnection(example))
  expect_equal(count_intersections(lines), 5)
  expect_equal(count_intersections(lines, part2 = TRUE), 12)
})
Selbosh/adventofcode2021 documentation built on Jan. 1, 2022, 7:20 p.m.