1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-04-22 18:53:16 +00:00

Add tests for colors.fromBlit

This commit is contained in:
Erlend 2023-05-17 14:43:08 +02:00
parent 722b870f98
commit 090d17c528

View File

@ -93,4 +93,18 @@ describe("The colors library", function()
expect(colors.toBlit(16385)):eq("e")
end)
end)
describe("colors.fromBlit", function()
it("validates arguments", function()
expect.error(colors.fromBlit, nil):eq("bad argument #1 (string expected, got nil)")
expect(colors.fromBlit("")):eq(nil)
expect(colors.fromBlit("not hex")):eq(nil)
end)
it("converts all colors", function()
for i = 0, 15 do
expect(colors.fromBlit(string.format("%x", i))):eq(2 ^ i)
end
end)
end)
end)