day13.lisp (1302B)
1 (in-package #:adventofcode2022/test) 2 3 (define-constant +testdata-day13+ "[1,1,3,1,1] 4 [1,1,5,1,1] 5 6 [[1],[2,3,4]] 7 [[1],4] 8 9 [9] 10 [[8,7,6]] 11 12 [[4,4],4,4] 13 [[4,4],4,4,4] 14 15 [7,7,7,7] 16 [7,7,7] 17 18 [] 19 [3] 20 21 [[[]]] 22 [[]] 23 24 [1,[2,[3,[4,[5,6,7]]]],8,9] 25 [1,[2,[3,[4,[5,6,0]]]],8,9]" 26 :test 'equal) 27 28 (def-test day13-compare-lists () 29 (is-true (adventofcode2022/day13::compare-lists 30 #(1 1 3 1 1) 31 #(1 1 5 1 1))) 32 (is-true (not (adventofcode2022/day13::compare-lists 33 #(#(#() #(3 2 10))) 34 #(#(#() 2 #() 1 #(4 1)) #(3 #(#(8 4 0 7 8) 4 2)) 35 #(#(9 #(2 1 8 2) #(6 0 3 1 1)) 4) #(10 2 2))))) 36 (is-true (adventofcode2022/day13::compare-lists 37 #(#() #(#(0 2 #(8) #(10 7) #(2 8 9 6)) 2 9 7) #(#(#())) 38 #(10 4 0 #(8 #(10 7 0 3) #(6 5) #(4 1 2 4))) 39 #(10 4 #(7 5 #(10 4) 5) #(#(6 4 0) 7) 7)) 40 #(#() #(7 #(#(7 6))) 41 #(8 #(10 #(2 6) #(9 7 0 5 10)) 42 #(#(8))) 43 #(#(#() 9 0 #(3 5 8) 9) 5) 44 #(2 9))))) 45 46 (def-test day13-task1 () 47 (is-true 48 (= 13 49 (run-task 13 1 50 (make-string-input-stream +testdata-day13+))))) 51 52 (def-test day13-task2 () 53 (is-true 54 (= 140 55 (run-task 13 2 56 (make-string-input-stream +testdata-day13+)))))