'use strict';

var algebra = require('../lib/algebra.js');

describe('Matrix', function () {
    describe('#Creation', function () {

        it('should use the provided array as a buffer', function () {
            var a = [1,2,3,4];
            var m = new algebra.Matrix([2,2], a);
            m.array.should.equal(a);
        });
            
        it('should copy the size property', function () {
            var size = [2,4];
            var m = new algebra.Matrix(size);
            m.size.should.not.equal(size);
        });

        it('should have the correct size', function () {
            var size = [2,4];
            var m = new algebra.Matrix(size);
            m.size.should.eql(size);
        });
    });
});

@@ -720,12 +720,2017 @@
     %7D);%0A
+%0A    describe('#identity', function () %7B%0A%0A        it('should default to square matrix', function ()%7B%0A            var size = 3;%0A            var m = new algebra.identity(size);%0A            m.size.should.eql(%5Bsize,size%5D);%0A        %7D);%0A%0A        it('should make the correct size', function ()%7B%0A            var size = %5B3,3%5D;%0A            var m = new algebra.identity(size);%0A            m.size.should.eql(size);%0A        %7D);%0A%0A        it('should return an identity matrix', function () %7B%0A            var a = %5B1,0,0,0,1,0,0,0,1%5D; //3x3 identity array%0A            var m = new algebra.identity(%5B3,3%5D);%0A            m.array.should.eql(a);%0A        %7D);%0A%0A        it('should make a rectangular matrix if asked for', function ()%7B%0A            var size = %5B2,4%5D;%0A            var m = new algebra.identity(size);%0A            m.size.should.eql(size);%0A        %7D);%0A%0A        it('should have ones on the diagonal in rectangular case', function () %7B%0A            var size = %5B3,4%5D;%0A            var a = %5B1,0,0,0, 0,1,0,0, 0,0,1,0%5D; //in row-major format%0A            var m = new algebra.identity(size);%0A            m.array.should.eql(a);%0A        %7D);%0A    %7D);%0A%0A    describe('#multiply', function () %7B%0A%0A        var A = new algebra.Matrix(%5B3,3%5D,%5B1,2,3,4,5,6,7,8,9%5D);%0A        var B = new algebra.Matrix(%5B3,1%5D,%5B2,1,3%5D);%0A        var AB = new algebra.Matrix(%5B3,1%5D,%5B13,31,49%5D);        %0A%0A        it('should work with right-identity', function () %7B%0A            var I = algebra.identity(A.size);%0A            A.multiply(I).should.eql(A);%0A        %7D);%0A        %0A        it('should work with left-identity', function () %7B%0A            var I = algebra.identity(A.size);%0A            I.multiply(A).should.eql(A);%0A        %7D);%0A%0A        it('should give the right answer', function () %7B%0A            A.multiply(B).should.eql(AB);%0A        %7D);%0A%0A        it('should have the correct size', function () %7B%0A            var M = new algebra.Matrix(%5B4,10%5D);%0A            var N = new algebra.Matrix(%5B10,2%5D);%0A            M.multiply(N).size.should.eql(%5B4,2%5D);%0A        %7D);%0A    %7D);%0A%0A
 %7D);%0A

Add more tests for algebra