summaryrefslogtreecommitdiff
path: root/2025
diff options
context:
space:
mode:
authorDJ O'Leary <dijitol@proton.me>2025-12-06 21:22:31 +0100
committerDJ O'Leary <dijitol@proton.me>2025-12-06 21:22:36 +0100
commit9ed30f54f5d73fcdc9a56613baed28c53659aba5 (patch)
treed32c963d575b77d60ca84a0813415055c199e381 /2025
parent80af66af9527999e29343b14d3311f0a0b83c4f4 (diff)
feat(2025d3p1): partial solution, getting the wrong answer
Manually did entire real input and codified into tests but even sum of manual answer is wrong. Code fails for some lines of real input and these failing lines have been reduced into regression tests. work-in-progress: true
Diffstat (limited to '2025')
-rw-r--r--2025/ocaml/lib/application/d03p01.ml36
-rw-r--r--2025/ocaml/lib/application/d03p01.mli2
-rw-r--r--2025/ocaml/lib/domain/d03p01.ml99
-rw-r--r--2025/ocaml/test/domain/dune3
-rw-r--r--2025/ocaml/test/domain/test_d03p01.ml836
5 files changed, 974 insertions, 2 deletions
diff --git a/2025/ocaml/lib/application/d03p01.ml b/2025/ocaml/lib/application/d03p01.ml
index b63679e..8e9c32c 100644
--- a/2025/ocaml/lib/application/d03p01.ml
+++ b/2025/ocaml/lib/application/d03p01.ml
@@ -15,6 +15,40 @@
5. Cast to int
Sum the result of each line
+
+ Tried: 17024 (hint: too low) - original
+ Tried: 17061 (hint: too low) - fixed second digit promotion - "343411" would give 41 instead of 44
+ Tried: 17081 (no hint given) - fixed second last digit promotion - "789" would give 79 insted of 89
+ Tried: 17091 (no hint given) - no change but found diff of 10 in failing test case
+ Tried: 17090 (no hint given) - no change but realised failing test case actually had a diff of 9 not 10 (have 56, want 65)
+ Tried: 17099 (no hint given) - no change but found additional failing test case (have 67, want 76)
+
+ Upper bound: 200 * 99 = 19800
*)
-let solve _ () = failwith "not started"
+open Domain.D03p01
+
+let to_lines s =
+ s |> String.split_on_char '\n' |> List.map String.trim
+ |> List.filter (fun l -> l <> "")
+
+let solve input () =
+ input |> to_lines |> List.to_seq
+ |> Seq.map BatteryBank.of_string
+ |> Seq.mapi (fun idx bb ->
+ let joltage = BatteryBank.highest_joltage bb in
+ Logs.debug (fun m ->
+ m "%d line=%s highest_joltage=%d" (idx + 1) (BatteryBank.pp bb)
+ joltage ) ;
+ joltage )
+ |> Seq.fold_left ( + ) 0
+
+let print_occurring_digits input () =
+ input |> to_lines |> List.to_seq
+ |> Seq.map BatteryBank.of_string
+ |> Seq.map BatteryBank.to_list
+ |> Seq.map (List.sort_uniq Battery.compare)
+ |> Seq.map BatteryBank.of_list
+ |> Seq.iteri (fun idx bb ->
+ Logs.debug (fun m -> m "%d %s" (idx + 1) (BatteryBank.pp bb)) ) ;
+ -1
diff --git a/2025/ocaml/lib/application/d03p01.mli b/2025/ocaml/lib/application/d03p01.mli
index 85f7e78..d875e40 100644
--- a/2025/ocaml/lib/application/d03p01.mli
+++ b/2025/ocaml/lib/application/d03p01.mli
@@ -2,3 +2,5 @@ val solve : string -> unit -> int
(** [solve input ()] is the solution for the first part of the third day of advent of code 2025 for [input].
The solution for an empty input is 0.
Requires: [input] to be a string. *)
+
+val print_occurring_digits : string -> unit -> int
diff --git a/2025/ocaml/lib/domain/d03p01.ml b/2025/ocaml/lib/domain/d03p01.ml
index e69de29..7f56bdc 100644
--- a/2025/ocaml/lib/domain/d03p01.ml
+++ b/2025/ocaml/lib/domain/d03p01.ml
@@ -0,0 +1,99 @@
+module Battery : sig
+ type t
+
+ val of_int : int -> t
+
+ val to_int : t -> int
+
+ val to_string : t -> string
+
+ val compare : t -> t -> int
+
+ val pp : t -> string
+end = struct
+ type t = int
+
+ let of_int i = i
+
+ let to_int b = b
+
+ let to_string = string_of_int
+
+ let compare = Int.compare
+
+ let pp = string_of_int
+end
+
+module BatteryBank : sig
+ type t
+
+ val highest_joltage : t -> int
+
+ val of_string : string -> t
+
+ val of_list : Battery.t list -> t
+
+ val to_list : t -> Battery.t list
+
+ val pp : t -> string
+end = struct
+ type t = Battery.t list
+
+ let rec highest_joltage bb =
+ match highest_joltage_aux (None, None) bb with
+ | None, None ->
+ 0
+ | Some x, Some y ->
+ int_of_string (Battery.to_string x ^ Battery.to_string y)
+ | _ ->
+ failwith "this branch should be impossible"
+
+ and highest_joltage_aux acc = function
+ | [] ->
+ acc
+ | h :: t ->
+ highest_joltage_aux
+ ( match acc with
+ | None, None ->
+ (Some h, None)
+ | Some first, None ->
+ (Some first, Some h)
+ | Some first, Some second ->
+ swap_if_higher first second h (List.length t = 0)
+ | _ ->
+ failwith "this branch should be impossible" )
+ t
+
+ and swap_if_higher first second considering is_end =
+ let c_gt_f = Battery.compare considering first = 1 in
+ let c_gt_s = Battery.compare considering second = 1 in
+ let f_gt_s = Battery.compare first second = 1 in
+ if c_gt_f && c_gt_s && f_gt_s then
+ if is_end then (Some first, Some considering) else (Some considering, None)
+ else if (not c_gt_f) && c_gt_s && f_gt_s then (Some first, Some considering)
+ else if c_gt_f && c_gt_s && not f_gt_s then
+ if is_end then (Some second, Some considering)
+ else (Some considering, None)
+ else if (not c_gt_f) && (not c_gt_s) && f_gt_s then (Some first, Some second)
+ else if c_gt_f && (not c_gt_s) && not f_gt_s then
+ (Some second, Some considering)
+ else (Some first, Some second)
+
+ let of_string s =
+ s |> String.to_seq
+ |> Seq.map (fun c -> Char.escaped c |> int_of_string |> Battery.of_int)
+ |> List.of_seq
+
+ let of_list lst = lst
+
+ let to_list bb = bb
+
+ let pp bb =
+ "[ "
+ ^ ( bb |> List.map Battery.pp
+ |> List.fold_left
+ (fun acc b ->
+ if acc = "" then b ^ ";" else Printf.sprintf "%s %s;" acc b )
+ "" )
+ ^ " ]"
+end
diff --git a/2025/ocaml/test/domain/dune b/2025/ocaml/test/domain/dune
index 7630ea4..5a6222d 100644
--- a/2025/ocaml/test/domain/dune
+++ b/2025/ocaml/test/domain/dune
@@ -1,7 +1,8 @@
(tests
(names
test_d01p01
- test_d01p02)
+ test_d01p02
+ test_d03p01)
(libraries
domain
alcotest))
diff --git a/2025/ocaml/test/domain/test_d03p01.ml b/2025/ocaml/test/domain/test_d03p01.ml
new file mode 100644
index 0000000..169b99b
--- /dev/null
+++ b/2025/ocaml/test/domain/test_d03p01.ml
@@ -0,0 +1,836 @@
+open Domain.D03p01
+
+let test_highest_joltage have want () =
+ Alcotest.(check int)
+ "highest joltage in battery bank" want
+ (BatteryBank.of_string have |> BatteryBank.highest_joltage)
+
+let () =
+ let open Alcotest in
+ run "D03p01"
+ [ ( "example BatteryBank.highest_joltage"
+ , [ test_case "example line 1" `Quick
+ (test_highest_joltage "987654321111111" 98)
+ ; test_case "example line 2" `Quick
+ (test_highest_joltage "811111111111119" 89)
+ ; test_case "example line 3" `Quick
+ (test_highest_joltage "234234234234278" 78)
+ ; test_case "example line 4" `Quick
+ (test_highest_joltage "818181911112111" 92) ] )
+ ; ( "real BatteryBank.highest_joltage"
+ , [ test_case "real line 001" `Quick
+ (test_highest_joltage
+ "3434845634454364546334335333448443354324533545443235414334477424442444346844344244444434445333344314"
+ 88 )
+ ; test_case "real line 002" `Quick
+ (test_highest_joltage
+ "4644333464433434855275434364342435544972433324444444432243354936362863356444434344443333433425344432"
+ 99 )
+ ; test_case "real line 003" `Quick
+ (test_highest_joltage
+ "3475855376536553445244645449948436834663673457444335454425154463544745554434526565475244677445573464"
+ 99 )
+ ; test_case "real line 004" `Quick
+ (test_highest_joltage
+ "2281212713222421222222213222212222221223122222212125222722232132222251212212322222222722312232333312"
+ 87 )
+ ; test_case "real line 005" `Quick
+ (test_highest_joltage
+ "4483335423223456243275328893923136663523559445363393353333233337733323263852953335475336578422333454"
+ 99 )
+ ; test_case "real line 006" `Quick
+ (test_highest_joltage
+ "3242323333312323243333333353413314243333232242233323431332332353323333353333333332443515323433322274"
+ 74 )
+ ; test_case "real line 007" `Quick
+ (test_highest_joltage
+ "2333332242424335244422323333113323312234133433323243344324444233324245126142444324422445113241224322"
+ 65 )
+ ; test_case "real line 008" `Quick
+ (test_highest_joltage
+ "5154432634655462574764324542474445554653643456344345657233718556457665426344257554246426445655364424"
+ 87 )
+ ; test_case "real line 009" `Quick
+ (test_highest_joltage
+ "2333128322322632533324333135293331312321323332214333232434433322473232223344341214372234132223223343"
+ 97 )
+ ; test_case "real line 010" `Quick
+ (test_highest_joltage
+ "4334244423552542164444513547496574512523344184674374558444434436645643164524326453333335444434455453"
+ 98 )
+ ; test_case "real line 011" `Quick
+ (test_highest_joltage
+ "4132222247423242222232632242222124423421222271231244222212222222554221311221262314222222224253442337"
+ 77 )
+ ; test_case "real line 012" `Quick
+ (test_highest_joltage
+ "2224322221122233225272222222442223222222271115422222121223262743222224222322422224123122262323222821"
+ 82 )
+ ; test_case "real line 013" `Quick
+ (test_highest_joltage
+ "6723822256923221233223334322457233343332383332523433343323228646232524535432233323314353333227243323"
+ 98 )
+ ; test_case "real line 014" `Quick
+ (test_highest_joltage
+ "6115546238253222343552462122324244122555232412242231255242342542222232432524132213523232121212324545"
+ 86 )
+ ; test_case "real line 015" `Quick
+ (test_highest_joltage
+ "6463573733747321131532311243414374652372276761664731354417577566137677557472577677776125327145332589"
+ 89 )
+ ; test_case "real line 016" `Quick
+ (test_highest_joltage
+ "3754415413732333338423242374334432153868351274433435343563444545253375644356474264434423432633233432"
+ 88 )
+ ; test_case "real line 017" `Quick
+ (test_highest_joltage
+ "5444434434444444443644344444454454451442423444454444444344443433464444435453445443443354555334454454"
+ 66 )
+ ; test_case "real line 018" `Quick
+ (test_highest_joltage
+ "2322232322322342121231422323212136222323332232223332423222231222323222323213211222124112122223323222"
+ 64 )
+ ; test_case "real line 019" `Quick
+ (test_highest_joltage
+ "2123222121233313232324221212131322222312114122122222223331524242222223522421122132314232232221325212"
+ 55 )
+ ; test_case "real line 020" `Quick
+ (test_highest_joltage
+ "4395244125441654554734234542525455274423553314354552543244444237453434822334223553453354325435235232"
+ 98 )
+ ; test_case "real line 021" `Quick
+ (test_highest_joltage
+ "2253424214422444223313135223232832334333553541324423242333333332422343235234313221222522523223223324"
+ 85 )
+ ; test_case "real line 022" `Quick
+ (test_highest_joltage
+ "5235226542352363765362222242266353124241222253326335131251514362226422434463674353246334124656282122"
+ 82 )
+ ; test_case "real line 023" `Quick
+ (test_highest_joltage
+ "2232123624442243412224246433221223412221211333362434222314122321222374432142634122244234226424224222"
+ 76 )
+ ; test_case "real line 024" `Quick
+ (test_highest_joltage
+ "3422335122727323322362432313322322322223332332223816131326233213327243223323343212331236353226232321"
+ 87 )
+ ; test_case "real line 025" `Quick
+ (test_highest_joltage
+ "4331335233332333423433313313173432431333333532233333433343363343333332336433333237323332253433443333"
+ 77 )
+ ; test_case "real line 026" `Quick
+ (test_highest_joltage
+ "4447448444443444434444443243543534134744452133424233431341466844433346243413344384231154343384832444"
+ 88 )
+ ; test_case "real line 027" `Quick
+ (test_highest_joltage
+ "2425565264165457455876521452237584855214342125728464762555858525255422733375855552537425835156285135"
+ 88 )
+ ; test_case "real line 028" `Quick
+ (test_highest_joltage
+ "1331226211234222222312211322123232233513242526221423223222232214322223122232333222282842423352327112"
+ 88 )
+ ; test_case "real line 029" `Quick
+ (test_highest_joltage
+ "3223434225632352425252225227722722534655252243423421222422525141365526221342142264132653472224125223"
+ 77 )
+ ; test_case "real line 030" `Quick
+ (test_highest_joltage
+ "6737524344344356458523434443443144444264443348734644444644541613334445654733443544253434843553348938"
+ 98 )
+ ; test_case "real line 031" `Quick
+ (test_highest_joltage
+ "3354422734545554524252254222935229552422513243152263456254352212241422142433745251122447413225375454"
+ 99 )
+ ; test_case "real line 032" `Quick
+ (test_highest_joltage
+ "2264222763222232222612274362233123232631142294332533623322433223214212132333126222163271553323113546"
+ 97 )
+ ; test_case "real line 033" `Quick
+ (test_highest_joltage
+ "3224455231554212335327234452322334222224355323335331221333422324235123435122325533513215236323223567"
+ 77 )
+ ; test_case "real line 034" `Quick
+ (test_highest_joltage
+ "3364433535332344433338434131353453131351342344343443434434354345544614344346424444464434454542463163"
+ 86 )
+ ; test_case "real line 035" `Quick
+ (test_highest_joltage
+ "3334311333353143563633334222343222333252653351532534233523263233265333333263352353553235353353353333"
+ 66 )
+ ; test_case "real line 036" `Quick
+ (test_highest_joltage
+ "2341414245234322423322241415434452323345544444442373441644233534541453435433235452441251543332443224"
+ 76 )
+ ; test_case "real line 037" `Quick
+ (test_highest_joltage
+ "2334222122362114522212222223212342234225232414234232252812322221321123236322322233153222246262451321"
+ 86 )
+ ; test_case "real line 038" `Quick
+ (test_highest_joltage
+ "3222213324143222521232511323442333353115354312453322323233245125121212335352213422325232423442113222"
+ 55 )
+ ; test_case "real line 039" `Quick
+ (test_highest_joltage
+ "4242234421454245624314342344231425552454131112356244265233623318251442244258454232422222544212344274"
+ 88 )
+ ; test_case "real line 040" `Quick
+ (test_highest_joltage
+ "1212211622212622232222232221122222234222325251233221113223526233333222121362242225251522222122222412"
+ 66 )
+ ; test_case "real line 041" `Quick
+ (test_highest_joltage
+ "1224243142354932247624132223442221243261122146133223131475431216123424343342231246215132422542144273"
+ 97 )
+ ; test_case "real line 042" `Quick
+ (test_highest_joltage
+ "2492338342383524333242442252453454334643633243343233244463532534334332436821235243322432152236224423"
+ 98 )
+ ; test_case "real line 043" `Quick
+ (test_highest_joltage
+ "7676556546555455945548897555565858677556364454655765687644455555553584455358535855555564435524555636"
+ 99 )
+ ; test_case "real line 044" `Quick
+ (test_highest_joltage
+ "4325352353133335234532433545335543523225232353214622764538523233325246333312335343542333525343352832"
+ 88 )
+ ; test_case "real line 045" `Quick
+ (test_highest_joltage
+ "3645465557845534765556456438425473478555654328555485735454543757533734857854555473533459558165456246"
+ 98 )
+ ; test_case "real line 046" `Quick
+ (test_highest_joltage
+ "4112321222222221222222222212221112212222222213112212233222211122121222223233221122122112222222312222"
+ 43 )
+ ; test_case "real line 047" `Quick
+ (test_highest_joltage
+ "3443534216134325237234252533391415524526262523352143237242332332332422332332347132554552354213163423"
+ 97 )
+ ; test_case "real line 048" `Quick
+ (test_highest_joltage
+ "3233233443433352233334353335313474353433313433333332332445324732323333325354333345123333238333323343"
+ 84 )
+ ; test_case "real line 049" `Quick
+ (test_highest_joltage
+ "2133222332312231142332122412332211233373432222221234222233216312322233333313213322233312422332412321"
+ 76 )
+ ; test_case "real line 050" `Quick
+ (test_highest_joltage
+ "2323442214442251652225322254455617413464434422211515255422722166366711262534452258439143226431422432"
+ 96 )
+ ; test_case "real line 051" `Quick
+ (test_highest_joltage
+ "3112243242223312224423222512422243342333412424122234223224524214241424224424422232231222421343123313"
+ 55 )
+ ; test_case "real line 052" `Quick
+ (test_highest_joltage
+ "2524625652353456554546431455532426742414535225832464326233444242524314463569626432264234665412452611"
+ 96 )
+ ; test_case "real line 053" `Quick
+ (test_highest_joltage
+ "2623224224152132332532122544116272213711472512222547253263227634222862855322152332253264721222222626"
+ 88 )
+ ; test_case "real line 054" `Quick
+ (test_highest_joltage
+ "3413862324452342446454316341334346457442436472446424131344156965335463455345446483132552535546336316"
+ 98 )
+ ; test_case "real line 055" `Quick
+ (test_highest_joltage
+ "5354344333214443434343442334124434322442443544435334333334544442334442344432244334534423233345433234"
+ 55 )
+ ; test_case "real line 056" `Quick
+ (test_highest_joltage
+ "2322333211233223212213111213123244423222222232323332222322212221323323433322435233232371222222214231"
+ 74 )
+ ; test_case "real line 057" `Quick
+ (test_highest_joltage
+ "9453214484824262259522856649224244244222211592233334238214222322284346591381262187242644522629832223"
+ 99 )
+ ; test_case "real line 058" `Quick
+ (test_highest_joltage
+ "1121224242322123123163448337222562512232262643222323252252223543512425222422222223142233221426365461"
+ 87 )
+ ; test_case "real line 059" `Quick
+ (test_highest_joltage
+ "1815612518244643515355768361121163421324442178622168752374328877665672243587235441472714316317588369"
+ 89 )
+ ; test_case "real line 060" `Quick
+ (test_highest_joltage
+ "3655264263765432665494374452246362724532226675513545216322644525426252338564464426261732379225267837"
+ 99 )
+ ; test_case "real line 061" `Quick
+ (test_highest_joltage
+ "8334743433235341445622143424833423324734232433333132424333763435142253533364333734887344542326984333"
+ 98 )
+ ; test_case "real line 062" `Quick
+ (test_highest_joltage
+ "6333532332533333262332333332623323523436233333331335433333433323333133233344333378336333352223333232"
+ 78 )
+ ; test_case "real line 063" `Quick
+ (test_highest_joltage
+ "3366253633632333372333133255934725232323263352222274223213323533141234362324236915143323333136434233"
+ 99 )
+ ; test_case "real line 064" `Quick
+ (test_highest_joltage
+ "5322222323283352224135234432224523225232853242442423241544234623253324537257221444443224442542343223"
+ 88 )
+ ; test_case "real line 065" `Quick
+ (test_highest_joltage
+ "2322722344168237322333228462433332227336523244323265343321333443434132333343333492223332435724342464"
+ 97 )
+ ; test_case "real line 066" `Quick
+ (test_highest_joltage
+ "5554845434744255655687844665866661355767464556478385448756657654567285577634695565556616935646635793"
+ 99 )
+ ; test_case "real line 067" `Quick
+ (test_highest_joltage
+ "6212623112233212232222321423231243253343231323432932323232222135322122237222134283242231231725212252"
+ 98 )
+ ; test_case "real line 068" `Quick
+ (test_highest_joltage
+ "3224333333132232431414376222443332422422322223342332333335333224256832733233433622542324333442322953"
+ 95 )
+ ; test_case "real line 069" `Quick
+ (test_highest_joltage
+ "1495248962734145243214425252551493515624456535246426262254542145634343245522513375341266233457656414"
+ 99 )
+ ; test_case "real line 070" `Quick
+ (test_highest_joltage
+ "3333243514122577341633436443431333234233434851333432454335423136533335534834354554332443233443334233"
+ 88 )
+ ; test_case "real line 071" `Quick
+ (test_highest_joltage
+ "6775435378454755775937393515454694792745716493599675572454465734647574159354586497336464643987566774"
+ 99 )
+ ; test_case "real line 072" `Quick
+ (test_highest_joltage
+ "3343255423334231444544444344434343234333434343544344434524254354244544424452234444333442244454345533"
+ 55 )
+ ; test_case "real line 073" `Quick
+ (test_highest_joltage
+ "5644753727566756775567545585754676596645654664776746756665476666666556676466474667695655766564656657"
+ 99 )
+ ; test_case "real line 074" `Quick
+ (test_highest_joltage
+ "4644226464352276354314244224452454342423454622134648332554423425336244425432349642233521244367349342"
+ 99 )
+ ; test_case "real line 075" `Quick
+ (test_highest_joltage
+ "3433335543445753633424571853934424332643345643544683232351242335433242324425464344622364532352533437"
+ 98 )
+ ; test_case "real line 076" `Quick
+ (test_highest_joltage
+ "4332333343143333333343333474334265443333334214354551322433433243313234333232425433333443443433526343"
+ 76 )
+ ; test_case "real line 077" `Quick
+ (test_highest_joltage
+ "4353646245233554434324342343533543343355335434535413535233331345445333253655446433354372556332324562"
+ 76 )
+ ; test_case "real line 078" `Quick
+ (test_highest_joltage
+ "4325222211212322234523222222252532247122313123373542232242121352322276216822338182262236346922722222"
+ 97 )
+ ; test_case "real line 079" `Quick
+ (test_highest_joltage
+ "2322565523552147152522424415733545252325565263526635227432457357155822584542343524555344525552453543"
+ 88 )
+ ; test_case "real line 080" `Quick
+ (test_highest_joltage
+ "2536964744575897532331584947348473443439336365524543425393413335486443645364675453424543335446555498"
+ 99 )
+ ; test_case "real line 081" `Quick
+ (test_highest_joltage
+ "2222213441222221121213232422422313244252223442212222212522422224224223231124422422243512212213212342"
+ 55 )
+ ; test_case "real line 082" `Quick
+ (test_highest_joltage
+ "2226345127525427354274576964233625784361152623467725726752473254364464625478727754525322265247112673"
+ 98 )
+ ; test_case "real line 083" `Quick
+ (test_highest_joltage
+ "3333323323439434233332343233242333523333333322324323333432333327112333312433423132233322331432333323"
+ 97 )
+ ; test_case "real line 084" `Quick
+ (test_highest_joltage
+ "3333434534333424243331497446456437324756447475342274464232844334833254353445422233546141144533344344"
+ 98 )
+ ; test_case "real line 085" `Quick
+ (test_highest_joltage
+ "3696167353668222145864766623627542566388745676275342437244534257633357663535464676463344222466874743"
+ 98 )
+ ; test_case "real line 086" `Quick
+ (test_highest_joltage
+ "2221243212226232221214225213222212321222322222222222321222213152222212232613223422294232232522123112"
+ 95 )
+ ; test_case "real line 087" `Quick
+ (test_highest_joltage
+ "2322223332222333222222322222224233422221212122124224222442422313242232322322322132221232323232224243"
+ 44 )
+ ; test_case "real line 088" `Quick
+ (test_highest_joltage
+ "3222473241422323343212233253252455323361331212425233323243431532523435223231512332242372313333353233"
+ 77 )
+ ; test_case "real line 089" `Quick
+ (test_highest_joltage
+ "5423224242232312223222322332344353122123124433226352334261254221453422322421343522321125621432243323"
+ 66 )
+ ; test_case "real line 090" `Quick
+ (test_highest_joltage
+ "8363335374334533365422233335351363332233354423323122333333234434223223333335635423442344353624352436"
+ 87 )
+ ; test_case "real line 091" `Quick
+ (test_highest_joltage
+ "3363445765667922559186654477737547964555446686459554733657654766566655765548166378754867769354765564"
+ 99 )
+ ; test_case "real line 092" `Quick
+ (test_highest_joltage
+ "6533212432223424334451322232232232443253324232723281475224244243554253222475635635422425222222222428"
+ 88 )
+ ; test_case "real line 093" `Quick
+ (test_highest_joltage
+ "1223233332437322323134322352329283423333133433331533223722733221342425515333543413253332323254332144"
+ 98 )
+ ; test_case "real line 094" `Quick
+ (test_highest_joltage
+ "5264162233623746665261784343112243254221441535263624414528422142852361426326676128424382222772232624"
+ 88 )
+ ; test_case "real line 095" `Quick
+ (test_highest_joltage
+ "1222232222322322212232232122232322222331222223323232222322212223221222223122132222222226222311212222"
+ 63 )
+ ; test_case "real line 096" `Quick
+ (test_highest_joltage
+ "2447938353242561333434522543524366633338233372322372443172638272362414623239322222214322338432223233"
+ 99 )
+ ; test_case "real line 097" `Quick
+ (test_highest_joltage
+ "4884849914558496499986874887474387879218486546454756422444585589669397378725447645287563673434787636"
+ 99 )
+ ; test_case "real line 098" `Quick
+ (test_highest_joltage
+ "1532312355432455353342333225253523373245346353222322243344325423634342343333235353462335235134532214"
+ 76 )
+ ; test_case "real line 099" `Quick
+ (test_highest_joltage
+ "3633115526253432364354661645232316365446622332424352521423265511535341213222665264163264143532241789"
+ 89 )
+ ; test_case "real line 100" `Quick
+ (test_highest_joltage
+ "1333723464325672225363386433359834138466234942326568553333727332463624757374234473543533336465426327"
+ 99 )
+ ; test_case "real line 101" `Quick
+ (test_highest_joltage
+ "8325733945242354443883554334669457355644376375344222347347435474443336786843454755374733473222713744"
+ 99 )
+ ; test_case "real line 102" `Quick
+ (test_highest_joltage
+ "3836536232345525523424516573323367655557875645136254455455455555237343456565656555565433564652375615"
+ 88 )
+ ; test_case "real line 103" `Quick
+ (test_highest_joltage
+ "1222242222222222222221222222222222222222222222214222242212122221223267222222112122222222222221223723"
+ 77 )
+ ; test_case "real line 104" `Quick
+ (test_highest_joltage
+ "2122322223222221341225222331152222221222222221222222222212223231322221121224122222222221222322221221"
+ 55 )
+ ; test_case "real line 105" `Quick
+ (test_highest_joltage
+ "2623431563346525416242365622564363427642123425242364433596524126242622114536213245235652674623263514"
+ 97 )
+ ; test_case "real line 106" `Quick
+ (test_highest_joltage
+ "2232456232323314322243433252432326454256232632225662224221422412232162235555244527334626356269224262"
+ 96 )
+ ; test_case "real line 107" `Quick
+ (test_highest_joltage
+ "2223224223121316212222123214122222321222232222214222223322235255232321232421222233223123422332226121"
+ 66 )
+ ; test_case "real line 108" `Quick
+ (test_highest_joltage
+ "2232222211641215121113421342225332233222241313112621422223224321232326222212352222222222322222232142"
+ 66 )
+ ; test_case "real line 109" `Quick
+ (test_highest_joltage
+ "3622224322123323543363333123532223522232121233221223212255624222224222331222232221222223332412252226"
+ 66 )
+ ; test_case "real line 110" `Quick
+ (test_highest_joltage
+ "2133111331232311212423441441423422333433421444124423221341431323413244441112422424242124214412256789"
+ 89 )
+ ; test_case "real line 111" `Quick
+ (test_highest_joltage
+ "4324434435333333333334332245243563333343356334334344235334322234145353323234352455374364553333643433"
+ 76 )
+ ; test_case "real line 112" `Quick
+ (test_highest_joltage
+ "3644734534756433422432434356624552253427466225337526564429422436344444454366324544253633541443353244"
+ 96 )
+ ; test_case "real line 113" `Quick
+ (test_highest_joltage
+ "2464324635364431443472344454334444343433464546454374434442423242443446444423526443551333243353834444"
+ 84 )
+ ; test_case "real line 114" `Quick
+ (test_highest_joltage
+ "5281642433245222222262522922521227221222224253247163523362225212277164151212258322522132327215231222"
+ 98 )
+ ; test_case "real line 115" `Quick
+ (test_highest_joltage
+ "4235325226444533343235413742346432342321545545344233233255443834433325423232343235231352342354622553"
+ 86 )
+ ; test_case "real line 116" `Quick
+ (test_highest_joltage
+ "8733361224233225222222426322442381855225483432261538256252524243235345825178218568965722348222331146"
+ 98 )
+ ; test_case "real line 117" `Quick
+ (test_highest_joltage
+ "3464344445243346232343434322224234534583235444432447445343449318343349436245884322482543363363441674"
+ 99 )
+ ; test_case "real line 118" `Quick
+ (test_highest_joltage
+ "7343334231474233525283342422364511453342252222452242451442434432112333432342315946241522245542222535"
+ 96 )
+ ; test_case "real line 119" `Quick
+ (test_highest_joltage
+ "4446143264553864474334554447535535453446566233244444636634565645448343225453554444454544364443454574"
+ 88 )
+ ; test_case "real line 120" `Quick
+ (test_highest_joltage
+ "2422842224224342322263252223333244522315113324152212372221342231322244231232122332222112227625141222"
+ 87 )
+ ; test_case "real line 121" `Quick
+ (test_highest_joltage
+ "4142122222422221222412122222212544522231222223211322362222321222222134432222122542122262223523223222"
+ 66 )
+ ; test_case "real line 122" `Quick
+ (test_highest_joltage
+ "4572333542142432343332342132323444433243433454242321332323354233213344233432132323534221333344323134"
+ 75 )
+ ; test_case "real line 123" `Quick
+ (test_highest_joltage
+ "1333235433322333324332333323332332233112331232333422333333333235333334322322333323333333323333423735"
+ 75 )
+ ; test_case "real line 124" `Quick
+ (test_highest_joltage
+ "5563657356454636674393696655654548835664676555834625756663576376694963475267652644487768866556366963"
+ 99 )
+ ; test_case "real line 125" `Quick
+ (test_highest_joltage
+ "4563325436233211733422223372423424234244425452243133154466242445642433343224441473324372257264523657"
+ 77 )
+ ; test_case "real line 126" `Quick
+ (test_highest_joltage
+ "2323232163222222141214222333122231122223522528112323222223222322213223223322333322221323333333322311"
+ 83 )
+ ; test_case "real line 127" `Quick
+ (test_highest_joltage
+ "2122222234242122427222222226222332211222112222222211222421121538222231222313221435322311232222212242"
+ 85 )
+ ; test_case "real line 128" `Quick
+ (test_highest_joltage
+ "5334253235515121222383422225322212542617232476242645322652351543223434635325223237112254433523422324"
+ 87 )
+ ; test_case "real line 129" `Quick
+ (test_highest_joltage
+ "1221223532146222222223126712218222123621122123217221212222322221232621162221122222222222122561122292"
+ 92 )
+ ; test_case "real line 130" `Quick
+ (test_highest_joltage
+ "1253352424255222142243514444444457255254363328422562213135526512123451523416645352425253125322532244"
+ 86 )
+ ; test_case "real line 131" `Quick
+ (test_highest_joltage
+ "7463373334646423355538441534433248593244576575237356213443653633273543376463332733333713232643554552"
+ 97 )
+ ; test_case "real line 132" `Quick
+ (test_highest_joltage
+ "5752323474332773249344434354245224321731245442414442735261654665534764636524293424214244444723343251"
+ 99 )
+ ; test_case "real line 133" `Quick
+ (test_highest_joltage
+ "2629438637852334643554943482775533446535956343762325623453474525365936398476244597355454656623443534"
+ 99 )
+ ; test_case "real line 134" `Quick
+ (test_highest_joltage
+ "4535534443563253332234233434455543533235333233223442233533235354443333733435443343553354434434423313"
+ 75 )
+ ; test_case "real line 135" `Quick
+ (test_highest_joltage
+ "3432223113423243423323513443123332315562232532523473232212343355364222323234236322343323225332327733"
+ 77 )
+ ; test_case "real line 136" `Quick
+ (test_highest_joltage
+ "1425245335243124322324153454554115125214321244121112544441331342553344311545421455324424455134156789"
+ 89 )
+ ; test_case "real line 137" `Quick
+ (test_highest_joltage
+ "5132222223252224223252622414436422231243232252214255323634524534432233273222325435334426442424422223"
+ 76 )
+ ; test_case "real line 138" `Quick
+ (test_highest_joltage
+ "3466444436255433325573352262554776625733275447321246237454234455234514752545552532447415643534223435"
+ 77 )
+ ; test_case "real line 139" `Quick
+ (test_highest_joltage
+ "3421133222332332322343231232212233662233221312321122224431322313262333313232332243223222233232344323"
+ 66 )
+ ; test_case "real line 140" `Quick
+ (test_highest_joltage
+ "3333523333232364333363555455431345243544566532455235335641243353444455452225735366346344243452243545"
+ 76 )
+ ; test_case "real line 141" `Quick
+ (test_highest_joltage
+ "2152354211122622723432615322212523224222225212363121124451232267516325421252122342152252424221452215"
+ 77 )
+ ; test_case "real line 142" `Quick
+ (test_highest_joltage
+ "1336123121333343222232333212232411534322333233223332323322234351332222331333333233332312233311232332"
+ 65 )
+ ; test_case "real line 143" `Quick
+ (test_highest_joltage
+ "2132121232233134232221223353223332232233322251223526132523323234323223335333222534212113232222523324"
+ 65 )
+ ; test_case "real line 144" `Quick
+ (test_highest_joltage
+ "5642633765534226222523623324323443222227261332774392232227443393254412356235358631224418312923222245"
+ 99 )
+ ; test_case "real line 145" `Quick
+ (test_highest_joltage
+ "8253442425732222332238822732425826242143236154326323242443342334348324234372622433223442523324133216"
+ 88 )
+ ; test_case "real line 146" `Quick
+ (test_highest_joltage
+ "2232271226257223212222421324222344224222141222322222222222222122224238422414316422323222222322127221"
+ 87 )
+ ; test_case "real line 147" `Quick
+ (test_highest_joltage
+ "6446315487414253623366432633565653444341454233666544632655534656536436114486263961512465435546514714"
+ 97 )
+ ; test_case "real line 148" `Quick
+ (test_highest_joltage
+ "3452383332535514435334232222355452522134243132532453384334525234222233545425333315332323214145535341"
+ 88 )
+ ; test_case "real line 149" `Quick
+ (test_highest_joltage
+ "3232222223322222122123232312331213231232227213222242313323222122223322222322313334222122231232221331"
+ 74 )
+ ; test_case "real line 150" `Quick
+ (test_highest_joltage
+ "3424332322222132232233231123121313223223263323323222342313211312222322221122422223222112232122222222"
+ 64 )
+ ; test_case "real line 151" `Quick
+ (test_highest_joltage
+ "4688454513726334654565476674454433554682654943685644463375763364523442437445697396743545599524274524"
+ 99 )
+ ; test_case "real line 152" `Quick
+ (test_highest_joltage
+ "4161223222271222942312171248122235227112222552223422326624121622234732522212222232212366825223253121"
+ 98 )
+ ; test_case "real line 153" `Quick
+ (test_highest_joltage
+ "6332465533333522555433324356221543352235533566333253334365565323363324552432332233335334227623136325"
+ 76 )
+ ; test_case "real line 154" `Quick
+ (test_highest_joltage
+ "3222431333842318323144411327346223122314332323123555122522333732335233333352312534852241433483632313"
+ 88 )
+ ; test_case "real line 155" `Quick
+ (test_highest_joltage
+ "2112121212253222222943424322422222512112212312422234143313232222122122222122123122132137327212242242"
+ 97 )
+ ; test_case "real line 156" `Quick
+ (test_highest_joltage
+ "3222532316332422221212223221522223111252221221322212217222213222221221211241222312222121222133222221"
+ 74 )
+ ; test_case "real line 157" `Quick
+ (test_highest_joltage
+ "2323332223344321223143245373113722211223122226227822325314633213361321445632321823462822337223222445"
+ 88 )
+ ; test_case "real line 158" `Quick
+ (test_highest_joltage
+ "1828425212144411422233221323218468423217466223581342222211242262211332238228121222224225122212222232"
+ 88 )
+ ; test_case "real line 159" `Quick
+ (test_highest_joltage
+ "3556334454665634545845243453255635572675157347763125427524341342644935377436635334453443684644784434"
+ 98 )
+ ; test_case "real line 160" `Quick
+ (test_highest_joltage
+ "2645662623422533225421215431512343431254242214262232525122522244211222145253265353435325571322222253"
+ 75 )
+ ; test_case "real line 161" `Quick
+ (test_highest_joltage
+ "2224222242122222222232211112222314222222222234412242326322512423222222232623322222122322112321211122"
+ 66 )
+ ; test_case "real line 162" `Quick
+ (test_highest_joltage
+ "3323122223222222333232562133233231243322232322321321232232332322335422322313322223123222222334233322"
+ 65 )
+ ; test_case "real line 163" `Quick
+ (test_highest_joltage
+ "3221132223233221322222223221222241223222221222212214223422121422222452222224223222122124212323123221"
+ 54 )
+ ; test_case "real line 164" `Quick
+ (test_highest_joltage
+ "2221442252281322222422127282212412222622221232731222223242124222212112212222241262321442522221122252"
+ 88 )
+ ; test_case "real line 165" `Quick
+ (test_highest_joltage
+ "2133231122331441531433375353572447432322146333423223632556232232334447444433622228242422332343332434"
+ 84 )
+ ; test_case "real line 166" `Quick
+ (test_highest_joltage
+ "5563624513351533334437333324353335333533533355223433335233342353363556423235334233344323342524634321"
+ 76 )
+ ; test_case "real line 167" `Quick
+ (test_highest_joltage
+ "2332432233323221431231323223332233383122222132424421134132233232323333433435254432332222332323313232"
+ 85 )
+ ; test_case "real line 168" `Quick
+ (test_highest_joltage
+ "2423222822122222222412282231122429224143222242222222223223436242424223242432142221433121142143522227"
+ 97 )
+ ; test_case "real line 169" `Quick
+ (test_highest_joltage
+ "1368838843358743334345324211363655364233733332443334321243322336412538532344213423253222366323263695"
+ 95 )
+ ; test_case "real line 170" `Quick
+ (test_highest_joltage
+ "4744137463363333333332326343314643324446233366376545372648324744635334435237267661327145553246452321"
+ 87 )
+ ; test_case "real line 171" `Quick
+ (test_highest_joltage
+ "3831332122233231223233222433232333233133133242242331362323323332235244434223336362233433352322334423"
+ 86 )
+ ; test_case "real line 172" `Quick
+ (test_highest_joltage
+ "3214422223143421344222143132231445423222522643233323314323424344434731323334224323324533352334332442"
+ 75 )
+ ; test_case "real line 173" `Quick
+ (test_highest_joltage
+ "3543312373344332233323452214433346347334844253532442224222234312433329254329453434283232534223272192"
+ 99 )
+ ; test_case "real line 174" `Quick
+ (test_highest_joltage
+ "3433383314338373834351844233646343475553142224453454325446354334653275541333543135354465333263445242"
+ 88 )
+ ; test_case "real line 175" `Quick
+ (test_highest_joltage
+ "4432372233684255322525272434647435924424322624541334413224443634326336461361436414475721222543446321"
+ 97 )
+ ; test_case "real line 176" `Quick
+ (test_highest_joltage
+ "5433335293334525543224371764333434988333237353113448943411932743514583594643353323325387583814645347"
+ 99 )
+ ; test_case "real line 177" `Quick
+ (test_highest_joltage
+ "5444424957443468654656364755567468455486545344445776761776566466566644555557658947447467449455766646"
+ 99 )
+ ; test_case "real line 178" `Quick
+ (test_highest_joltage
+ "2523333233343235435222235534333238434254233255342853335554453253236223223533323533522334332433432543"
+ 88 )
+ ; test_case "real line 179" `Quick
+ (test_highest_joltage
+ "1138614552342221321221222413621222223231223222323222814623241222446214226442469244351324343452225242"
+ 95 )
+ ; test_case "real line 180" `Quick
+ (test_highest_joltage
+ "3235222332131222222123223222332312322323172132141232121324222213353223224233213123222221223322233343"
+ 75 )
+ ; test_case "real line 181" `Quick
+ (test_highest_joltage
+ "4255452362323165242342332223332343343253334456143314452223324924424332355355353341343334425553353324"
+ 95 )
+ ; test_case "real line 182" `Quick
+ (test_highest_joltage
+ "3544633234326333143434434638432333354444353822424442333225332444532646543132326565233146643454534545"
+ 88 )
+ ; test_case "real line 183" `Quick
+ (test_highest_joltage
+ "5533866835333332446339845544234435374366623344443448343635433373544333343634473633534344325836364423"
+ 98 )
+ ; test_case "real line 184" `Quick
+ (test_highest_joltage
+ "2125222512312522233222222532263455412421222232122112222113222512244225244211543622122111124332312445"
+ 66 )
+ ; test_case "real line 185" `Quick
+ (test_highest_joltage
+ "5765537453753546524944644454354364643373535664333265356565454434334362334636443764473516535345363344"
+ 97 )
+ ; test_case "real line 186" `Quick
+ (test_highest_joltage
+ "1242333313323541312121335173323322252262322222223242223232232232334313232372223332333223325322223324"
+ 77 )
+ ; test_case "real line 187" `Quick
+ (test_highest_joltage
+ "4945346555344725534444354865365546455455453445376994344537749854443434373543557699323594547559554353"
+ 99 )
+ ; test_case "real line 188" `Quick
+ (test_highest_joltage
+ "8441321232536757468212413223835223356252342241323333442736423243742453922327334232628243572272153736"
+ 98 )
+ ; test_case "real line 189" `Quick
+ (test_highest_joltage
+ "3233227533534655473331231323541242222614244236242111121212233442265222232434532624232622312564515622"
+ 77 )
+ ; test_case "real line 190" `Quick
+ (test_highest_joltage
+ "5231443534475571334243142383154324332422432224554332949237335344432225546623266434742645424452245374"
+ 99 )
+ ; test_case "real line 191" `Quick
+ (test_highest_joltage
+ "2222652752542951212254142576134913223231244514325577152312242364152242322223322323734226324612251433"
+ 99 )
+ ; test_case "real line 192" `Quick
+ (test_highest_joltage
+ "3344232272222124265242432232223224453423221222354325223634222122333255463333115233242332132134223228"
+ 78 )
+ ; test_case "real line 193" `Quick
+ (test_highest_joltage
+ "2423211646221222214223621414422342222242214622426224222474221222222215322142322234542433223122532751"
+ 77 )
+ ; test_case "real line 194" `Quick
+ (test_highest_joltage
+ "1222432222227322222223122113222321223327322223241223322232332322222222222222123323434222222223412222"
+ 77 )
+ ; test_case "real line 195" `Quick
+ (test_highest_joltage
+ "2231222262245222221524294251251222212942222142532633726213522122212422222232121922212212262322231242"
+ 99 )
+ ; test_case "real line 196" `Quick
+ (test_highest_joltage
+ "3436674387463373644336847545353373813336332865333426743634647353343363237627393333883956336933349336"
+ 99 )
+ ; test_case "real line 197" `Quick
+ (test_highest_joltage
+ "4234664334533643445662346466345666647426655444553533366634453846446264346586345365444765364634443146"
+ 88 )
+ ; test_case "real line 198" `Quick
+ (test_highest_joltage
+ "4141324433423632324233334423343324244241332653544345362343464242132445242521322431444734316223541332"
+ 76 )
+ ; test_case "real line 199" `Quick
+ (test_highest_joltage
+ "3535726262552245152262222275133232659846242165522221422176222262567254622235412424626225322313236476"
+ 98 )
+ ; test_case "real line 200" `Quick
+ (test_highest_joltage
+ "2222222333136722224325232232111133222432346324431421212343222142244331223225124653223222322121232213"
+ 76 ) ] )
+ ; ( "BatteryBank.highest_joltage regression"
+ , [ test_case
+ "second digit promoted when same digit found and greater than \
+ first digit"
+ `Quick
+ (test_highest_joltage "343400" 44)
+ ; test_case "second last digit skipped" `Quick
+ (test_highest_joltage "789" 89)
+ ; test_case "I have no idea why this is wrong yet" `Quick
+ (test_highest_joltage "565" 65)
+ ; test_case "I have no idea why this is right yet" `Quick
+ (test_highest_joltage "566" 66)
+ ; test_case "I have no idea why this is right yet" `Quick
+ (test_highest_joltage "06760" 76)
+ ; test_case "I have no idea why this is wrong yet" `Quick
+ (test_highest_joltage "0067600" 76) ] ) ]