Skip to content

Instantly share code, notes, and snippets.

@spiegela
Last active August 29, 2015 13:58
Show Gist options
  • Save spiegela/9992894 to your computer and use it in GitHub Desktop.
Save spiegela/9992894 to your computer and use it in GitHub Desktop.
prop_encode_decode() ->
?FORALL(Int, integer(),
begin
?assertEqual(Int, prop_encode_decode(Int))
end).
prop_encode_decode(Int) ->
EncInt = base64_vlq:encode(Int),
DecIntWrapped = base64_vlq:decode(EncInt), % for my decoder, the value comes back wrapped
DecInt = lists:keyfind(value, 1, DecIntWrapped), % in a property list, so we have couple of
DecInt. % lines to pull out just the decoded value.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment