{"size": 604, "ext": "js", "max_stars_repo_path": "test/vector.test.js", "max_stars_repo_name": "bjnortier/qhull", "max_stars_repo_stars_event_min_datetime": "2015-03-12T16:32:13.000Z", "max_stars_repo_stars_event_max_datetime": "2020-12-25T17:57:43.000Z", "max_issues_repo_path": "test/vector.test.js", "max_issues_repo_name": "bjnortier/qhull", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "test/vector.test.js", "max_forks_repo_name": "bjnortier/qhull", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 4, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 22.3703703704, "max_line_length": 45, "alphanum_fraction": 0.5662251656}
var chai = require('chai');
var assert = chai.assert;

var Vector = require('../lib/vector');

describe('Vector', function() {

  it('can be created', function() {
    var a = new Vector(1,2,3);
    assert.equal(a.x, 1);
    assert.equal(a.y, 2);
    assert.equal(a.z, 3);
  });

  it('has a distance to a line', function() {
    var a = new Vector(0,0,-10);
    var b = new Vector(0,0,10);
    var p = new Vector(10,0,0);
    assert.equal(p.distanceToLine(a,b), 10);

    a = new Vector(0,0,0);
    b = new Vector(1,1,0);
    p = new Vector(5,5,7);
    assert.equal(p.distanceToLine(a,b), 7);
  });

});