-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
43 changed files
with
510 additions
and
501 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
local function assert_colors_equal(c1, c2) | ||
if type(c1) == "table" and type(c2) == "table" then | ||
assert(c1.r == c2.r and c1.g == c2.g and c1.b == c2.b and c1.a == c2.a) | ||
else | ||
assert(c1 == c2) | ||
end | ||
if type(c1) == "table" and type(c2) == "table" then | ||
assert(c1.r == c2.r and c1.g == c2.g and c1.b == c2.b and c1.a == c2.a) | ||
else | ||
assert(c1 == c2) | ||
end | ||
end | ||
|
||
local function test_color_conversion() | ||
assert_colors_equal(core.colorspec_to_table("#fff"), {r = 255, g = 255, b = 255, a = 255}) | ||
assert_colors_equal(core.colorspec_to_table(0xFF00FF00), {r = 0, g = 255, b = 0, a = 255}) | ||
assert_colors_equal(core.colorspec_to_table("#00000000"), {r = 0, g = 0, b = 0, a = 0}) | ||
assert_colors_equal(core.colorspec_to_table("green"), {r = 0, g = 128, b = 0, a = 255}) | ||
assert_colors_equal(core.colorspec_to_table("gren"), nil) | ||
assert_colors_equal(core.colorspec_to_table("#fff"), {r = 255, g = 255, b = 255, a = 255}) | ||
assert_colors_equal(core.colorspec_to_table(0xFF00FF00), {r = 0, g = 255, b = 0, a = 255}) | ||
assert_colors_equal(core.colorspec_to_table("#00000000"), {r = 0, g = 0, b = 0, a = 0}) | ||
assert_colors_equal(core.colorspec_to_table("green"), {r = 0, g = 128, b = 0, a = 255}) | ||
assert_colors_equal(core.colorspec_to_table("gren"), nil) | ||
end | ||
|
||
unittests.register("test_color_conversion", test_color_conversion) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
|
||
unittests.register("test_get_version", function() | ||
local version = core.get_version() | ||
assert(type(version) == "table") | ||
assert(type(version.project) == "string") | ||
assert(type(version.string) == "string") | ||
assert(type(version.proto_min) == "number") | ||
assert(type(version.proto_max) == "number") | ||
assert(version.proto_max >= version.proto_min) | ||
assert(type(version.is_dev) == "boolean") | ||
if version.is_dev then | ||
assert(type(version.hash) == "string") | ||
else | ||
assert(version.hash == nil) | ||
end | ||
local version = core.get_version() | ||
assert(type(version) == "table") | ||
assert(type(version.project) == "string") | ||
assert(type(version.string) == "string") | ||
assert(type(version.proto_min) == "number") | ||
assert(type(version.proto_max) == "number") | ||
assert(version.proto_max >= version.proto_min) | ||
assert(type(version.is_dev) == "boolean") | ||
if version.is_dev then | ||
assert(type(version.hash) == "string") | ||
else | ||
assert(version.hash == nil) | ||
end | ||
end) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.