Created
July 25, 2012 15:14
-
-
Save silentbicycle/3176702 to your computer and use it in GitHub Desktop.
tests for 0-escaping
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
function test_encoding_two_zeroes() | |
-- this should be {0, 2, 0}, not {0, 0, 0, 0}, to keep | |
-- encoding from filling up with too many escapes. | |
local ints = {0, 0} | |
local res = rle.encode(ints) | |
local expected = {0, 2, 0} | |
for i=1,#expected do | |
assert_equal(expected[i], res[i]) | |
end | |
end | |
function test_encoding_000122() | |
-- previously, the 1 after the 0s was dropped. | |
local ints = {0, 0, 0, 1, 2, 2} | |
local res = rle.encode(ints) | |
local expected = {0, 3, 0, 1, 2, 2} | |
for i=1,#expected do | |
assert_equal(expected[i], res[i]) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment