'use strict';

let expect         = require('chai').expect;
let createComputer = require('../src/calc').createComputer;

describe('createComputer', () => {

    context('general', () => {

        it('should return a function', () => {

            let compute = createComputer({ a: 1, b: 1 }, 'a + b');
            expect(typeof compute).to.equal('function');

        });
    });

    context('addition', () => {

        it('should compute a + b', () => {

            let compute = createComputer({ a: 1, b: 1 }, 'a + b');
            expect(compute()).to.equal(2);

        });

        it('should compute a + b after a change to a', () => {

            let obj = { a: 1, b: 1 };
            let compute = createComputer(obj, 'a + b');
            expect(compute()).to.equal(2);

            obj.a = 2;
            expect(compute()).to.equal(3);

        });

        it('should compute a + b after a change to b', () => {

            let obj = { a: 1, b: 1 };
            let compute = createComputer(obj, 'a + b');
            expect(compute()).to.equal(2);

            obj.b = 2;
            expect(compute()).to.equal(3);

        });

        it('should compute a + b after a change to a and b', () => {

            let obj = { a: 1, b: 1 };
            let compute = createComputer(obj, 'a + b');
            expect(compute()).to.equal(2);

            obj.a = 2;
            obj.b = 2;
            expect(compute()).to.equal(4);

        });
    });

    context('subtraction', () => {

    });

    context('multiplication', () => {

    });

    context('division', () => {

    });

    context('modulo', () => {

    });

    context('order of operations', () => {

    });

});
@@ -1488,32 +1488,1076 @@
 tion', () =%3E %7B%0A%0A
+        it('should compute a - b', () =%3E %7B%0A%0A            let compute = createComputer(%7B a: 1, b: 1 %7D, 'a - b');%0A            expect(compute()).to.equal(0);%0A%0A        %7D);%0A%0A        it('should compute a - b after a change to a', () =%3E %7B%0A%0A            let obj = %7B a: 1, b: 1 %7D;%0A            let compute = createComputer(obj, 'a - b');%0A            expect(compute()).to.equal(0);%0A%0A            obj.a = 2;%0A            expect(compute()).to.equal(1);%0A%0A        %7D);%0A%0A        it('should compute a - b after a change to b', () =%3E %7B%0A%0A            let obj = %7B a: 1, b: 1 %7D;%0A            let compute = createComputer(obj, 'a - b');%0A            expect(compute()).to.equal(0);%0A%0A            obj.b = 2;%0A            expect(compute()).to.equal(-1);%0A%0A        %7D);%0A%0A        it('should compute a - b after a change to a and b', () =%3E %7B%0A%0A            let obj = %7B a: 1, b: 1 %7D;%0A            let compute = createComputer(obj, 'a - b');%0A            expect(compute()).to.equal(0);%0A%0A            obj.a = 3;%0A            obj.b = 2;%0A            expect(compute()).to.equal(1);%0A%0A        %7D);%0A%0A
     %7D);%0A%0A    con

Add basic computer subtraction tests.