Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add tests for vec3.subtract

  • Loading branch information...
commit 1617dc681f89c587692c990cf968aabab6324361 1 parent d26993c
@sinisterchipmunk sinisterchipmunk authored
Showing with 21 additions and 0 deletions.
  1. +21 −0 spec/javascripts/vec3_spec.js
View
21 spec/javascripts/vec3_spec.js
@@ -59,4 +59,25 @@ describe("vec3", function() {
});
});
});
+
+ describe("subtract", function() {
+ beforeEach(function() { vec = vec3.create([1,2,3]); });
+
+ it('should modify original vector if dest not given', function() {
+ vec3.subtract(vec, [3, 4, 5]);
+ expect(vec).toBeEqualish([-2,-2,-2]);
+ });
+
+ it("should modify original vector if dest is original vector", function() {
+ vec3.subtract(vec, [3,4,5], vec);
+ expect(vec).toBeEqualish([-2,-2,-2]);
+ });
+
+ describe("if dest vector given", function() {
+ beforeEach(function() { vec3.subtract(vec, [3,4,5], dest = vec3.create()) });
+
+ it("should not modify original vector", function() { expect(vec).toBeEqualish([3,4,5]); });
+ it("should modify dest vector", function() { expect(dest).toBeEqualish([-2,-2,-2]); });
+ });
+ });
});
Please sign in to comment.
Something went wrong with that request. Please try again.