gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnunet-scheme] 06/09: fs/quickcheck: Define arbitraries for generating


From: gnunet
Subject: [gnunet-scheme] 06/09: fs/quickcheck: Define arbitraries for generating FS structures.
Date: Sat, 03 Dec 2022 14:14:36 +0100

This is an automated email from the git hooks/post-receive script.

maxime-devos pushed a commit to branch master
in repository gnunet-scheme.

commit 690f46ec61d944cd3377213025aa7f8129840c2a
Author: Maxime Devos <maximedevos@telenet.be>
AuthorDate: Sat Dec 3 13:33:08 2022 +0100

    fs/quickcheck: Define arbitraries for generating FS structures.
    
    * gnu/gnunet/fs/quickcheck.scm: New module.
    * Makefile.am (modules): Register new module.
---
 Makefile.am                  |  1 +
 gnu/gnunet/fs/quickcheck.scm | 36 ++++++++++++++++++++++++++++++++++++
 2 files changed, 37 insertions(+)

diff --git a/Makefile.am b/Makefile.am
index 810c4e4..1c9fbe3 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -93,6 +93,7 @@ modules = \
   gnu/gnunet/fs/network.scm \
   gnu/gnunet/fs/struct.scm \
   gnu/gnunet/fs/uri.scm \
+  gnu/gnunet/fs/quickcheck.scm \
   \
   gnu/gnunet/util/cmsg.scm \
   gnu/gnunet/util/time.scm \
diff --git a/gnu/gnunet/fs/quickcheck.scm b/gnu/gnunet/fs/quickcheck.scm
new file mode 100644
index 0000000..724ed6d
--- /dev/null
+++ b/gnu/gnunet/fs/quickcheck.scm
@@ -0,0 +1,36 @@
+;; This file is part of scheme-GNUnet, a partial Scheme port of GNUnet.
+;; Copyright © 2022 GNUnet e.V.
+;;
+;; scheme-GNUnet is free software: you can redistribute it and/or modify it
+;; under the terms of the GNU Affero General Public License as published
+;; by the Free Software Foundation, either version 3 of the License,
+;; or (at your option) any later version.
+;;
+;; scheme-GNUnet is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;; Affero General Public License for more details.
+;;
+;; You should have received a copy of the GNU Affero General Public License
+;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
+;;
+;; SPDX-License-Identifier: AGPL-3.0-or-later
+
+(define-library (gnu gnunet utils bv-slice-quickcheck)
+  (export $content-hash-key $chk-uri)
+  (import (only (rnrs base) begin define)
+         (only (quickcheck arbitrary) $record $natural)
+         (only (gnu gnunet fs uri)
+               make-chk chk-key chk-query
+               make-chk-uri chk-uri-file-length chk-uri-chk)
+         (only (gnu gnunet hashcode quickcheck) $hashcode:512))
+  (begin
+    (define $content-hash-key
+      ($record make-chk (chk-key $hashcode:512) (chk-query $hashcode:512)))
+
+    ;; Can produce some impossible chk URIs, e.g. multiple
+    ;; chk URIs for length=0.
+    (define $chk-uri
+      ($record make-chk-uri
+              (chk-uri-file-length $natural) ; TODO: bounds
+              (chk-uri-chk $content-hash-key)))))

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]