diff options
author | Loïc Hoguin <[email protected]> | 2014-12-14 23:22:07 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2014-12-14 23:23:59 +0200 |
commit | 986a0786edbcba8c2260161a1a1602ced040d548 (patch) | |
tree | 4932b01cba32f30d384507673b7b55de1f8a52f7 /src | |
parent | 67713340e32d9afd76dd224df9eb6d1954cc8cd2 (diff) | |
download | cowlib-986a0786edbcba8c2260161a1a1602ced040d548.tar.gz cowlib-986a0786edbcba8c2260161a1a1602ced040d548.tar.bz2 cowlib-986a0786edbcba8c2260161a1a1602ced040d548.zip |
Add a property for parse_content_length/1
Diffstat (limited to 'src')
-rw-r--r-- | src/cow_http_hd.erl | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/cow_http_hd.erl b/src/cow_http_hd.erl index 895f88d..668b80d 100644 --- a/src/cow_http_hd.erl +++ b/src/cow_http_hd.erl @@ -29,6 +29,10 @@ -include("cow_inline.hrl"). +-ifdef(TEST). +-include_lib("triq/include/triq.hrl"). +-endif. + %% @doc Parse the Accept header. -spec parse_accept(binary()) -> [{{binary(), binary(), [{binary(), binary()}]}, qvalue(), [binary() | {binary(), binary()}]}]. @@ -523,6 +527,13 @@ parse_content_length(<< $8, R/bits >>) -> number(R, 8); parse_content_length(<< $9, R/bits >>) -> number(R, 9). -ifdef(TEST). +prop_parse_content_length() -> + ?FORALL( + X, + non_neg_integer(), + X =:= parse_content_length(integer_to_binary(X)) + ). + parse_content_length_test_() -> Tests = [ {<<"0">>, 0}, |