mirror of
https://github.com/sbrl/Minetest-WorldEditAdditions.git
synced 2024-08-20 21:44:06 +02:00
38 lines
804 B
Lua
38 lines
804 B
Lua
local Vector3 = require("worldeditadditions.utils.vector3")
|
|
|
|
local function format_map(map)
|
|
local result = {}
|
|
for key, value in pairs(map) do
|
|
table.insert(result, key.."\t"..tostring(value))
|
|
end
|
|
return table.concat(result, "\n")
|
|
end
|
|
|
|
|
|
describe("Vector3.sqrt", function()
|
|
it("should sqrt a positive vector", function()
|
|
local a = Vector3.new(16, 64, 16)
|
|
assert.are.same(
|
|
Vector3.new(4, 8, 4),
|
|
a:sqrt()
|
|
)
|
|
end)
|
|
it("should sqrt another positive vector", function()
|
|
local a = Vector3.new(9, 16, 25)
|
|
assert.are.same(
|
|
Vector3.new(3, 4, 5),
|
|
a:sqrt()
|
|
)
|
|
end)
|
|
it("should return a new Vector3 instance", function()
|
|
local a = Vector3.new(9, 16, 25)
|
|
|
|
local result = a:sqrt()
|
|
assert.are.same(
|
|
Vector3.new(3, 4, 5),
|
|
result
|
|
)
|
|
assert.are_not.equal(result, a)
|
|
end)
|
|
end)
|