commit 848459091b4360903c91fb0c3909eed6dfa00835
Author: Lukas Henkel <lh@entf.net>
Date: Thu, 1 Dec 2022 08:36:19 +0100
Day 1
Diffstat:
7 files changed, 2395 insertions(+), 0 deletions(-)
diff --git a/.gitignore b/.gitignore
@@ -0,0 +1 @@
+#*
+\ No newline at end of file
diff --git a/adventofcode2022.asd b/adventofcode2022.asd
@@ -0,0 +1,20 @@
+(defsystem "adventofcode2022"
+ :description "My solutions to the advent of code 2022"
+ :version "0.0.1"
+ :author "Lukas Henkel <lh@entf.net>"
+ :licence "AGPLv3"
+ :serial t
+ :pathname "src"
+ :components ((:file "main")
+ (:file "day01")))
+
+(defsystem "adventofcode2022/test"
+ :description "My solutions to the advent of code 2022"
+ :version "0.0.1"
+ :author "Lukas Henkel <lh@entf.net>"
+ :licence "AGPLv3"
+ :serial t
+ :pathname "t"
+ :depends-on ("adventofcode2022" "fiveam")
+ :components ((:file "package")
+ (:file "day01")))
diff --git a/input/day01.txt b/input/day01.txt
@@ -0,0 +1,2250 @@
+7769
+6798
+11685
+10826
+11807
+5786
+7932
+
+54883
+
+7069
+5792
+1519
+7380
+7034
+6203
+5706
+1850
+4933
+5562
+3826
+6661
+
+9150
+6417
+5057
+3568
+9352
+7134
+6040
+2451
+2295
+
+10996
+11802
+5525
+5705
+8266
+3742
+
+5140
+5527
+5686
+2488
+2518
+6260
+1692
+3149
+9109
+
+22590
+17677
+25444
+
+4146
+2282
+1957
+3673
+4830
+3220
+3823
+4619
+3222
+4076
+4594
+4550
+4806
+
+1426
+2726
+3566
+4089
+2195
+1512
+2547
+2284
+5687
+7429
+1043
+
+7877
+7446
+9753
+3184
+5417
+2306
+1680
+7121
+
+21326
+26045
+
+22638
+7066
+10062
+
+8585
+9072
+3466
+
+7022
+2085
+4942
+4034
+4285
+2498
+9268
+1444
+3302
+
+13269
+9710
+10391
+10915
+2195
+8559
+
+3035
+9421
+4497
+1802
+8447
+5675
+7580
+9053
+8004
+
+2777
+5293
+1866
+5019
+8129
+4632
+1530
+3438
+5812
+5460
+
+2982
+4005
+4036
+6510
+4817
+3958
+5057
+2049
+2603
+1227
+5960
+4043
+5261
+4780
+
+5642
+8518
+13634
+7727
+10729
+2587
+
+15874
+11122
+15896
+4477
+
+7772
+10595
+6827
+4469
+10385
+3420
+7657
+8950
+
+2062
+30422
+
+2007
+
+5148
+3451
+2735
+12950
+6576
+10785
+
+5578
+5978
+5716
+4026
+1429
+7684
+6552
+7630
+5834
+4936
+7936
+
+4417
+7072
+7646
+4604
+6426
+3020
+1286
+7360
+
+20192
+6831
+10425
+
+3685
+8863
+1300
+11973
+11525
+11077
+7184
+
+5352
+2370
+3014
+1386
+1486
+1718
+1898
+6896
+4930
+1628
+2798
+1681
+5751
+
+2150
+2901
+3490
+4291
+8998
+5673
+3623
+3894
+7435
+
+2235
+3164
+1231
+3675
+4188
+4865
+1611
+4652
+6333
+3262
+3124
+6215
+2704
+3183
+
+5215
+3259
+3550
+4965
+4096
+2036
+4517
+2554
+3266
+5571
+5266
+1466
+5259
+5882
+2782
+
+4755
+3402
+4269
+8242
+
+1365
+4100
+3131
+3596
+4719
+4250
+4580
+5418
+1687
+6533
+5938
+5865
+4605
+
+9739
+11547
+11940
+10268
+11939
+10825
+5522
+
+11534
+3303
+8778
+4682
+7643
+
+8045
+8298
+5813
+7881
+8605
+4114
+4524
+3837
+7631
+6763
+
+3781
+4709
+2733
+4606
+4291
+1785
+5297
+5929
+1424
+5951
+6175
+5367
+2370
+
+5882
+2097
+3154
+4166
+1556
+3414
+3977
+4348
+5069
+4092
+3614
+5803
+3460
+5374
+
+2814
+5388
+1641
+1526
+4489
+2291
+2573
+5389
+3109
+3422
+5342
+1461
+3105
+4265
+
+4726
+4817
+4047
+3690
+1101
+4853
+5962
+2049
+4059
+2172
+4509
+3395
+4854
+3838
+1019
+
+7358
+6318
+16327
+9518
+4995
+
+6426
+9428
+1077
+4142
+1989
+4019
+6187
+
+3162
+4035
+1359
+4364
+2392
+3819
+5132
+4721
+4794
+1622
+4693
+5318
+6089
+1588
+3199
+
+1273
+2231
+3534
+4970
+1685
+2565
+1847
+5926
+5778
+4919
+4238
+1422
+3945
+1252
+4234
+
+9120
+13317
+3969
+4758
+13615
+7951
+
+66512
+
+1501
+6913
+4990
+5948
+2597
+5644
+2876
+3515
+4264
+3768
+4731
+3944
+
+10132
+19382
+
+6047
+5939
+2528
+7985
+1897
+3393
+5548
+4948
+6010
+5878
+3060
+
+9054
+9776
+4515
+5124
+7522
+8530
+2383
+
+5847
+2878
+4148
+1173
+2170
+2647
+2068
+5523
+4020
+1211
+6391
+3562
+5005
+1904
+
+6823
+7455
+4026
+4248
+3707
+1157
+5135
+5637
+2967
+5746
+3987
+
+7376
+6875
+7041
+7713
+12827
+13582
+
+17060
+11310
+19892
+
+8053
+12649
+1222
+12407
+12724
+
+39856
+
+7534
+2592
+1012
+4760
+2118
+8180
+1054
+3230
+7718
+
+6017
+3402
+3896
+5801
+4055
+5034
+1063
+3694
+6663
+6079
+4364
+5712
+3366
+
+4197
+7022
+5256
+1425
+7656
+6799
+7117
+5580
+6349
+4039
+
+20138
+1054
+
+2340
+9011
+8717
+1458
+11325
+4563
+8634
+
+5553
+4344
+2022
+1712
+4142
+2372
+2444
+3286
+1456
+4778
+4125
+3745
+2776
+4688
+5256
+
+15243
+10322
+6333
+11283
+
+3932
+1767
+8008
+1064
+6096
+1695
+3423
+4814
+
+2592
+4604
+2710
+2273
+4703
+1705
+5528
+5053
+5556
+1562
+5820
+5347
+2978
+2734
+5782
+
+1890
+7379
+18132
+18576
+
+6752
+8949
+11389
+7170
+2131
+3725
+7053
+
+5545
+11110
+13900
+5552
+11452
+2249
+
+9323
+7633
+11404
+5092
+1683
+2705
+10840
+
+20742
+14722
+
+9990
+12357
+17458
+17411
+
+1698
+9149
+7872
+2331
+7464
+5228
+5603
+2551
+6590
+
+4927
+5047
+12168
+15288
+14202
+
+13034
+4809
+3511
+10173
+2745
+
+69228
+
+1810
+14168
+
+3939
+15152
+23394
+
+5366
+3942
+4203
+4337
+4559
+6474
+4586
+5663
+3658
+5700
+6654
+6103
+1057
+
+9680
+8092
+
+4204
+7952
+6443
+5174
+3142
+5908
+10695
+5827
+
+66023
+
+8071
+2036
+16786
+15029
+
+18357
+10466
+13614
+19749
+
+3429
+7627
+5875
+2678
+3260
+1265
+8377
+7841
+
+4403
+16663
+22998
+
+5571
+5978
+2363
+1170
+3368
+4273
+1975
+3272
+3885
+3288
+3287
+5319
+5073
+1543
+3815
+
+12653
+13250
+6247
+2301
+
+2817
+26802
+
+8427
+7538
+7405
+6634
+2889
+1705
+7171
+6067
+3737
+
+5708
+1287
+1923
+6351
+5986
+3291
+1295
+6439
+3591
+2498
+5135
+2927
+5476
+6504
+
+9888
+8000
+4035
+1566
+3005
+6312
+7637
+6485
+
+8797
+9447
+7955
+5218
+1487
+11930
+9613
+
+6618
+3290
+1626
+2828
+1212
+4021
+5720
+4838
+4069
+2792
+3864
+6113
+1059
+
+13347
+14049
+9926
+2695
+7591
+
+19734
+12813
+14941
+5044
+
+11219
+14430
+6907
+1295
+10293
+
+5012
+4809
+3807
+5257
+2325
+5551
+1899
+4972
+3409
+5340
+4525
+3395
+2881
+
+12541
+15894
+16431
+12428
+
+2641
+4872
+1533
+2437
+5982
+4387
+3221
+7000
+4438
+2051
+1046
+1708
+
+8702
+10811
+13926
+12768
+2506
+
+6568
+4598
+2225
+4648
+3543
+2542
+1099
+7314
+
+1692
+6923
+4315
+8777
+14624
+
+10646
+17681
+3207
+19894
+
+7926
+11094
+17423
+15371
+
+5048
+8089
+11169
+5040
+6221
+5191
+
+8682
+6191
+11354
+13461
+10597
+2513
+
+2189
+5321
+4750
+1844
+4592
+2686
+4028
+6125
+1162
+3405
+4721
+5505
+2934
+1095
+
+2068
+10452
+5876
+3227
+1290
+4654
+6635
+
+1936
+2110
+5374
+4185
+1198
+4599
+1146
+1929
+3807
+4076
+4765
+3831
+5478
+5989
+
+23444
+14453
+8534
+
+1019
+4669
+1444
+6127
+4243
+3660
+1274
+5428
+5662
+4909
+2672
+1241
+
+7346
+7316
+4450
+4987
+3131
+4318
+7189
+3525
+1041
+2680
+
+10645
+2358
+2163
+4477
+9860
+1345
+3691
+2085
+
+7383
+6160
+2327
+3158
+2693
+7236
+4629
+2416
+7986
+3383
+1136
+
+1190
+4026
+8538
+6659
+2981
+5995
+9724
+6940
+
+10340
+3805
+4627
+
+14249
+5887
+12930
+2407
+14495
+
+7516
+9033
+2525
+7708
+6145
+10001
+2655
+3141
+
+7379
+
+6608
+16917
+1035
+10703
+
+33797
+34907
+
+6797
+6996
+6591
+6379
+6973
+2831
+1277
+7051
+3832
+2433
+
+7531
+14776
+6826
+17630
+
+7386
+9544
+7237
+
+6602
+6957
+3141
+3585
+6978
+6463
+6948
+1051
+1433
+5963
+3190
+3433
+
+10667
+1972
+
+8003
+3968
+1911
+2211
+1255
+4850
+6125
+6806
+1283
+6968
+6659
+
+4095
+4468
+1307
+3095
+6596
+6039
+4003
+6669
+3820
+1938
+4527
+6348
+
+3603
+6057
+16940
+
+1702
+7175
+3506
+1917
+1901
+7955
+9292
+4531
+6309
+
+10460
+3439
+10344
+4353
+14564
+
+4848
+2725
+1146
+5588
+1671
+4461
+1109
+2933
+1639
+4587
+6680
+1035
+3288
+
+10223
+9558
+8984
+6259
+8858
+4175
+4696
+4865
+
+9629
+1673
+3138
+7637
+5938
+2470
+8013
+4296
+
+7350
+3432
+7036
+8337
+1497
+7476
+2665
+3929
+
+4781
+6914
+12163
+9402
+7776
+
+4099
+4560
+5915
+1973
+5439
+1400
+6595
+5966
+1196
+4074
+1936
+5854
+5206
+
+8515
+2858
+5997
+6508
+2452
+4353
+2981
+1926
+2914
+1393
+
+5453
+2358
+1559
+5635
+3544
+5985
+3780
+1973
+2762
+4714
+4959
+6217
+
+1189
+5940
+5972
+3127
+5704
+1270
+4245
+5290
+2370
+1828
+4501
+3431
+1382
+2932
+
+6204
+9810
+4609
+3992
+11958
+2599
+
+1879
+1009
+9081
+8621
+8883
+5696
+11034
+
+7627
+3776
+7000
+10332
+4325
+3876
+2789
+8333
+
+7701
+1778
+4980
+4505
+5648
+
+1799
+3098
+4398
+3948
+4257
+4112
+1364
+3813
+5036
+3469
+4468
+2531
+1348
+
+4378
+2265
+5366
+1511
+2074
+1163
+1459
+5241
+2568
+1730
+5780
+5065
+3062
+1122
+1117
+
+3812
+5343
+4364
+6951
+2722
+3256
+7022
+3296
+3913
+5731
+5034
+3887
+
+13509
+11975
+12287
+10636
+12399
+7668
+
+19677
+1190
+1202
+
+10816
+4836
+5309
+14165
+14288
+
+5490
+4786
+4274
+5379
+4549
+4178
+2801
+1439
+5323
+4588
+5163
+1764
+4159
+5876
+5784
+
+16630
+10090
+19629
+4208
+
+4828
+6769
+8968
+7615
+5761
+3303
+8317
+4078
+1484
+
+6249
+6524
+1303
+12159
+8931
+8535
+
+3704
+2998
+1785
+1520
+4399
+4624
+4708
+3660
+4117
+2092
+4172
+3349
+3104
+1789
+2007
+
+11372
+15360
+14226
+7483
+16378
+
+4261
+2686
+1891
+5516
+5035
+1525
+5360
+4027
+3811
+6325
+5813
+4172
+6415
+
+24072
+19037
+25145
+
+2885
+6595
+4536
+2928
+3890
+8081
+6309
+4441
+6922
+4877
+
+16459
+9019
+4823
+4890
+
+1962
+5355
+7809
+9413
+6811
+8709
+5073
+4847
+4097
+
+2745
+7978
+6573
+5295
+8034
+3894
+1410
+2764
+4644
+7553
+6257
+
+25171
+8046
+4857
+
+6783
+4054
+3275
+2976
+4343
+2370
+1621
+7456
+6762
+3160
+1156
+
+2686
+2728
+2184
+4152
+6487
+3462
+2738
+2908
+5387
+1577
+6751
+6695
+5232
+
+6177
+7217
+2564
+2443
+4514
+8294
+5415
+2623
+9681
+
+4950
+1038
+10383
+5835
+1327
+1302
+9590
+
+17215
+9922
+6402
+19625
+
+4168
+1146
+5827
+3497
+5063
+5336
+3091
+1710
+2455
+4036
+2016
+1400
+1839
+1280
+1802
+
+14115
+1542
+17633
+
+3405
+3819
+1079
+2957
+2594
+3639
+1941
+3709
+
+5027
+7097
+2180
+5866
+6339
+10088
+10331
+10009
+
+8795
+11892
+1803
+10020
+7485
+2252
+
+6020
+6734
+2366
+4256
+11042
+7705
+1154
+
+4649
+7673
+4275
+3178
+5322
+4959
+5990
+1480
+5206
+3693
+
+1033
+34996
+
+8495
+4414
+7618
+7494
+4141
+10026
+7653
+6703
+
+7338
+2459
+3138
+1169
+6969
+2912
+5215
+5295
+
+6828
+2861
+8421
+1358
+6303
+3986
+1616
+2345
+8176
+2108
+
+4784
+1321
+5487
+6182
+5706
+5460
+5418
+2886
+5906
+6230
+1211
+1325
+3766
+3473
+
+32044
+9585
+
+4129
+3880
+2446
+7678
+7171
+6122
+4815
+6490
+7811
+
+4998
+5114
+4812
+7291
+1189
+1140
+7418
+6180
+3614
+6185
+7174
+4112
+
+2120
+8291
+8297
+5972
+5091
+3300
+2250
+8252
+1798
+5973
+
+4580
+4253
+2599
+1260
+1319
+2410
+3880
+1891
+5663
+6015
+2826
+1685
+6015
+2218
+2074
+
+5484
+3947
+5030
+6716
+4840
+1353
+3667
+6815
+4884
+5050
+5678
+2224
+3010
+
+3357
+2304
+3432
+5239
+2342
+5433
+1529
+5368
+1377
+1955
+5154
+2021
+2777
+4191
+2437
+
+5674
+1979
+7064
+2839
+6346
+2751
+1055
+3565
+6608
+2640
+2418
+
+5639
+10983
+17671
+17911
+
+15626
+2960
+6655
+10375
+5736
+
+7035
+5732
+7114
+1535
+2199
+11194
+9774
+
+5832
+
+10467
+12415
+4879
+1429
+
+6075
+4309
+6002
+6426
+3744
+3310
+4451
+3076
+1509
+1748
+1692
+4507
+5036
+4895
+
+11696
+4115
+8159
+10845
+2786
+10615
+
+48621
+
+1192
+3957
+4091
+2855
+2872
+3079
+6075
+2858
+5498
+1143
+3565
+5869
+5297
+1698
+
+7795
+1985
+7103
+1419
+1310
+11662
+10826
+
+5503
+1258
+3528
+1705
+5995
+1163
+7702
+5395
+7432
+
+14868
+4477
+6259
+13077
+8291
+
+8320
+16041
+11934
+10727
+11090
+
+12551
+13807
+10502
+
+9432
+11708
+8636
+10825
+5787
+12812
+
+35147
+3076
+
+25130
+12321
+
+8915
+1256
+5757
+4542
+7654
+6386
+6577
+5309
+7586
+
+8039
+4206
+1881
+7297
+5462
+1961
+2831
+3112
+6699
+2228
+7562
+
+1922
+2168
+2585
+6069
+3197
+5424
+4482
+1832
+5677
+2958
+5352
+5895
+3866
+3543
+
+5634
+4583
+6213
+4733
+4093
+4552
+1115
+1413
+3362
+1079
+5891
+5299
+3532
+6085
+
+3765
+1926
+7096
+9431
+8271
+5419
+4734
+5307
+
+25704
+
+2025
+4435
+1940
+4431
+3579
+6629
+5778
+3161
+6755
+3089
+5531
+4578
+1898
+
+21458
+13856
+14167
+
+10658
+5673
+5497
+8117
+4249
+5299
+4091
+
+9437
+8079
+2943
+1661
+1856
+9904
+4602
+6529
+
+2512
+2786
+3226
+10440
+3819
+10685
+8838
+9662
+
+8602
+4695
+3934
+2730
+1767
+9104
+7493
+1063
+1794
+
+7080
+4569
+6256
+4728
+1399
+1907
+4763
+1715
+3886
+1251
+3224
+
+3959
+1907
+5456
+2086
+3711
+5971
+3294
+1861
+2780
+1913
+4832
+5076
+1830
+
+5804
+2484
+3124
+3675
+2231
+7385
+6162
+7721
+8320
+6636
+
+2776
+1481
+3775
+5827
+7069
+6834
+2274
+5570
+4355
+5544
+3954
+7455
+
+5864
+2635
+2103
+5153
+7465
+3629
+9144
+1026
+1281
+
+2245
+4411
+7641
+3676
+4231
+7080
+6825
+1638
+1669
+5421
+
+24591
+21630
+25260
+
+11157
+5983
+7801
+8726
+1466
+4673
+4161
+
+29272
+3399
+
+14240
+15303
+21022
+
+4601
+1980
+4747
+1424
+4354
+4854
+5111
+4812
+2612
+3479
+2243
+1010
+3081
+2162
+
+2499
+2823
+2552
+3999
+5433
+4645
+1491
+4132
+3319
+2680
+2814
+3418
+1762
+6143
+
+4333
+1177
+6107
+6535
+4587
+5845
+4595
+1898
+4140
+3508
+5708
+6816
+
+7619
+7616
+7029
+10521
+6949
+4053
+1093
+1831
+
+2343
+6227
+1128
+2486
+6296
+1852
+1198
+1012
+5792
+3116
+1241
+2703
+6783
+
+2330
+4075
+3239
+6472
+4512
+2701
+2322
+1281
+4283
+3289
+3978
+1141
+6478
+3138
+
+9950
+14105
+8952
+12549
+7905
+
+3088
+5831
+5452
+2038
+1116
+3670
+3025
+3749
+5040
+2507
+3787
+1674
+4437
+2630
+5239
+
+4742
+8167
+8733
+2304
+1227
+7007
+5281
+3939
+4327
+
+2821
+7212
+7353
+5102
+3808
+7328
+2741
+1436
+6321
+6249
+6961
+
+8502
+6346
+6807
+5110
+4949
+2355
+9254
+
+1071
+25798
+5915
+
+9040
+9174
+11739
+14248
+8788
+
+10873
+14148
+3787
+11629
+2610
+
+2689
+4455
+3461
+5468
+1308
+1111
+4181
+3832
+1172
+2809
+3782
+2943
+1926
+1470
+5324
+
+2093
+7919
+1178
+7995
+4279
+1018
+1011
+1690
+2987
+5071
+
+8113
+2934
+
+5764
+2369
+4718
+2864
+6292
+5603
+3142
+8156
+1571
+2106
+
+3583
+1792
+5592
+5648
+5637
+3586
+1685
+1042
+4020
+6204
+4111
+4887
+6858
+
+9068
+
+9609
+4036
+1227
+11370
+11483
+10833
+3292
+
+1797
+1186
+1161
+3359
+5955
+5332
+3462
+2192
+1729
+2805
+1171
+5332
+3731
+4957
+5346
+
+5676
+7085
+3867
+9663
+13102
+
+5308
+3903
+8988
+15818
+2696
+
+7063
+7044
+7147
+2751
+6535
+1043
+6057
+4090
+3731
+7334
+
+7758
+5823
+6563
+2108
+9679
+5786
+4832
+3159
diff --git a/src/day01.lisp b/src/day01.lisp
@@ -0,0 +1,38 @@
+(defpackage #:adventofcode2022/day01
+ (:use #:cl #:adventofcode2022))
+(in-package #:adventofcode2022/day01)
+
+(defun task1 (inputs)
+ (let ((max 0)
+ (current 0))
+ (dolist (input inputs)
+ (if (null input)
+ (progn
+ (when (> current max)
+ (setf max current))
+ (setf current 0))
+ (setf current (+ current input))))
+ (when (> current max)
+ (setf max current))
+ max))
+
+(defun task2 (inputs)
+ (let ((elves nil)
+ (current 0))
+ (dolist (input inputs)
+ (if (null input)
+ (progn
+ (push current elves)
+ (setf current 0))
+ (setf current (+ current input))))
+ (push current elves)
+ (setf elves (sort elves #'>))
+ (apply #'+ (subseq elves 0 3))))
+
+(define-day 1
+ (:translate-input (lambda (line)
+ (if (= (length line) 0)
+ nil
+ (parse-integer line))))
+ #'task1
+ #'task2)
diff --git a/src/main.lisp b/src/main.lisp
@@ -0,0 +1,52 @@
+(defpackage #:adventofcode2022
+ (:use #:cl)
+ (:export
+ #:run-task
+ #:add-task
+ #:define-day))
+(in-package #:adventofcode2022)
+
+(defparameter *days* (make-hash-table))
+
+(defun add-task (day task func)
+ (let ((current (gethash day *days*)))
+ (when (null current)
+ (setf current (make-array 2)))
+ (setf (aref current (1- task)) func)
+ (setf (gethash day *days*) current)))
+
+(defun run-task (day task &optional input-stream)
+ (let* ((tasks (gethash day *days*))
+ (taskfun (aref tasks (1- task)))
+ (s (if (null input-stream)
+ (open
+ (merge-pathnames
+ (make-pathname
+ :directory '(:relative "input")
+ :name (format nil "day~2,'0d" day)
+ :type "txt")
+ (asdf:system-source-directory "adventofcode2022")))
+ input-stream)))
+ (unwind-protect
+ (funcall taskfun s)
+ (close s))))
+
+(defun parse-input (input-stream opts)
+ (let ((translate-fun (getf opts :translate-input))
+ (lines (uiop:slurp-stream-lines input-stream)))
+ (when (not (null translate-fun))
+ (setf lines (mapcar translate-fun lines)))
+ lines))
+
+(eval-when (:compile-toplevel)
+ (defun make-add-task-form (day task opts form)
+ `(add-task ,day ,task
+ (lambda (input-stream)
+ (let ((inputs (parse-input input-stream (list ,@opts))))
+ (funcall ,form inputs))))))
+
+(defmacro define-day (day opts task1 task2)
+ `(progn
+ ,(make-add-task-form day 1 opts task1)
+ ,(when (not (null task2))
+ (make-add-task-form day 2 opts task2))))
diff --git a/t/day01.lisp b/t/day01.lisp
@@ -0,0 +1,28 @@
+(in-package #:adventofcode2022/test)
+
+(defconstant +testdata-day01+ "1000
+2000
+3000
+
+4000
+
+5000
+6000
+
+7000
+8000
+9000
+
+10000")
+
+(def-test day01-task1 ()
+ (is-true
+ (= 24000
+ (run-task 1 1
+ (make-string-input-stream +testdata-day01+)))))
+
+(def-test day01-task2 ()
+ (is-true
+ (= 45000
+ (run-task 1 2
+ (make-string-input-stream +testdata-day01+)))))
diff --git a/t/package.lisp b/t/package.lisp
@@ -0,0 +1,5 @@
+(defpackage #:adventofcode2022/test
+ (:use #:cl #:adventofcode2022 #:5am))
+
+(in-package #:adventofcode2022/test)
+(def-suite adventofcode2022)