| Total Complexity | 2 |
| Complexity/F | 1 |
| Lines of Code | 68 |
| Function Count | 2 |
| Duplicated Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | import { XnorTruthTable } from '../../src/TruthTable.mjs'; |
||
| 2 | |||
| 3 | const TestCasesResult = [ |
||
| 4 | { |
||
| 5 | description: '1 proposition', |
||
| 6 | input: 1, |
||
| 7 | expectedResult: [ |
||
| 8 | true, // 0 |
||
| 9 | false, // 1 |
||
| 10 | ], |
||
| 11 | }, |
||
| 12 | { |
||
| 13 | description: '2 propositions', |
||
| 14 | input: 2, |
||
| 15 | expectedResult: [ |
||
| 16 | true, // 00 |
||
| 17 | false, // 01 |
||
| 18 | false, // 10 |
||
| 19 | true, // 11 |
||
| 20 | ], |
||
| 21 | }, |
||
| 22 | { |
||
| 23 | description: '3 propositions', |
||
| 24 | input: 3, |
||
| 25 | expectedResult: [ |
||
| 26 | true, // 000 |
||
| 27 | false, // 001 |
||
| 28 | false, // 010 |
||
| 29 | true, // 011 |
||
| 30 | false, // 100 |
||
| 31 | true, // 101 |
||
| 32 | true, // 110 |
||
| 33 | false, // 111 |
||
| 34 | ], |
||
| 35 | }, |
||
| 36 | { |
||
| 37 | description: '4 propositions', |
||
| 38 | input: 4, |
||
| 39 | expectedResult: [ |
||
| 40 | true, // 0000 |
||
| 41 | false, // 0001 |
||
| 42 | false, // 0010 |
||
| 43 | true, // 0011 |
||
| 44 | false, // 0100 |
||
| 45 | true, // 0101 |
||
| 46 | true, // 0110 |
||
| 47 | false, // 0111 |
||
| 48 | false, // 1000 |
||
| 49 | true, // 1001 |
||
| 50 | true, // 1010 |
||
| 51 | false, // 1011 |
||
| 52 | true, // 1100 |
||
| 53 | false, // 1101 |
||
| 54 | false, // 1110 |
||
| 55 | true, // 1111 |
||
| 56 | ], |
||
| 57 | }, |
||
| 58 | ]; |
||
| 59 | |||
| 60 | describe.each(TestCasesResult)( |
||
| 61 | 'Test xnor', |
||
| 62 | ({ description, input, expectedResult }) => { |
||
| 63 | it(description, () => { |
||
| 64 | const table = XnorTruthTable.create(input); |
||
| 65 | expect(table.output).toMatchObject(expectedResult); |
||
| 66 | }); |
||
| 67 | } |
||
| 68 | ); |
||
| 69 |