aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorLaria Carolin Chabowski <laria@laria.me>2019-04-02 21:43:25 +0200
committerLaria Carolin Chabowski <laria@laria.me>2019-04-02 22:32:45 +0200
commita121cef86fcf7b3f4e3a8f067a68795da14de72c (patch)
tree2b38370fe9879462bd44a62e116592a618f43cbb /test
parent92be31204cc713afa0fe584ac86a8466ecce9ba9 (diff)
downloadlua_uuid-a121cef86fcf7b3f4e3a8f067a68795da14de72c.tar.gz
lua_uuid-a121cef86fcf7b3f4e3a8f067a68795da14de72c.tar.bz2
lua_uuid-a121cef86fcf7b3f4e3a8f067a68795da14de72c.zip
Expose additional libuuid functionsHEADmaster
Diffstat (limited to 'test')
-rwxr-xr-xtest/lua_uuid_test.lua25
1 files changed, 20 insertions, 5 deletions
diff --git a/test/lua_uuid_test.lua b/test/lua_uuid_test.lua
index 19ebf67..3406d56 100755
--- a/test/lua_uuid_test.lua
+++ b/test/lua_uuid_test.lua
@@ -2,10 +2,25 @@ package.path = package.path..";./?.lua"
local uuid = require "lua_uuid"
-assert(type(uuid) == "function")
+assert(type(uuid) == "table")
-local first = uuid()
-local second = uuid()
+local function test_generator(gen)
+ local first = gen()
+ local second = gen()
-assert(first ~= second)
-assert(type(uuid()) == "string")
+ assert(first ~= second)
+ assert(type(gen()) == "string")
+end
+
+test_generator(uuid)
+test_generator(uuid.generate)
+test_generator(uuid.generate_binary)
+
+local hexuuid = "cf08a9b2-3492-4b71-9bd9-eb12d9f463a6"
+local binuuid = "\207\008\169\178\052\146\075\113\155\217\235\018\217\244\099\166"
+
+assert(assert(uuid.parse(hexuuid)) == binuuid)
+assert(assert(uuid.unparse(binuuid)) == hexuuid)
+
+assert(uuid.parse("foobar") == nil)
+assert(uuid.unparse("foobar") == nil)