Skip to content

Commit 8a7a234

Browse files
committed
Adding tests for "ASCII ART : glass stacking".
1 parent 59c2964 commit 8a7a234

File tree

11 files changed

+123
-0
lines changed

11 files changed

+123
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2626
- Tests for "Domino puzzle".
2727
- Tests for "Goldbach’s conjecture".
2828
- Tests for "Let's go to the cinema!".
29+
- Tests for "ASCII ART : glass stacking".
2930

3031
## [1.16.0] - 2022-12-31
3132
### Added
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/**
2+
* The "ASCII ART : glass stacking" puzzle.
3+
* @see {@link https://www.codingame.com/ide/puzzle/ascii-art-glass-stacking}
4+
*/
5+
function execute(readline) {
6+
const N = parseInt(readline());
7+
8+
// Write an answer using console.log()
9+
// To debug: console.error('Debug messages...');
10+
11+
console.log('answer');
12+
}
13+
14+
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/ASCIIArtGlassStacking/ASCIIArtGlassStacking.js';
6+
7+
const __dirname = new URL('.', import.meta.url).pathname;
8+
9+
suite("ASCII ART : glass stacking", 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("4 glasses", function() {
22+
let inputFile = new File(__dirname + 'input/01 - 4 glasses.txt');
23+
24+
execute(inputFile.readline.bind(inputFile));
25+
26+
assertOutputAnswer(__dirname + 'output/01 - 4 glasses.txt');
27+
});
28+
29+
test("10 glasses", function() {
30+
let inputFile = new File(__dirname + 'input/02 - 10 glasses.txt');
31+
32+
execute(inputFile.readline.bind(inputFile));
33+
34+
assertOutputAnswer(__dirname + 'output/02 - 10 glasses.txt');
35+
});
36+
37+
test("25 glasses", function() {
38+
let inputFile = new File(__dirname + 'input/03 - 25 glasses.txt');
39+
40+
execute(inputFile.readline.bind(inputFile));
41+
42+
assertOutputAnswer(__dirname + 'output/03 - 25 glasses.txt');
43+
});
44+
45+
test("A single glass", function() {
46+
let inputFile = new File(__dirname + 'input/04 - a single glass.txt');
47+
48+
execute(inputFile.readline.bind(inputFile));
49+
50+
assertOutputAnswer(__dirname + 'output/04 - a single glass.txt');
51+
});
52+
});
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
4
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
10
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
25
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
***
2+
* *
3+
* *
4+
*****
5+
*** ***
6+
* * * *
7+
* * * *
8+
***** *****
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
***
2+
* *
3+
* *
4+
*****
5+
*** ***
6+
* * * *
7+
* * * *
8+
***** *****
9+
*** *** ***
10+
* * * * * *
11+
* * * * * *
12+
***** ***** *****
13+
*** *** *** ***
14+
* * * * * * * *
15+
* * * * * * * *
16+
***** ***** ***** *****
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
***
2+
* *
3+
* *
4+
*****
5+
*** ***
6+
* * * *
7+
* * * *
8+
***** *****
9+
*** *** ***
10+
* * * * * *
11+
* * * * * *
12+
***** ***** *****
13+
*** *** *** ***
14+
* * * * * * * *
15+
* * * * * * * *
16+
***** ***** ***** *****
17+
*** *** *** *** ***
18+
* * * * * * * * * *
19+
* * * * * * * * * *
20+
***** ***** ***** ***** *****
21+
*** *** *** *** *** ***
22+
* * * * * * * * * * * *
23+
* * * * * * * * * * * *
24+
***** ***** ***** ***** ***** *****

0 commit comments

Comments
 (0)