add specs

This commit is contained in:
BONNAURE Olivier 2024-04-09 17:39:26 +02:00
parent 41d7ef9569
commit b605af00be

View file

@ -0,0 +1,23 @@
-- Copyright 2022 Justine Alexandra Roberts Tunney
--
-- Permission to use, copy, modify, and/or distribute this software for
-- any purpose with or without fee is hereby granted, provided that the
-- above copyright notice and this permission notice appear in all copies.
--
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
-- WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
-- WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
-- AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
-- DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
-- PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
-- TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-- PERFORMANCE OF THIS SOFTWARE.
assert(#UuidV4() == 36)
assert(string.sub(UuidV4(), 9, 9) == "-")
assert(string.sub(UuidV4(), 14, 14) == "-")
assert(string.sub(UuidV4(), 15, 15) == "4")
assert(string.sub(UuidV4(), 19, 19) == "-")
local y = string.sub(UuidV4(), 20, 20)
assert(y == "8" or y == "9" or y == "a" or y == "b")
assert(string.sub(UuidV4(), 24, 24) == "-")