#lang at-exp racket/base ;;; SPDX-License-Identifier: LGPL-3.0-or-later ;;; SPDX-FileCopyrightText: Copyright © 2023 Tony Garnock-Jones (module+ test (require rackunit) (require syndicate/sturdy) (require preserves) (define (C . strings) (parse-SturdyRef (string->preserve (apply string-append strings)))) (define s0 (mint "test" #"")) (check-equal? s0 (SturdyRef "test" '() #">\330w\326\3r{\216U`j\24\376\203\242\360")) (check-true (SturdyRef-valid? s0 #"")) (define s1 (attenuate-sturdy s0 'a 'b 'c)) (check-equal? s1 (SturdyRef "test" '(a b c) #"\261\220\327\363X\317\202\251&\367\3734*\355\333\324")) (check-true (SturdyRef-valid? s1 #"")) (check-false (SturdyRef-valid? (SturdyRef "test" '(a b c) #"\261\220\327\363X\317\202\251&\367\3734?\355\333\324") #"")) (check-false (SturdyRef-valid? (SturdyRef "test" '(a c b) #"\261\220\327\363X\317\202\251&\367\3734*\355\333\324") #"")) )