Minetest-WorldEditAdditions/.tests/Vector3/clone.test.lua

21 lines
606 B
Lua
Raw Normal View History

2022-09-19 00:18:48 +00:00
local Vector3 = require("worldeditadditions_core.utils.vector3")
2021-06-26 14:23:16 +00:00
describe("Vector3.clone", function()
it("should return a new Vector3 instance", function()
local a = Vector3.new(3, 4, 5)
local result = a:clone()
2021-06-26 15:28:39 +00:00
result.x = 4
assert.are.same(Vector3.new(3, 4, 5), a)
assert.are.same(Vector3.new(4, 4, 5), result)
2021-06-26 14:23:16 +00:00
end)
it("should return a new Vector3 instance for a different vector", function()
local a = Vector3.new(-99, 66, 88)
local result = a:clone()
2021-06-26 15:28:39 +00:00
result.y = -44
assert.are.same(Vector3.new(-99, 66, 88), a)
assert.are.same(Vector3.new(-99, -44, 88), result)
2021-06-26 14:23:16 +00:00
end)
end)