UNPKG

573 BJavaScriptView Raw
1'use strict';
2
3var expect = require('chai').expect;
4var LinearKernel = require('./linear.js');
5
6describe('Kernel.LinearKernel', function () {
7 describe('.apply', function () {
8 it('should calculate the dot product of two input vectors', function () {
9 expect(new LinearKernel().apply([1, 2, 3], [4, 5, 6])).to.equal(32);
10 expect(new LinearKernel().apply([1, 2, 3], [4, 5, 0])).to.equal(14);
11 expect(new LinearKernel().apply([1, 2, 0], [4, 5, 6])).to.equal(14);
12 expect(new LinearKernel().apply([1, 2, -3], [4, 5, 6])).to.equal(-4);
13 });
14 });
15});
\No newline at end of file