]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Add test of %uuid.v4() and %uuid.v7()
authorNick Porter <nick@portercomputing.co.uk>
Thu, 6 Nov 2025 11:28:55 +0000 (11:28 +0000)
committerNick Porter <nick@portercomputing.co.uk>
Thu, 6 Nov 2025 11:28:55 +0000 (11:28 +0000)
src/tests/keywords/xlat-uuid [new file with mode: 0644]

diff --git a/src/tests/keywords/xlat-uuid b/src/tests/keywords/xlat-uuid
new file mode 100644 (file)
index 0000000..d71ae6a
--- /dev/null
@@ -0,0 +1,18 @@
+#
+# PRE: if
+#
+string uuid
+
+uuid = %uuid.v4()
+
+if (!(uuid =~ /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/)) {
+       test_fail
+}
+
+uuid := %uuid.v7()
+
+if (!(uuid =~ /^[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/)) {
+       test_fail
+}
+
+success