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-19 15:44:24 +0200
commitc54ad2f70f705a62946fb93902f9a9bd65ae1fed (patch)
tree672a7c71542425cb5694cf349c366e9d4f4745be /tests
parent7c81a49d762e67b21c99a95b86d1e7886d91de02 (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)))))