This file contains hidden or 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
| % | |
| % store all necessary data to pass between validators in | |
| % #validator_state struct | |
| % | |
| run_checks(FunList, Data) -> | |
| run_checks(FunList, Data, #validator_state{}). | |
| % | |
| % evaluate validation chain | |
| % |
This file contains hidden or 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
| prop_encode_decode() -> | |
| ?FORALL(Int, integer(), | |
| begin Int =:= prop_encode_decode(Int) end). | |
| prop_encode_decode(Int) -> | |
| [{value, Ret}|_] = base64_vlq:decode(base64_vlq:encode(Int)), Ret. |
This file contains hidden or 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
| $ erl -pa ebin .eunit deps/*/ebin | |
| Erlang R16B03-1 (erts-5.10.4) [source] [64-bit] [smp:8:8] [async-threads:10] [hipe] [kernel-poll:false] [dtrace] | |
| Eshell V5.10.4 (abort with ^G) | |
| 1> c("src/base64_vlq"). | |
| {ok,base64_vlq} | |
| 2> c("test/base64_vlq_tests"). | |
| {ok,base64_vlq_tests} | |
| 3> proper:quickcheck(base64_vlq_tests:prop_encode_decode()). | |
| ..................................................................................! |
This file contains hidden or 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
| 4> c("src/base64_vlq"). | |
| {ok,base64_vlq} | |
| 5> proper:quickcheck(base64_vlq_tests:prop_encode_decode()). | |
| .................................................................................................... | |
| OK: Passed 100 test(s). | |
| true | |
| 6> proper:quickcheck(base64_vlq_tests:prop_encode_decode(), 1000). | |
| ...................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................... |
This file contains hidden or 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
| -spec encode(integer()) -> [1..255]. | |
| %% Wrapper for calling encode/2 | |
| encode(0) -> | |
| % TODO: maybe refactor encoding to handle "0" case in the recursive function | |
| "A"; | |
| encode(X) when X > 54 -> | |
| "E"; | |
| encode(Value) -> | |
| encode(to_vlq_signed_value(Value), []). |
This file contains hidden or 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
| -spec encode(integer()) -> [1..255]. | |
| %% Wrapper for calling encode/2 | |
| encode(0) -> | |
| % TODO: maybe refactor encoding to handle "0" case in the recursive function | |
| "A"; | |
| encode(Value) -> | |
| encode(to_vlq_signed_value(Value), []). |
This file contains hidden or 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
| test "Base64VLQ Encoding" do | |
| assert_equal "A", Base64VLQ.encode(0) | |
| assert_equal "wlB", Base64VLQ.encode(600) | |
| assert_equal "grC", Base64VLQ.encode(1200) | |
| assert_equal "gg9D", Base64VLQ.encode(64000) | |
| assert_equal "h49C", Base64VLQ.encode(-48000) | |
| # ad nauseam... | |
| end |
This file contains hidden or 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
| test "Base64VLQ Encoding" do | |
| property "is reflective with decode" do | |
| x = generate_integer() # needs to generate any negative or positive integer | |
| assert_equal(x, Base64VLQ.decode( Base64VLQ.encode(x))) | |
| end | |
| end |
This file contains hidden or 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
| 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 |
This file contains hidden or 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
| {WorkspaceView} = require 'atom' | |
| path = require 'path' | |
| ErlangBuildView = require '../lib/erlang-build-view' | |
| describe "ErlangBuildView", -> | |
| activationPromise = null | |
| beforeEach -> | |
| # Setup access to the current workspace |