Skip to content

Commit

Permalink
Testing negate and vectors that differ by Factors
Browse files Browse the repository at this point in the history
  • Loading branch information
user01 committed Oct 28, 2016
1 parent 70bd7f9 commit 4e6f7c2
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/vector-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,22 @@ describe('Vector', () => {
var v2A = new Vector.Vector2(5, 10);
Vector.Vector2.EqualStatic(v2, v2A).should.be.exactly(true);
v2.Equal(v2A).should.be.exactly(true);

var v2 = new Vector.Vector2(5, 11);
var v2A = new Vector.Vector2(5, 10);
Vector.Vector2.EqualStatic(v2, v2A).should.be.exactly(false);
v2.Equal(v2A).should.be.exactly(false);

var v2 = new Vector.Vector2(5, 11);
var v3A = new Vector.Vector3(5, 10, 4);
Vector.Vector2.EqualStatic(v2, v3A).should.be.exactly(false);
v2.Equal(v3A).should.be.exactly(false);

var v2 = new Vector.Vector2(5, 10, Ramp.Factor.PermanentFactor(3));
var v2B = new Vector.Vector2(5, 10, Ramp.Factor.PermanentFactor(4));
Vector.Vector2.EqualStatic(v2, v2B).should.be.exactly(false);
v2.Equal(v2B).should.be.exactly(false);

});
describe('Distance', () => {
it('Simple static', () => {
Expand All @@ -61,6 +73,12 @@ describe('Vector', () => {
var distance = v2A.DistanceTo(v2B);
distance.should.be.exactly(10);
});
it('Negate', () => {
var v2 = new Vector.Vector2(10, 0);
var v2invert = new Vector.Vector2(-10, 0);
var invert = Vector.VectorBase.Negate(v2);
invert.Equal(v2invert).should.be.true;
});
it('Complex', () => {
var v2A = new Vector.Vector2(-10, -10);
var v2B = new Vector.Vector2(10, 10);
Expand Down

0 comments on commit 4e6f7c2

Please sign in to comment.