Skip to content

Commit 00ab68f

Browse files
committed
Adding tests for "Blood types".
1 parent 37e24d1 commit 00ab68f

File tree

11 files changed

+271
-0
lines changed

11 files changed

+271
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3434
- Tests for "Plague, jr".
3535
- Tests for "English length units conversion".
3636
- Tests for "Sandpile addition".
37+
- Tests for "Blood types".
3738

3839
## [1.14.0] - 2022-10-31
3940
### Added
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/**
2+
* The "Blood types" puzzle.
3+
* @see {@link https://www.codingame.com/ide/puzzle/blood-types}
4+
*/
5+
function execute(readline) {
6+
const N = parseInt(readline());
7+
for (let i = 0; i < N; i++) {
8+
var inputs = readline().split(' ');
9+
const parent1 = inputs[0];
10+
const parent2 = inputs[1];
11+
const child = inputs[2];
12+
}
13+
14+
// Write an answer using console.log()
15+
// To debug: console.error('Debug messages...');
16+
17+
console.log('answer');
18+
}
19+
20+
export { execute };
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import { assert } from 'chai';
2+
import sinon from 'sinon';
3+
import File from '../../../../File.js';
4+
import { assertOutputAnswer } from '../../../../assertOutputAnswer.js';
5+
import { execute } from '../../../../../lib/community/training/medium/bloodTypes/bloodTypes.js';
6+
7+
const __dirname = new URL('.', import.meta.url).pathname;
8+
9+
suite("Blood types", function() {
10+
const sandbox = sinon.createSandbox();
11+
12+
setup(function () {
13+
sandbox.stub(console, "log");
14+
});
15+
16+
teardown(function () {
17+
sandbox.restore();
18+
});
19+
20+
21+
test("Example", function() {
22+
let inputFile = new File(__dirname + 'input/01 - example.txt');
23+
24+
execute(inputFile.readline.bind(inputFile));
25+
26+
assertOutputAnswer(__dirname + 'output/01 - example.txt');
27+
});
28+
29+
test("Child blood types", function() {
30+
let inputFile = new File(__dirname + 'input/02 - child blood types.txt');
31+
32+
execute(inputFile.readline.bind(inputFile));
33+
34+
assertOutputAnswer(__dirname + 'output/02 - child blood types.txt');
35+
});
36+
37+
test("Parents blood types", function() {
38+
let inputFile = new File(__dirname + 'input/03 - parents blood types.txt');
39+
40+
execute(inputFile.readline.bind(inputFile));
41+
42+
assertOutputAnswer(__dirname + 'output/03 - parents blood types.txt');
43+
});
44+
45+
test("All combins", function() {
46+
let inputFile = new File(__dirname + 'input/04 - all combins.txt');
47+
48+
execute(inputFile.readline.bind(inputFile));
49+
50+
assertOutputAnswer(__dirname + 'output/04 - all combins.txt');
51+
});
52+
});
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
4
2+
A- O+ ?
3+
A- ? A+
4+
? O+ A+
5+
AB- ? O-
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
12
2+
AB+ B- ?
3+
A+ O- ?
4+
O+ AB+ ?
5+
A- A+ ?
6+
O+ B- ?
7+
O- AB- ?
8+
AB- A+ ?
9+
AB+ AB+ ?
10+
A+ A- ?
11+
A- B- ?
12+
B- O- ?
13+
O- O+ ?
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
31
2+
? O- B-
3+
A+ ? O-
4+
A- ? B+
5+
O+ ? A+
6+
A+ ? O+
7+
AB+ ? B+
8+
? A+ A-
9+
AB+ ? B-
10+
? AB+ AB-
11+
? AB+ AB+
12+
O+ ? AB+
13+
AB- ? B+
14+
? AB+ B-
15+
AB- ? A-
16+
? O+ O-
17+
? AB+ B+
18+
? A+ B+
19+
? O- A+
20+
B- ? AB+
21+
? O- A-
22+
O+ ? A-
23+
B- ? AB-
24+
A- ? A-
25+
? O- AB+
26+
? B+ O+
27+
AB+ ? A-
28+
? A+ B-
29+
? B+ O-
30+
AB- ? B-
31+
B- ? O-
32+
? AB+ A-
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
50
2+
? AB- B-
3+
AB- O+ ?
4+
O- ? B-
5+
B- A+ ?
6+
B- ? B+
7+
O- ? B+
8+
O- A+ ?
9+
? O+ A-
10+
AB- ? O+
11+
B- ? B-
12+
? B+ AB-
13+
? B+ AB+
14+
? O- O+
15+
A+ O+ ?
16+
? O- O-
17+
O+ AB- ?
18+
? A- A+
19+
? A- A-
20+
B+ AB- ?
21+
A+ AB- ?
22+
? A+ O-
23+
? B+ B-
24+
? A+ O+
25+
? A+ AB+
26+
O- B+ ?
27+
? A+ AB-
28+
A- A- ?
29+
? AB+ O+
30+
O+ B+ ?
31+
? O+ AB-
32+
O- AB+ ?
33+
? B+ B+
34+
? AB+ O-
35+
AB+ A- ?
36+
? O+ AB+
37+
? AB- A+
38+
AB- A- ?
39+
? A- AB+
40+
AB+ AB- ?
41+
A+ ? B+
42+
A+ ? B-
43+
B+ ? A+
44+
? B+ A+
45+
AB+ ? O+
46+
? B+ A-
47+
A- B+ ?
48+
B- O+ ?
49+
B+ B- ?
50+
AB+ ? O-
51+
B+ ? A-
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
A+ A- O+ O-
2+
A+ AB+ B+ O+
3+
A+ A- AB+ AB-
4+
impossible
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
A+ A- AB+ AB- B+ B-
2+
A+ A- O+ O-
3+
A+ A- B+ B-
4+
A+ A- O+ O-
5+
B+ B- O+ O-
6+
A- B-
7+
A+ A- AB+ AB- B+ B-
8+
A+ A- AB+ AB- B+ B-
9+
A+ A- O+ O-
10+
A- AB- B- O-
11+
B- O-
12+
O+ O-
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
AB+ AB- B+ B-
2+
A+ A- B+ B- O+ O-
3+
AB+ B+
4+
A+ A- AB+ AB-
5+
A+ A- B+ B- O+ O-
6+
A+ A- AB+ AB- B+ B- O+ O-
7+
A+ A- AB+ AB- B+ B- O+ O-
8+
A+ A- AB+ AB- B+ B- O+ O-
9+
A+ A- AB+ AB- B+ B-
10+
A+ A- AB+ AB- B+ B-
11+
impossible
12+
A+ AB+ B+ O+
13+
A+ A- AB+ AB- B+ B- O+ O-
14+
A+ A- AB+ AB- B+ B- O+ O-
15+
A+ A- B+ B- O+ O-
16+
A+ A- AB+ AB- B+ B- O+ O-
17+
AB+ AB- B+ B-
18+
A+ AB+
19+
A+ AB+
20+
A+ A- AB+ AB-
21+
A+ A- AB+ AB-
22+
A+ A- AB+ AB-
23+
A+ A- AB+ AB- B+ B- O+ O-
24+
impossible
25+
A+ A- B+ B- O+ O-
26+
A+ A- AB+ AB- B+ B- O+ O-
27+
AB+ AB- B+ B-
28+
A+ A- B+ B- O+ O-
29+
A+ A- AB+ AB- B+ B- O+ O-
30+
A+ A- B+ B- O+ O-
31+
A+ A- AB+ AB- B+ B- O+ O-

0 commit comments

Comments
 (0)