Add more regression tests for OvaleTimeSpan.
Johnny C. Lam [11-10-13 - 00:30]
Add more regression tests for OvaleTimeSpan.
git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@1145 d5049fe3-3747-40f7-a4b5-f36d6801af5f
diff --git a/OvaleTimeSpan.lua b/OvaleTimeSpan.lua
index 3bd9f39..1f098b9 100644
--- a/OvaleTimeSpan.lua
+++ b/OvaleTimeSpan.lua
@@ -494,6 +494,34 @@ do
end
testFunction[#testFunction + 1] = function()
+ local A = OvaleTimeSpan(1, 2)
+ local B = OvaleTimeSpan(3, 4)
+ local expected = OvaleTimeSpan(1, 2, 3, 4)
+
+ local result = A:Union(B)
+ if not result:Equals(expected) then
+ print(string.format(" result: %s", tostring(result)))
+ print(string.format("expected: %s", tostring(expected)))
+ return false
+ end
+ return true
+ end
+
+ testFunction[#testFunction + 1] = function()
+ local A = OvaleTimeSpan(3, 4)
+ local B = OvaleTimeSpan(1, 2)
+ local expected = OvaleTimeSpan(1, 2, 3, 4)
+
+ local result = A:Union(B)
+ if not result:Equals(expected) then
+ print(string.format(" result: %s", tostring(result)))
+ print(string.format("expected: %s", tostring(expected)))
+ return false
+ end
+ return true
+ end
+
+ testFunction[#testFunction + 1] = function()
local A = OvaleTimeSpan(1, 2, 3, 4)
local B = OvaleTimeSpan(2, 3, 4, 5)
local expected = OvaleTimeSpan(1, 5)