|
| 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/easy/mayTheTriforceBeWithYou/mayTheTriforceBeWithYou.js'; |
| 6 | + |
| 7 | +const __dirname = new URL('.', import.meta.url).pathname; |
| 8 | + |
| 9 | +suite('May the Triforce be with you!', 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('N = 1', function() { |
| 22 | + let inputFile = new File(__dirname + 'input/01 - N=1.txt'); |
| 23 | + |
| 24 | + execute(inputFile.readline.bind(inputFile)); |
| 25 | + |
| 26 | + assertOutputAnswer(__dirname + 'output/01 - N=1.txt'); |
| 27 | + }); |
| 28 | + |
| 29 | + test('N = 3', function() { |
| 30 | + let inputFile = new File(__dirname + 'input/02 - N=3.txt'); |
| 31 | + |
| 32 | + execute(inputFile.readline.bind(inputFile)); |
| 33 | + |
| 34 | + assertOutputAnswer(__dirname + 'output/02 - N=3.txt'); |
| 35 | + }); |
| 36 | + |
| 37 | + test('N = 5', function() { |
| 38 | + let inputFile = new File(__dirname + 'input/03 - N=5.txt'); |
| 39 | + |
| 40 | + execute(inputFile.readline.bind(inputFile)); |
| 41 | + |
| 42 | + assertOutputAnswer(__dirname + 'output/03 - N=5.txt'); |
| 43 | + }); |
| 44 | + |
| 45 | + test('N = 10', function() { |
| 46 | + let inputFile = new File(__dirname + 'input/04 - N=10.txt'); |
| 47 | + |
| 48 | + execute(inputFile.readline.bind(inputFile)); |
| 49 | + |
| 50 | + assertOutputAnswer(__dirname + 'output/04 - N=10.txt'); |
| 51 | + }); |
| 52 | +}); |
0 commit comments