Debian Codegraph @

guile/tests/random.scm

raw
1 ;;; GnuTLS --- Guile bindings for GnuTLS
2 ;;; Copyright (C) 2011-2025 Free Software Foundation, Inc.
3 ;;;
4 ;;; This file is part of Guile-GnuTLS.
5 ;;;
6 ;;; This program is free software: you can redistribute it and/or modify
7 ;;; it under the terms of the GNU General Public License as published by
8 ;;; the Free Software Foundation, either version 3 of the License, or
9 ;;; (at your option) any later version.
10 ;;;
11 ;;; This program is distributed in the hope that it will be useful,
12 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ;;; GNU General Public License for more details.
15 ;;;
16 ;;; You should have received a copy of the GNU General Public License
17 ;;; along with this program. If not, see <https://www.gnu.org/licenses/>.
18
19 ;; Check the random number generation API.
20
21 (use-modules (gnutls)
22 (ice-9 match)
23 (gnutls build tests))
24
25 (run-test
26 (lambda ()
27 (let ((output
28 (with-output-to-string
29 (lambda ()
30 (load-from-path "random-example.scm")))))
31 (match output
32 ((or "You roll a 1.\n"
33 "You roll a 2.\n"
34 "You roll a 3.\n"
35 "You roll a 4.\n"
36 "You roll a 5.\n"
37 "You roll a 6.\n")
38 #t)
39 (otherwise
40 (error "Invalid roll."))))))