Skip to content

Commit c2c6107

Browse files
committed
added basic tests for ns_crypto::uuid
1 parent e3b2e44 commit c2c6107

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

tests/ns_crypto.test

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,16 @@ tcltest::testConstraint argon2 [expr {![catch {::ns_crypto::argon2 -variant ARGO
1616

1717

1818
#######################################################################################
19-
# Syntax tests no covered below
19+
# Syntax tests not covered below
2020
#######################################################################################
2121
test ns_crypto::randombytes-1.0 {syntax: ns_crypto::randombytes} -body {
2222
ns_crypto::randombytes
2323
} -returnCodes error -result {wrong # args: should be "ns_crypto::randombytes ?-encoding hex|base64url|base64|binary? /nrbytes[1,MAX]/"}
2424

25+
test ns_crypto::uuid-1.0 {syntax: ns_crypto::uuid} -body {
26+
ns_crypto::uuid -
27+
} -returnCodes error -result {wrong # args: should be "ns_crypto::uuid ?-version v4|v7?"}
28+
2529

2630
#######################################################################################
2731
# Message digests: sha1, sha224, sha256, sha512
@@ -770,6 +774,16 @@ test ns_crypto::eckey-1.6 {syntax: ns_crypto::eckey sharedsecret} -body {
770774
ns_crypto::eckey sharedsecret
771775
} -returnCodes error -result {wrong # args: should be "ns_crypto::eckey sharedsecret ?-binary? ?-encoding hex|base64url|base64|binary? ?-passphrase /value/? ?-pem /value/? ?--? /pubkey/"}
772776

777+
############################################################################
778+
# Test Cases for ns_crypto::uuid
779+
############################################################################
780+
test ns_crypto::uuid-1.1 {UUID v4, length of UUID} -constraints crypto -body {
781+
string length [ns_crypto::uuid -version v4]
782+
} -returnCodes {error ok} -result {36}
783+
784+
test ns_crypto::uuid-1.2 {UUID v7, length of UUID} -constraints crypto -body {
785+
string length [ns_crypto::uuid -version v7]
786+
} -returnCodes {error ok} -result {36}
773787

774788
#
775789
# Local variables:

0 commit comments

Comments
 (0)