common-spec.js 830 B

1234567891011121314151617181920212223
  1. import * as glMatrix from "../../src/gl-matrix/common"
  2. describe("common", function(){
  3. let result;
  4. describe("toRadian", function(){
  5. beforeEach(function(){ result = glMatrix.toRadian(180); });
  6. it("should return a value of 3.141592654(Math.PI)", function(){ expect(result).toBeEqualish(Math.PI); });
  7. });
  8. describe("equals", function() {
  9. let r0, r1, r2;
  10. beforeEach(function() {
  11. r0 = glMatrix.equals(1.0, 0.0);
  12. r1 = glMatrix.equals(1.0, 1.0);
  13. r2 = glMatrix.equals(1.0+glMatrix.EPSILON/2, 1.0);
  14. });
  15. it("should return false for different numbers", function() { expect(r0).toBe(false); });
  16. it("should return true for the same number", function() { expect(r1).toBe(true); });
  17. it("should return true for numbers that are close", function() { expect(r2).toBe(true); });
  18. });
  19. });