30 lines
980 B
Racket
30 lines
980 B
Racket
|
#lang at-exp racket/base
|
||
|
;;; SPDX-License-Identifier: LGPL-3.0-or-later
|
||
|
;;; SPDX-FileCopyrightText: Copyright © 2023 Tony Garnock-Jones <tonyg@leastfixedpoint.com>
|
||
|
|
||
|
(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" '() #"J\270\253\306N\365\2240\303\206\324\2G\306m\377"))
|
||
|
(check-true (SturdyRef-valid? s0 #""))
|
||
|
|
||
|
(define s1 (attenuate-sturdy s0 'a 'b 'c))
|
||
|
|
||
|
(check-equal? s1 (SturdyRef "test" '(a b c) #"oO\243\334\366aW6\5\303<\314St\275\226"))
|
||
|
(check-true (SturdyRef-valid? s1 #""))
|
||
|
(check-false (SturdyRef-valid?
|
||
|
(SturdyRef "test" '(a b c) #"pO\243\334\366aW6\5\303<\314St\275\226")
|
||
|
#""))
|
||
|
(check-false (SturdyRef-valid?
|
||
|
(SturdyRef "test" '(a c b) #"oO\243\334\366aW6\5\303<\314St\275\226")
|
||
|
#""))
|
||
|
|
||
|
)
|
||
|
|