| Total Complexity | 2 |
| Complexity/F | 1 |
| Lines of Code | 51 |
| Function Count | 2 |
| Duplicated Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | import { XandTruthTable } from '../../src/TruthTable.mjs'; |
||
| 2 | |||
| 3 | const TestCasesResult = [ |
||
| 4 | { |
||
| 5 | description: '1 proposition', |
||
| 6 | input: 1, |
||
| 7 | expectedResult: [true, true], |
||
| 8 | }, |
||
| 9 | { |
||
| 10 | description: '2 propositions', |
||
| 11 | input: 2, |
||
| 12 | expectedResult: [true, false, false, true], |
||
| 13 | }, |
||
| 14 | { |
||
| 15 | description: '3 propositions', |
||
| 16 | input: 3, |
||
| 17 | expectedResult: [true, false, false, false, false, false, false, true], |
||
| 18 | }, |
||
| 19 | { |
||
| 20 | description: '4 propositions', |
||
| 21 | input: 4, |
||
| 22 | expectedResult: [ |
||
| 23 | true, |
||
| 24 | false, |
||
| 25 | false, |
||
| 26 | false, |
||
| 27 | false, |
||
| 28 | false, |
||
| 29 | false, |
||
| 30 | false, |
||
| 31 | false, |
||
| 32 | false, |
||
| 33 | false, |
||
| 34 | false, |
||
| 35 | false, |
||
| 36 | false, |
||
| 37 | false, |
||
| 38 | true, |
||
| 39 | ], |
||
| 40 | }, |
||
| 41 | ]; |
||
| 42 | |||
| 43 | describe.each(TestCasesResult)( |
||
| 44 | 'Test xand', |
||
| 45 | ({ description, input, expectedResult }) => { |
||
| 46 | it(description, () => { |
||
| 47 | const table = XandTruthTable.create(input); |
||
| 48 | expect(table.output).toMatchObject(expectedResult); |
||
| 49 | }); |
||
| 50 | } |
||
| 51 | ); |
||
| 52 |