|
| 1 | +import { assert } from 'chai'; |
| 2 | +import sinon from 'sinon'; |
| 3 | +import File from '../../../File.js'; |
| 4 | +import { execute } from '../../../../lib/training/hard/genomeSequencing/genomeSequencing.js'; |
| 5 | + |
| 6 | +/** |
| 7 | + * Tests for the "Genome sequencing" puzzle. |
| 8 | + */ |
| 9 | +suite('Genome sequencing', 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('AACCTT', function() { |
| 22 | + let inputFile = new File('./test/training/hard/genomeSequencing/input/01 - AACCTT.txt'); |
| 23 | + |
| 24 | + execute(inputFile.readline.bind(inputFile)); |
| 25 | + |
| 26 | + assert.strictEqual( |
| 27 | + console.log.getCall(0).args[0], |
| 28 | + 6 |
| 29 | + ); |
| 30 | + }); |
| 31 | + |
| 32 | + test('AGATTACAGA', function() { |
| 33 | + let inputFile = new File('./test/training/hard/genomeSequencing/input/02 - AGATTACAGA.txt'); |
| 34 | + |
| 35 | + execute(inputFile.readline.bind(inputFile)); |
| 36 | + |
| 37 | + assert.strictEqual( |
| 38 | + console.log.getCall(0).args[0], |
| 39 | + 10 |
| 40 | + ); |
| 41 | + }); |
| 42 | + |
| 43 | + test('AACTT', function() { |
| 44 | + let inputFile = new File('./test/training/hard/genomeSequencing/input/03 - AACTT.txt'); |
| 45 | + |
| 46 | + execute(inputFile.readline.bind(inputFile)); |
| 47 | + |
| 48 | + assert.strictEqual( |
| 49 | + console.log.getCall(0).args[0], |
| 50 | + 5 |
| 51 | + ); |
| 52 | + }); |
| 53 | + |
| 54 | + test('AGATTA', function() { |
| 55 | + let inputFile = new File('./test/training/hard/genomeSequencing/input/04 - AGATTA.txt'); |
| 56 | + |
| 57 | + execute(inputFile.readline.bind(inputFile)); |
| 58 | + |
| 59 | + assert.strictEqual( |
| 60 | + console.log.getCall(0).args[0], |
| 61 | + 6 |
| 62 | + ); |
| 63 | + }); |
| 64 | + |
| 65 | + test('reversed AGATTA', function() { |
| 66 | + let inputFile = new File('./test/training/hard/genomeSequencing/input/05 - reversed AGATTA.txt'); |
| 67 | + |
| 68 | + execute(inputFile.readline.bind(inputFile)); |
| 69 | + |
| 70 | + assert.strictEqual( |
| 71 | + console.log.getCall(0).args[0], |
| 72 | + 6 |
| 73 | + ); |
| 74 | + }); |
| 75 | + |
| 76 | + test('ATCG', function() { |
| 77 | + let inputFile = new File('./test/training/hard/genomeSequencing/input/06 - ATCG.txt'); |
| 78 | + |
| 79 | + execute(inputFile.readline.bind(inputFile)); |
| 80 | + |
| 81 | + assert.strictEqual( |
| 82 | + console.log.getCall(0).args[0], |
| 83 | + 4 |
| 84 | + ); |
| 85 | + }); |
| 86 | + |
| 87 | + test('CCCTGACATGA', function() { |
| 88 | + let inputFile = new File('./test/training/hard/genomeSequencing/input/07 - CCCTGACATGA.txt'); |
| 89 | + |
| 90 | + execute(inputFile.readline.bind(inputFile)); |
| 91 | + |
| 92 | + assert.strictEqual( |
| 93 | + console.log.getCall(0).args[0], |
| 94 | + 11 |
| 95 | + ); |
| 96 | + }); |
| 97 | +}); |
0 commit comments