Merge pull request #47 from mcclure/master-test-failures
Fix failing tests
This commit is contained in:
commit
86f0056397
@ -167,7 +167,9 @@ function bound2_mt.__call(_, a, b)
|
||||
end
|
||||
|
||||
if status then
|
||||
ffi.metatype(new, bound2_mt)
|
||||
xpcall(function() -- Allow this to silently fail; assume failure means someone messed with package.loaded
|
||||
ffi.metatype(new, bound2_mt)
|
||||
end, function() end)
|
||||
end
|
||||
|
||||
return setmetatable({}, bound2_mt)
|
||||
|
@ -167,7 +167,9 @@ function bound3_mt.__call(_, a, b)
|
||||
end
|
||||
|
||||
if status then
|
||||
ffi.metatype(new, bound3_mt)
|
||||
xpcall(function() -- Allow this to silently fail; assume failure means someone messed with package.loaded
|
||||
ffi.metatype(new, bound3_mt)
|
||||
end, function() end)
|
||||
end
|
||||
|
||||
return setmetatable({}, bound3_mt)
|
||||
|
@ -542,10 +542,10 @@ function mat4.look_at(out, a, eye, look_at, up)
|
||||
out[10] = y_axis.z
|
||||
out[11] = z_axis.z
|
||||
out[12] = 0
|
||||
out[13] = 0
|
||||
out[14] = 0
|
||||
out[15] = 0
|
||||
out[16] = 1
|
||||
out[13] = -out[ 1]*eye.x - out[4+1]*eye.y - out[8+1]*eye.z
|
||||
out[14] = -out[ 2]*eye.x - out[4+2]*eye.y - out[8+2]*eye.z
|
||||
out[15] = -out[ 3]*eye.x - out[4+3]*eye.y - out[8+3]*eye.z
|
||||
out[16] = -out[ 4]*eye.x - out[4+4]*eye.y - out[8+4]*eye.z + 1
|
||||
|
||||
return out
|
||||
end
|
||||
@ -853,7 +853,9 @@ function mat4_mt.__mul(a, b)
|
||||
end
|
||||
|
||||
if status then
|
||||
ffi.metatype(new, mat4_mt)
|
||||
xpcall(function() -- Allow this to silently fail; assume failure means someone messed with package.loaded
|
||||
ffi.metatype(new, mat4_mt)
|
||||
end, function() end)
|
||||
end
|
||||
|
||||
return setmetatable({}, mat4_mt)
|
||||
|
@ -465,7 +465,9 @@ function quat_mt.__pow(a, n)
|
||||
end
|
||||
|
||||
if status then
|
||||
ffi.metatype(new, quat_mt)
|
||||
xpcall(function() -- Allow this to silently fail; assume failure means someone messed with package.loaded
|
||||
ffi.metatype(new, quat_mt)
|
||||
end, function() end)
|
||||
end
|
||||
|
||||
return setmetatable({}, quat_mt)
|
||||
|
@ -381,7 +381,9 @@ function vec2_mt.__div(a, b)
|
||||
end
|
||||
|
||||
if status then
|
||||
ffi.metatype(new, vec2_mt)
|
||||
xpcall(function() -- Allow this to silently fail; assume failure means someone messed with package.loaded
|
||||
ffi.metatype(new, vec2_mt)
|
||||
end, function() end)
|
||||
end
|
||||
|
||||
return setmetatable({}, vec2_mt)
|
||||
|
@ -361,7 +361,9 @@ function vec3_mt.__div(a, b)
|
||||
end
|
||||
|
||||
if status then
|
||||
ffi.metatype(new, vec3_mt)
|
||||
xpcall(function() -- Allow this to silently fail; assume failure means someone messed with package.loaded
|
||||
ffi.metatype(new, vec3_mt)
|
||||
end, function() end)
|
||||
end
|
||||
|
||||
return setmetatable({}, vec3_mt)
|
||||
|
@ -38,7 +38,7 @@ describe("bound2:", function()
|
||||
it("clones a bound2", function()
|
||||
local a = bound2(vec2(1,2), vec2(4,5))
|
||||
local b = a:clone()
|
||||
a.max = new vec2(9,9)
|
||||
a.max = vec2.new(9,9)
|
||||
assert.is.equal(a.min, b.min)
|
||||
assert.is.not_equal(a.max, b.max)
|
||||
end)
|
||||
@ -162,13 +162,13 @@ describe("bound2:", function()
|
||||
it("tests for points inside bound2", function()
|
||||
local a = bound2(vec2(1,2), vec2(4,5))
|
||||
|
||||
assert.is_true(a:contains(vec2(1,2)))
|
||||
assert.is_true(a:contains(vec2(4,5)))
|
||||
assert.is_true(a:contains(vec2(2,3)))
|
||||
assert.is_not_true(a:contains(vec2(0,3)))
|
||||
assert.is_not_true(a:contains(vec2(5,3)))
|
||||
assert.is_not_true(a:contains(vec2(2,1)))
|
||||
assert.is_not_true(a:contains(vec2(2,6)))
|
||||
assert.is_not_true(a:contains(vec2(2,3)))
|
||||
assert.is_not_true(a:contains(vec2(2,3)))
|
||||
end)
|
||||
|
||||
it("checks for bound2.zero", function()
|
||||
|
@ -46,7 +46,7 @@ describe("bound3:", function()
|
||||
it("clones a bound3", function()
|
||||
local a = bound3(vec3(1,2,3), vec3(4,5,6))
|
||||
local b = a:clone()
|
||||
a.max = new vec3(9,9,9)
|
||||
a.max = vec3.new(9,9,9)
|
||||
assert.is.equal(a.min, b.min)
|
||||
assert.is.not_equal(a.max, b.max)
|
||||
end)
|
||||
@ -199,6 +199,8 @@ describe("bound3:", function()
|
||||
it("tests for points inside bound3", function()
|
||||
local a = bound3(vec3(1,2,3), vec3(4,5,6))
|
||||
|
||||
assert.is_true(a:contains(vec3(1,2,3)))
|
||||
assert.is_true(a:contains(vec3(4,5,6)))
|
||||
assert.is_true(a:contains(vec3(2,3,4)))
|
||||
assert.is_not_true(a:contains(vec3(0,3,4)))
|
||||
assert.is_not_true(a:contains(vec3(5,3,4)))
|
||||
|
@ -172,8 +172,8 @@ describe("vec2:", function()
|
||||
local a = vec2(3, 5)
|
||||
local r, t = a:to_polar()
|
||||
local b = vec2.from_cartesian(r, t)
|
||||
assert.is.equal(a.x, b.x)
|
||||
assert.is.equal(a.y, b.y)
|
||||
assert.is_true(abs(a.x - b.x) <= DBL_EPSILON*2) -- Allow 2X epsilon error because there were 2 operations.
|
||||
assert.is_true(abs(a.y - b.y) <= DBL_EPSILON*2)
|
||||
end)
|
||||
|
||||
it("gets a perpendicular vector", function()
|
||||
|
Loading…
x
Reference in New Issue
Block a user