package adventofcode

import "testing"

var smallInput5 = []string{
	"seeds: 79 14 55 13",
	"",
	"seed-to-soil map:",
	"50 98 2",
	"52 50 48",
	"",
	"soil-to-fertilizer map:",
	"0 15 37",
	"37 52 2",
	"39 0 15",
	"",
	"fertilizer-to-water map:",
	"49 53 8",
	"0 11 42",
	"42 0 7",
	"57 7 4",
	"",
	"water-to-light map:",
	"88 18 7",
	"18 25 70",
	"",
	"light-to-temperature map:",
	"45 77 23",
	"81 45 19",
	"68 64 13",
	"",
	"temperature-to-humidity map:",
	"0 69 1",
	"1 0 69",
	"",
	"humidity-to-location map:",
	"60 56 37",
	"56 93 4",
}

var input5 = []string{
	"seeds: 3416930225 56865175 4245248379 7142355 1808166864 294882110 863761171 233338109 4114335326 67911591 1198254212 504239157 3491380151 178996923 3965970270 15230597 2461206486 133606394 2313929258 84595688",
	"",
	"seed-to-soil map:",
	"3534435790 4123267198 50004089",
	"3584439879 3602712894 238659237",
	"2263758314 0 160870825",
	"2971481857 2850687195 31776688",
	"4173604159 3353763588 121363137",
	"3823099116 3003258545 350505043",
	"2850687195 2882463883 120794662",
	"1503174517 2076905328 347723811",
	"1850898328 195477286 412859986",
	"1265521310 1606247567 17062682",
	"3285153612 4173271287 121696009",
	"488201540 828927797 777319770",
	"453595079 160870825 34606461",
	"3406849621 3475126725 127586169",
	"1282583992 608337272 220590525",
	"3003258545 3841372131 281895067",
	"0 1623310249 453595079",
	"",
	"soil-to-fertilizer map:",
	"131427930 1185330183 180485664",
	"748806267 2475960003 160820884",
	"311913594 3858074623 436892673",
	"3738185633 2255483282 220476721",
	"909627151 2636780887 1221293736",
	"2848518198 1365815847 889667435",
	"2130920887 131427930 666553095",
	"2797473982 1134285967 51044216",
	"3958662354 797981025 336304942",
	"",
	"fertilizer-to-water map:",
	"318410581 1095359367 168721315",
	"1850530626 4267113166 11515024",
	"1868157768 2129267011 114327162",
	"3662276437 4191001581 22313216",
	"2980811924 3765310336 180818294",
	"3971289879 3991326516 15449292",
	"4217905563 2279561459 35118050",
	"2287003279 4213314797 47187938",
	"1837473204 2314679509 13057422",
	"1998824036 3946128630 45197886",
	"222462505 1264080682 95948076",
	"487131896 791770420 303588947",
	"4253023613 4068573955 41943683",
	"2334191217 3252696905 278223677",
	"3986739171 2786104784 83568826",
	"3495640623 3600917310 61383314",
	"3557023937 3662300624 15042395",
	"2222048360 3535962391 64954919",
	"2919013777 4006775808 61798147",
	"3660033649 4182646675 2242788",
	"3266573705 2327736931 229066918",
	"3684589653 2869673610 235425729",
	"3261531896 3530920582 5041809",
	"790720843 417781090 105163807",
	"895884650 0 159434487",
	"2044021922 2608078346 178026438",
	"1862045650 4184889463 6112118",
	"3572066332 3677343019 87967317",
	"1830862773 4260502735 6610431",
	"1338009275 159434487 258346603",
	"3233759255 1830862773 27772641",
	"1055319137 1360028758 282690138",
	"1982484930 4278628190 16339106",
	"2883046491 2243594173 35967286",
	"2612414894 1858635414 270631597",
	"4070307997 3105099339 147597566",
	"3161630218 4110517638 72129037",
	"1596355878 522944897 46363018",
	"0 569307915 222462505",
	"3920015382 2556803849 51274497",
	"",
	"water-to-light map:",
	"3185219492 1324735395 185266775",
	"3146586681 1249776213 38632811",
	"28244350 428471809 312696716",
	"340941066 3650819202 117391304",
	"458332370 963661621 286114592",
	"2785969088 3483794777 117695215",
	"1279106820 1583617352 194624401",
	"1473731221 3601489992 49329210",
	"0 2796264154 28244350",
	"744446962 3356330358 127464419",
	"2562107674 223281414 205190395",
	"3544929092 0 223281414",
	"2767298069 944990602 18671019",
	"2903664303 775683406 169307196",
	"3072971499 1510002170 73615182",
	"1140236238 741168525 34514881",
	"1242780449 1288409024 36326371",
	"1523060431 1778241753 949993071",
	"871911381 3088005501 268324857",
	"3370486267 2913562676 174442825",
	"4096117687 4180659844 114307452",
	"1174751119 2728234824 68029330",
	"4210425139 4096117687 84542157",
	"2473053502 2824508504 89054172",
	"",
	"light-to-temperature map:",
	"57304962 1726059676 351776583",
	"1567802332 965133212 510033927",
	"3296678005 3095070487 435408435",
	"2476702913 3609026358 293401880",
	"1363411758 0 204390574",
	"1017340727 204390574 346071031",
	"2770104793 2148583721 409359530",
	"994650876 1475167139 22689851",
	"0 550461605 20445762",
	"20445762 1692752937 33306739",
	"2144982382 2092188566 56395155",
	"799754929 1497856990 194895947",
	"53752501 961580751 3552461",
	"409081545 570907367 390673384",
	"2201377537 3902428238 275325376",
	"3988154754 2557943251 306812542",
	"3179464323 4177753614 117213682",
	"3732086440 3530478922 78547436",
	"3810633876 2864755793 177520878",
	"2092188566 3042276671 52793816",
	"",
	"temperature-to-humidity map:",
	"18928354 3414191527 36074961",
	"3774151818 3588716061 144651966",
	"2046448856 1384376044 7569690",
	"2737178317 903028814 27883660",
	"2981004508 930912474 349046239",
	"1609626976 3084565214 120015958",
	"2765061977 2248931514 215942531",
	"157942811 3887783726 359543023",
	"3330050747 2195105292 25002873",
	"2041971091 78356652 4477765",
	"1938796124 861459710 41569104",
	"1608860129 2474627144 766847",
	"1812604664 3795542966 74143188",
	"4196563819 3386335999 27024746",
	"1980365228 3204581172 61605863",
	"1136292153 82834417 94266783",
	"4015908448 1279958713 104417331",
	"2701246339 2062523244 35931978",
	"4223588565 3286123619 23738184",
	"91521115 3309861803 56668597",
	"1886747852 2552562071 52048272",
	"1729642934 0 61644451",
	"1791287385 1504576228 21317279",
	"517485834 1726582276 261020280",
	"2192468119 2604610343 479954871",
	"1413642666 1391945734 112630494",
	"71715516 3366530400 19805599",
	"3918803784 2475393991 77168080",
	"1546685190 3733368027 62174939",
	"2672422990 2220108165 28823349",
	"148189712 2464874045 9753099",
	"18097572 3413360745 830782",
	"0 3869686154 18097572",
	"3995971864 3266187035 19936584",
	"853426802 432206724 27759827",
	"2054018546 3450266488 138449573",
	"881186629 177101200 255105524",
	"778506114 1987602556 74920688",
	"1526273160 2098455222 20412030",
	"55003315 61644451 16712201",
	"3355053620 459966551 401493159",
	"4120325779 2118867252 76238040",
	"1230558936 1525893507 183083730",
	"3756546779 1708977237 17605039",
	"",
	"humidity-to-location map:",
	"166973311 827072705 21017988",
	"2420657564 1797988486 98294592",
	"3711057743 1724407580 50543704",
	"151140540 331672683 15832771",
	"2611368935 1098267426 35837870",
	"329110209 0 39413233",
	"848395356 3293184115 2008343",
	"850403699 1508109908 216297672",
	"3203490893 3278069000 15115115",
	"1322210923 4179894531 115072765",
	"3761601447 848395356 249872070",
	"230668724 39413233 27530262",
	"1437283688 2240143464 113813014",
	"1551096702 2957294790 77256502",
	"716039283 695021295 132051410",
	"258198986 109620920 70911223",
	"1314022212 2357817442 8188711",
	"2793895840 2474472017 281155944",
	"385486933 347505454 330552350",
	"3218606008 3561131747 206517169",
	"1066701371 3354107909 156810008",
	"4011473517 1134105296 283493779",
	"0 180532143 151140540",
	"368523442 678057804 16963491",
	"1223511379 1417599075 90510833",
	"3183517648 1988699857 19973245",
	"2270463718 4038012896 141881635",
	"1817187310 1774951284 23037202",
	"1963899457 2755627961 201666829",
	"2412345353 3295192458 8312211",
	"1840224512 3767648916 123674945",
	"187991299 66943495 42677425",
	"2518952156 1896283078 92416779",
	"1628353204 3034551292 138620276",
	"3075051784 2366006153 108465864",
	"3660454503 3303504669 50603240",
	"3425123177 2008673102 231470362",
	"3656593539 2353956478 3860964",
	"1766973480 3510917917 50213830",
	"2647206805 3891323861 146689035",
	"2165566286 3173171568 104897432",
}

func TestDay5Part1(t *testing.T) {
	expectedRes := 806029445
	if res := day5Part1(input5); res != expectedRes {
		t.Errorf("expected res is %v,what we get is %v", expectedRes, res)
	}
}

func TestDay5Part2(t *testing.T) {
	// having tried my best but still timeout
	// maybe there is a better solution or maybe I should use goroutine
	// to run in parallel
}
