summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorVivien Kraus <vivien@planete-kraus.eu>2020-01-01 00:00:00 +0100
committerVivien Kraus <vivien@planete-kraus.eu>2021-06-18 15:43:45 +0200
commitee4b746fbfd39d44c9a4eb065e4eddc146903e02 (patch)
tree8e024633b455443eccfdc11c77b58b478eb8afba /tests
parent7e125cc85c79e0854ca300dec6f819598e3fc6b0 (diff)
Add a random number generator.
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am15
-rw-r--r--tests/random.scm17
2 files changed, 25 insertions, 7 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 12699f9..adff911 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,18 +1,19 @@
-TESTS = \
- %reldir%/load-library.scm \
+TESTS = %reldir%/load-library.scm \
%reldir%/base64-ok.scm \
- %reldir%/base64-error.scm
+ %reldir%/base64-error.scm \
+ %reldir%/random.scm
EXTRA_DIST += $(TESTS)
TEST_EXTENSIONS = .scm
-AM_TESTS_ENVIRONMENT = $(top_builddir)/pre-inst-env
-SCM_LOG_COMPILER = $(GUILE)
-AM_SCM_LOG_FLAGS = --no-auto-compile -s
+.PHONY: %canon_reldir%-clean-local
clean-local: %canon_reldir%-clean-local
%canon_reldir%-clean-local:
rm -rf %reldir%/*.cache
- rm -rf %reldir%/*.home
+
+AM_TESTS_ENVIRONMENT = $(top_builddir)/pre-inst-env
+SCM_LOG_COMPILER = $(GUILE)
+AM_SCM_LOG_FLAGS = --no-auto-compile -s
diff --git a/tests/random.scm b/tests/random.scm
new file mode 100644
index 0000000..9b85b15
--- /dev/null
+++ b/tests/random.scm
@@ -0,0 +1,17 @@
+(use-modules (webid-oidc stubs)
+ (webid-oidc testing))
+
+(with-test-environment
+ "random"
+ (lambda ()
+ (let ((data (random 12))
+ (expected "68OMG_V5x-KmI6TI"))
+ (unless (string=? data expected)
+ (format (current-error-port)
+ "Non-reproducibility issue with the random number generator:
+expected: ~a
+obtained: ~a
+"
+ expected
+ data)
+ (exit 1)))))