summaryrefslogtreecommitdiff
path: root/test/unit_tests/binaryConverter.test.js
blob: b6fb5035a0f5b533c8f017d279894a51cee306fb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
const BinaryConverter = require('../../src/binaryConverter');
const math = require('mathjs');

//import BinaryConverter from 'binaryConverter';

describe('Test BinaryConversion module', () => {
    
    let testConverter;
    let testVector;
    let testInteger;

    beforeEach(() => {
        testConverter = new BinaryConverter(2);
        testInteger = 2;
        testVector = math.matrix([1, 0]);
    });


    test('convert integer to binary array', () => {
        testConverter.integer = testInteger;
        expect(testConverter.inputActivation).toEqual(testVector);
    });

    test('convert binary array to integer', () => {
        testConverter.inputActivation = testVector;
        expect(testConverter.integer).toEqual(testInteger);
    });

    test.todo('Random array initializes correct integer');

});