diff options
author | Guido Günther <agx@sigxcpu.org> | 2013-10-29 14:32:43 +0100 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2013-10-30 16:37:59 +0100 |
commit | 6af72ef686ecc1c29c18bd0cbfbdd91e4ade9b26 (patch) | |
tree | c210a173d70fc6f1bdff0e4e1e878b1e58b4967d /test |
Diffstat (limited to 'test')
-rw-r--r-- | test/guid_test.erl | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/test/guid_test.erl b/test/guid_test.erl new file mode 100644 index 0000000..d98c853 --- /dev/null +++ b/test/guid_test.erl @@ -0,0 +1,29 @@ +-module(guid_test). +-include_lib("eunit/include/eunit.hrl"). + +% Test descriptions +v4_test_() -> + [{"A v4 uuid must have version 4", + check_v4_version()}, + {"A uuid must be 16 bytes", + check_v4_length()} + ]. + +text_test_() -> + [{"The text representation must be 38 characters long", + check_v4_string_length()} + ]. + +% Tests +check_v4_version() -> + Uuid = guid:v4(), + [?_assertEqual(guid:version(Uuid), 4)]. + + +check_v4_length() -> + Uuid = guid:v4(), + [?_assertEqual(byte_size(Uuid), 16)]. + +check_v4_string_length() -> + String = guid:v4string(), + [?_assertEqual(length(String), 36)]. |