Created
July 25, 2012 15:09
-
-
Save silentbicycle/3176672 to your computer and use it in GitHub Desktop.
tests for known input
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_basic_encoding_for_known_case() | |
local ints = {1, 0, 2, 2, 2, 2, 2, 2, 3, 3, 3, 4} | |
local res = rle.encode(ints) | |
local expected = {1, 0, 0, 0, 6, 2, 3, 3, 3, 4} | |
for i=1,#expected do | |
assert_equal(expected[i], res[i]) | |
end | |
end | |
function test_basic_decoding_for_known_case() | |
local packed = {1, 0, 0, 0, 6, 2, 3, 3, 3, 4} | |
local expected = {1, 0, 2, 2, 2, 2, 2, 2, 3, 3, 3, 4} | |
local res = rle.decode(packed) | |
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