Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 53 #54

Merged
merged 6 commits into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions __tests__/SingleThread.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

import { readFileSync, writeFileSync } from "fs";
import { readFileSync } from "fs";
import { SingleThread } from '../src/SingleThread.js';

const SARAFU_CSV = './__tests__/fixtures/sarafu-300.csv';
Expand All @@ -9,16 +9,17 @@ describe('SingleThread', () => {
let solution: string = '';
const threadRunner = new SingleThread({ sarafuFile: SARAFU_CSV, numWorkers: 1,
solutionCallback: async (line: string): Promise<void> => {
// console.log(line);
solution += line;
}, });
const cummNumProbes = await threadRunner.runAllWorkers();
const read = readFileSync(`./__tests__/fixtures/sarafu-300.solution`).toString();
if (solution !== read) {
// console.log(`mending test`);
writeFileSync(`./__tests__/fixtures/sarafu-300.solution`, solution);
}
// if (solution !== read) {
// // console.log(`mending test`);
// writeFileSync(`./__tests__/fixtures/sarafu-300.solution`, solution);
// }
expect(solution).toEqual(read);
expect(cummNumProbes).toEqual(2);
expect(cummNumProbes).toEqual(3);

expect(await threadRunner.solutionIsComplete()).toEqual(true);
});
Expand Down
247 changes: 247 additions & 0 deletions __tests__/fixtures/debt-300.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,247 @@
1 0 321.5
2 0 113
2 1 18
4 5 5
4 2 4
6 7 10
8 2 5
9 10 1
11 5 5
12 10 1
12 13 350
14 15 200
9 13 370
3 0 10
18 19 330
20 21 140
22 23 5
1 3 10
5 26 0.5
24 25 20
27 23 10
28 29 450
16 17 110
1 11 15
3 2 12
35 18 50
36 18 40
37 38 400
39 40 4
41 40 2
30 4 5
33 34 588
31 32 400
42 40 2
48 49 100
46 47 100
43 40 2
51 40 2
53 40 2
52 40 2
1 54 2000
48 56 100
57 56 100
49 56 100
58 56 100
59 56 100
61 40 2
60 40 2
62 56 50
63 40 2
64 56 50
65 56 2300
67 40 2
68 56 50
69 40 152
70 40 2
71 40 2
73 40 2
1 74 50
1 77 100
78 40 2
79 80 5
81 40 2
83 40 2
84 76 2
76 75 2
85 40 2
86 21 210
87 88 100
90 19 100
91 92 480
93 94 5
95 96 5
97 98 2
99 100 5
101 40 2
102 103 1200
105 106 5
107 10 1
108 40 2
109 97 2
110 10 1
112 102 100
114 115 50
116 10 1
113 10 1
117 118 5
119 19 400
122 10 1
124 125 50
126 127 5
128 10 1
129 19 400
36 130 360
19 131 720
35 130 350
132 133 5
16 125 120
135 98 20
137 10 1
17 125 60
138 139 240
140 106 5
141 10 1
142 143 54
144 10 1
145 40 2
146 98 50
147 40 2
148 10 1
149 150 5
152 98 10
153 10 1
154 155 5
156 10 1
158 159 1
157 40 2
160 98 5
161 10 1
162 10 1
163 10 1
88 164 300
165 10 1
95 164 390
166 167 200
168 167 150
99 164 390
169 10 1
79 164 395
170 159 1
171 167 250
172 167 175
173 92 120
105 164 390
174 167 100
175 164 1000
176 167 350
177 10 1
178 10 1
179 10 1
180 181 50
182 181 50
183 184 800
185 181 50
186 10 1
187 10 1
32 188 280
76 189 2
51 167 250
71 167 90
190 191 400
192 164 400
193 10 1
53 168 80
73 168 100
194 195 100
196 10 1
81 83 200
60 167 220
197 54 50
198 199 400
43 181 150
200 98 5
1 201 150
61 181 300
202 10 1
201 54 150
203 10 1
44 131 400
39 181 300
204 29 300
141 205 399
40 206 2100
40 207 1500
175 192 100
40 208 1000
209 210 400
211 205 50
212 29 300
214 215 10
213 206 200
216 206 100
217 218 150
219 220 160
221 218 100
222 218 50
223 224 120
225 226 148
229 230 148
232 233 450
227 234 50
235 208 200
225 207 150
237 206 99
235 231 98
238 208 299
239 230 150
240 226 198
241 207 148
158 242 399
227 243 15
236 218 50
246 247 40
248 249 600
250 206 140
244 208 48
229 231 150
244 245 100
227 228 52
170 242 399
253 40 150
254 226 150
252 54 200
251 247 190
257 40 150
257 208 148
165 247 390
256 29 300
259 230 150
260 40 150
261 226 150
262 207 150
263 208 150
263 226 148
264 21 70
265 40 150
266 208 150
266 245 150
41 231 150
41 226 148
69 206 148
63 208 298
78 231 298
255 247 140
243 234 15
179 13 399
242 270 820
267 268 1100
169 13 399
163 13 399
178 13 399
272 273 50
274 270 600
275 125 730
258 245 150
271 125 30
269 175 198
1 change: 1 addition & 0 deletions __tests__/fixtures/dfs-300.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1 3 2 10
75 changes: 75 additions & 0 deletions __tests__/fixtures/drains-300.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
0 444.5
5 9.5
7 10
10 28
11 10
13 2316
15 200
17 50
19 510
21 420
23 15
25 20
26 0.5
29 1350
32 120
34 588
38 400
47 100
54 2400
56 2950
74 50
75 2
77 100
80 5
83 198
92 600
94 5
96 5
98 92
100 5
103 1200
106 10
115 50
118 5
125 990
127 5
130 710
131 1120
133 5
139 240
143 54
150 5
155 5
159 2
164 3265
167 1785
168 30
181 900
184 800
188 280
189 2
191 400
195 100
199 400
205 449
206 2787
207 1948
208 2293
210 400
215 10
218 350
220 160
224 120
226 942
228 52
230 448
231 696
233 450
234 65
245 400
247 760
249 600
268 1100
270 1420
273 50
Loading
Loading