api-smoke-test.scm 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. ;;; Copyright © 2020 Maxime Devos <maxime.devos@student.kuleuven.be>
  2. ;;; This file is part of rehash.
  3. ;;;
  4. ;;; rehash is free software; you can redistribute it and/or modify it
  5. ;;; under the terms of the GNU General Public License as published by
  6. ;;; the Free Software Foundation; either version 3 of the License, or (at
  7. ;;; your option) any later version.
  8. ;;;
  9. ;;; rehash is distributed in the hope that it will be useful, but
  10. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  11. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. ;;; GNU General Public License for more details.
  13. ;;;
  14. ;;; You should have received a copy of the GNU General Public License
  15. ;;; along with rehash. If not, see <http://www.gnu.org/licenses/>.
  16. (use-modules (rehash)
  17. (gnu gnunet configuration)
  18. (srfi srfi-64))
  19. (define test-config #f)
  20. (define s #f)
  21. (test-begin "test-rehash-smoke")
  22. (set! test-config (load-configuration "testconf.conf"))
  23. (set! s (open-rehash-service test-config))
  24. (define h1 (bytevector->hash HASH_SHA256 #vu8(0 1) 0 2))
  25. (define h2 (bytevector->hash HASH_SHA256 #vu8(2 1) 0 2))
  26. (define s1 (store-hash! s h1 h2
  27. #:expiration-time (expt 2 48)
  28. #:anonymity-level 0))
  29. (define s2 (store-hash! s h2 h1
  30. #:expiration-time 345678
  31. #:anonymity-level 0))
  32. ;; todo higher anonymity levels
  33. (store-abort! s1)
  34. (define q1 (query! s h1 HASH_SHA3_512
  35. #:anonymity-level 0
  36. #:options 0
  37. #:when-found display))
  38. (store-abort! s2)
  39. (query-abort! q1)
  40. (close-rehash-service s)
  41. (test-end "test-rehash-smoke")