File tree 13 files changed +64
-1
lines changed
13 files changed +64
-1
lines changed Original file line number Diff line number Diff line change @@ -39,6 +39,7 @@ class RunContext {
39
39
has $ . input-file ;
40
40
has $ . input ;
41
41
has % . expected is rw ;
42
+ has @ . passed ;
42
43
43
44
method run-part (Int $ part ) {
44
45
my $ expected = $ . expected «$ part » // ' ' ;
@@ -49,6 +50,7 @@ class RunContext {
49
50
my $ end = now;
50
51
put $ result ;
51
52
" Part $ part took %.3fms\n " . printf (($ end - $ start ) * 1000 );
53
+ @ ! passed . push ($ result eq ' TODO' || $ expected && $ expected eq $ result );
52
54
if $ expected {
53
55
if $ expected eq $ result {
54
56
say " \c[CHECK MARK] PASS with expected value '$ result '" ;
@@ -60,6 +62,7 @@ class RunContext {
60
62
}
61
63
62
64
sub MAIN (* @ input-files ) {
65
+ my $ exit = all ();
63
66
for @ input-files -> $ input-file {
64
67
if $ input-file . IO . slurp -> $ input {
65
68
my $ context = RunContext. new (: $ input , : $ input-file );
@@ -71,9 +74,11 @@ sub MAIN(*@input-files) {
71
74
$ context . run-part(1 );
72
75
say ' ' ;
73
76
$ context . run-part(2 );
77
+ $ exit &= all ($ context . passed);
74
78
} else {
75
79
say " EMPTY INPUT FILE: $ input-file" ;
76
80
}
77
81
say ' =' x 40 ;
78
82
}
83
+ exit $ exit ?? 0 !! 1 ;
79
84
}
Original file line number Diff line number Diff line change @@ -66,6 +66,7 @@ class RunContext {
66
66
has $ . input-file ;
67
67
has $ . input ;
68
68
has % . expected is rw ;
69
+ has @ . passed ;
69
70
70
71
method run-part (Solver: U $ part ) {
71
72
my $ num = $ part .^ name . comb (/\d + /). head;
@@ -77,6 +78,7 @@ class RunContext {
77
78
my $ end = now;
78
79
put $ result ;
79
80
" Part $ num took %.3fms\n " . printf (($ end - $ start ) * 1000 );
81
+ @ ! passed . push ($ result eq ' TODO' || $ expected && $ expected eq $ result );
80
82
if $ expected {
81
83
if $ expected eq $ result {
82
84
say " \c[CHECK MARK] PASS with expected value '$ result '" ;
@@ -88,6 +90,7 @@ class RunContext {
88
90
}
89
91
90
92
sub MAIN (* @ input-files ) {
93
+ my $ exit = all ();
91
94
for @ input-files -> $ input-file {
92
95
if $ input-file . IO . slurp -> $ input {
93
96
my $ context = RunContext. new (: $ input , : $ input-file );
@@ -99,9 +102,11 @@ sub MAIN(*@input-files) {
99
102
$ context . run-part(Part1);
100
103
say ' ' ;
101
104
$ context . run-part(Part2);
105
+ $ exit &= all ($ context . passed);
102
106
} else {
103
107
say " EMPTY INPUT FILE: $ input-file" ;
104
108
}
105
109
say ' =' x 40 ;
106
110
}
111
+ exit $ exit ?? 0 !! 1 ;
107
112
}
Original file line number Diff line number Diff line change @@ -84,6 +84,7 @@ class RunContext {
84
84
has $ . input-file ;
85
85
has $ . input ;
86
86
has % . expected is rw ;
87
+ has @ . passed ;
87
88
88
89
method run-part (Solver: U $ part ) {
89
90
my $ num = $ part .^ name . comb (/\d + /). head;
@@ -95,6 +96,7 @@ class RunContext {
95
96
my $ end = now;
96
97
put $ result ;
97
98
" Part $ num took %.3fms\n " . printf (($ end - $ start ) * 1000 );
99
+ @ ! passed . push ($ result eq ' TODO' || $ expected && $ expected eq $ result );
98
100
if $ expected {
99
101
if $ expected eq $ result {
100
102
say " \c[CHECK MARK] PASS with expected value '$ result '" ;
@@ -106,6 +108,7 @@ class RunContext {
106
108
}
107
109
108
110
sub MAIN (* @ input-files ) {
111
+ my $ exit = all ();
109
112
for @ input-files -> $ input-file {
110
113
if $ input-file . IO . slurp -> $ input {
111
114
my $ context = RunContext. new (: $ input , : $ input-file );
@@ -117,9 +120,11 @@ sub MAIN(*@input-files) {
117
120
$ context . run-part(Part1);
118
121
say ' ' ;
119
122
$ context . run-part(Part2);
123
+ $ exit &= all ($ context . passed);
120
124
} else {
121
125
say " EMPTY INPUT FILE: $ input-file" ;
122
126
}
123
127
say ' =' x 40 ;
124
128
}
129
+ exit $ exit ?? 0 !! 1 ;
125
130
}
Original file line number Diff line number Diff line change @@ -76,6 +76,7 @@ class RunContext {
76
76
has $ . input-file ;
77
77
has $ . input ;
78
78
has % . expected is rw ;
79
+ has @ . passed ;
79
80
80
81
method run-part (Solver: U $ part ) {
81
82
my $ num = $ part .^ name . comb (/\d + /). head;
@@ -88,6 +89,7 @@ class RunContext {
88
89
put $ result ;
89
90
" Part $ num took %.3fms\n " . printf (($ end - $ start ) * 1000 );
90
91
say " Memoization of { + $ solver . dfsmemo} items saved { $ solver . memosaved} paths" ;
92
+ @ ! passed . push ($ result eq ' TODO' || $ expected && $ expected eq $ result );
91
93
if $ expected {
92
94
if $ expected eq $ result {
93
95
say " \c[CHECK MARK] PASS with expected value '$ result '" ;
@@ -99,6 +101,7 @@ class RunContext {
99
101
}
100
102
101
103
sub MAIN (* @ input-files ) {
104
+ my $ exit = all ();
102
105
for @ input-files -> $ input-file {
103
106
if $ input-file . IO . slurp -> $ input {
104
107
my $ context = RunContext. new (: $ input , : $ input-file );
@@ -110,9 +113,11 @@ sub MAIN(*@input-files) {
110
113
$ context . run-part(Part1);
111
114
say ' ' ;
112
115
$ context . run-part(Part2);
116
+ $ exit &= all ($ context . passed);
113
117
} else {
114
118
say " EMPTY INPUT FILE: $ input-file" ;
115
119
}
116
120
say ' =' x 40 ;
117
121
}
122
+ return $ exit ?? 0 !! 1 ;
118
123
}
Original file line number Diff line number Diff line change @@ -73,6 +73,7 @@ class RunContext {
73
73
has $ . input-file ;
74
74
has $ . input ;
75
75
has % . expected is rw ;
76
+ has @ . passed ;
76
77
77
78
method run-part (Int $ part ) {
78
79
my $ expected = $ . expected «$ part » // ' ' ;
@@ -83,6 +84,7 @@ class RunContext {
83
84
my $ end = now;
84
85
put $ result ;
85
86
" Part $ part took %.3fms\n " . printf (($ end - $ start ) * 1000 );
87
+ @ ! passed . push ($ result eq ' TODO' || $ expected && $ expected eq $ result );
86
88
if $ expected {
87
89
if $ expected eq $ result {
88
90
say " \c[CHECK MARK] PASS with expected value '$ result '" ;
@@ -94,6 +96,7 @@ class RunContext {
94
96
}
95
97
96
98
sub MAIN (* @ input-files ) {
99
+ my $ exit = all ();
97
100
for @ input-files -> $ input-file {
98
101
if $ input-file . IO . slurp -> $ input {
99
102
my $ context = RunContext. new (: $ input , : $ input-file );
@@ -105,9 +108,11 @@ sub MAIN(*@input-files) {
105
108
$ context . run-part(1 );
106
109
say ' ' ;
107
110
$ context . run-part(2 );
111
+ $ exit &= all ($ context . passed);
108
112
} else {
109
113
say " EMPTY INPUT FILE: $ input-file" ;
110
114
}
111
115
say ' =' x 40 ;
112
116
}
117
+ exit $ exit ?? 0 !! 1 ;
113
118
}
Original file line number Diff line number Diff line change @@ -65,6 +65,7 @@ class RunContext {
65
65
has $ . input-file ;
66
66
has $ . input ;
67
67
has % . expected is rw ;
68
+ has @ . passed ;
68
69
69
70
method run-part (Solver: U $ part ) {
70
71
my $ num = $ part .^ name . comb (/\d + /). head;
@@ -76,6 +77,7 @@ class RunContext {
76
77
my $ end = now;
77
78
put $ result ;
78
79
" Part $ num took %.3fms\n " . printf (($ end - $ start ) * 1000 );
80
+ @ ! passed . push ($ result eq ' TODO' || $ expected && $ expected eq $ result );
79
81
if $ expected {
80
82
if $ expected eq $ result {
81
83
say " \c[CHECK MARK] PASS with expected value '$ result '" ;
@@ -87,6 +89,7 @@ class RunContext {
87
89
}
88
90
89
91
sub MAIN (* @ input-files ) {
92
+ my $ exit = all ();
90
93
for @ input-files -> $ input-file {
91
94
if $ input-file . IO . slurp -> $ input {
92
95
my $ context = RunContext. new (: $ input , : $ input-file );
@@ -98,9 +101,11 @@ sub MAIN(*@input-files) {
98
101
$ context . run-part(Part1);
99
102
say ' ' ;
100
103
$ context . run-part(Part2);
104
+ $ exit &= all ($ context . passed);
101
105
} else {
102
106
say " EMPTY INPUT FILE: $ input-file" ;
103
107
}
104
108
say ' =' x 40 ;
105
109
}
110
+ exit $ exit ?? 0 !! 1 ;
106
111
}
Original file line number Diff line number Diff line change @@ -90,6 +90,7 @@ class RunContext {
90
90
has $ . input-file ;
91
91
has $ . input ;
92
92
has % . expected is rw ;
93
+ has @ . passed ;
93
94
94
95
method run-part (Solver: U $ part ) {
95
96
my $ num = $ part .^ name . comb (/\d + /). head;
@@ -101,6 +102,7 @@ class RunContext {
101
102
my $ end = now;
102
103
put $ result ;
103
104
" Part $ num took %.3fms\n " . printf (($ end - $ start ) * 1000 );
105
+ @ ! passed . push ($ result eq ' TODO' || $ expected && $ expected eq $ result );
104
106
if $ expected {
105
107
if $ expected eq $ result {
106
108
say " \c[CHECK MARK] PASS with expected value '$ result '" ;
@@ -112,6 +114,7 @@ class RunContext {
112
114
}
113
115
114
116
sub MAIN (* @ input-files ) {
117
+ my $ exit = all ();
115
118
for @ input-files -> $ input-file {
116
119
if $ input-file . IO . slurp -> $ input {
117
120
my $ context = RunContext. new (: $ input , : $ input-file );
@@ -123,9 +126,11 @@ sub MAIN(*@input-files) {
123
126
$ context . run-part(Part1);
124
127
say ' ' ;
125
128
$ context . run-part(Part2);
129
+ $ exit &= all ($ context . passed);
126
130
} else {
127
131
say " EMPTY INPUT FILE: $ input-file" ;
128
132
}
129
133
say ' =' x 40 ;
130
134
}
135
+ exit $ exit ?? 0 !! 1 ;
131
136
}
Original file line number Diff line number Diff line change @@ -66,6 +66,7 @@ class RunContext {
66
66
has $ . input-file ;
67
67
has $ . input ;
68
68
has % . expected is rw ;
69
+ has @ . passed ;
69
70
70
71
method run-part (Solver: U $ part ) {
71
72
my $ num = $ part .^ name . comb (/\d + /). head;
@@ -77,6 +78,7 @@ class RunContext {
77
78
my $ end = now;
78
79
put $ result ;
79
80
" Part $ num took %.3fms\n " . printf (($ end - $ start ) * 1000 );
81
+ @ ! passed . push ($ result eq ' TODO' || $ expected && $ expected eq $ result );
80
82
if $ expected {
81
83
if $ expected eq $ result {
82
84
say " \c[CHECK MARK] PASS with expected value '$ result '" ;
@@ -88,6 +90,7 @@ class RunContext {
88
90
}
89
91
90
92
sub MAIN (* @ input-files ) {
93
+ my $ exit = all ();
91
94
for @ input-files -> $ input-file {
92
95
if $ input-file . IO . slurp -> $ input {
93
96
my $ context = RunContext. new (: $ input , : $ input-file );
@@ -99,9 +102,11 @@ sub MAIN(*@input-files) {
99
102
$ context . run-part(Part1);
100
103
say ' ' ;
101
104
$ context . run-part(Part2);
105
+ $ exit &= all ($ context . passed);
102
106
} else {
103
107
say " EMPTY INPUT FILE: $ input-file" ;
104
108
}
105
109
say ' =' x 40 ;
106
110
}
111
+ exit $ exit ?? 0 !! 1 ;
107
112
}
Original file line number Diff line number Diff line change @@ -33,6 +33,7 @@ class RunContext {
33
33
has $ . input-file ;
34
34
has $ . input ;
35
35
has % . expected is rw ;
36
+ has @ . passed ;
36
37
37
38
method run-part (Solver: U $ part ) {
38
39
my $ num = $ part .^ name . comb (/\d + /). head;
@@ -44,6 +45,7 @@ class RunContext {
44
45
my $ end = now;
45
46
put $ result ;
46
47
" Part $ num took %.3fms\n " . printf (($ end - $ start ) * 1000 );
48
+ @ ! passed . push ($ result eq ' TODO' || $ expected && $ expected eq $ result );
47
49
if $ expected {
48
50
if $ expected eq $ result {
49
51
say " \c[CHECK MARK] PASS with expected value '$ result '" ;
@@ -55,6 +57,7 @@ class RunContext {
55
57
}
56
58
57
59
sub MAIN (* @ input-files ) {
60
+ my $ exit = all ();
58
61
for @ input-files -> $ input-file {
59
62
if $ input-file . IO . slurp -> $ input {
60
63
my $ context = RunContext. new (: $ input , : $ input-file );
@@ -66,9 +69,11 @@ sub MAIN(*@input-files) {
66
69
$ context . run-part(Part1);
67
70
say ' ' ;
68
71
$ context . run-part(Part2);
72
+ $ exit &= all ($ context . passed);
69
73
} else {
70
74
say " EMPTY INPUT FILE: $ input-file" ;
71
75
}
72
76
say ' =' x 40 ;
73
77
}
78
+ exit $ exit ?? 0 !! 1 ;
74
79
}
Original file line number Diff line number Diff line change @@ -32,6 +32,7 @@ class RunContext {
32
32
has $ . input-file ;
33
33
has $ . input ;
34
34
has % . expected is rw ;
35
+ has @ . passed ;
35
36
36
37
method run-part (Solver: U $ part ) {
37
38
my $ num = $ part .^ name . comb (/\d + /). head;
@@ -43,6 +44,7 @@ class RunContext {
43
44
my $ end = now;
44
45
put $ result ;
45
46
" Part $ num took %.3fms\n " . printf (($ end - $ start ) * 1000 );
47
+ @ ! passed . push ($ result eq ' TODO' || $ expected && $ expected eq $ result );
46
48
if $ expected {
47
49
if $ expected eq $ result {
48
50
say " \c[CHECK MARK] PASS with expected value '$ result '" ;
@@ -54,6 +56,7 @@ class RunContext {
54
56
}
55
57
56
58
sub MAIN (* @ input-files ) {
59
+ my $ exit = all ();
57
60
for @ input-files -> $ input-file {
58
61
if $ input-file . IO . slurp -> $ input {
59
62
my $ context = RunContext. new (: $ input , : $ input-file );
@@ -65,9 +68,11 @@ sub MAIN(*@input-files) {
65
68
$ context . run-part(Part1);
66
69
say ' ' ;
67
70
$ context . run-part(Part2);
71
+ $ exit &= all ($ context . passed);
68
72
} else {
69
73
say " EMPTY INPUT FILE: $ input-file" ;
70
74
}
71
75
say ' =' x 40 ;
72
76
}
77
+ exit $ exit ?? 0 !! 1 ;
73
78
}
Original file line number Diff line number Diff line change @@ -95,6 +95,7 @@ class RunContext {
95
95
has $ . input-file ;
96
96
has $ . input ;
97
97
has % . expected is rw ;
98
+ has @ . passed ;
98
99
99
100
method run-part (Solver: U $ part ) {
100
101
my $ num = $ part .^ name . comb (/\d + /). head;
@@ -106,6 +107,7 @@ class RunContext {
106
107
my $ end = now;
107
108
put $ result ;
108
109
" Part $ num took %.3fms\n " . printf (($ end - $ start ) * 1000 );
110
+ @ ! passed . push ($ result eq ' TODO' || $ expected && $ expected eq $ result );
109
111
if $ expected {
110
112
if $ expected eq $ result {
111
113
say " \c[CHECK MARK] PASS with expected value '$ result '" ;
@@ -117,6 +119,7 @@ class RunContext {
117
119
}
118
120
119
121
sub MAIN (* @ input-files ) {
122
+ my $ exit = all ();
120
123
for @ input-files -> $ input-file {
121
124
if $ input-file . IO . slurp -> $ input {
122
125
my $ context = RunContext. new (: $ input , : $ input-file );
@@ -128,9 +131,11 @@ sub MAIN(*@input-files) {
128
131
$ context . run-part(Part1);
129
132
say ' ' ;
130
133
$ context . run-part(Part2);
134
+ $ exit &= all ($ context . passed);
131
135
} else {
132
136
say " EMPTY INPUT FILE: $ input-file" ;
133
137
}
134
138
say ' =' x 40 ;
135
139
}
140
+ exit $ exit ?? 0 !! 1 ;
136
141
}
You can’t perform that action at this time.
0 commit comments