-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
567 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#lang racket | ||
|
||
(require rackunit) | ||
(require rackcheck) | ||
|
||
(require "llist.rkt") | ||
|
||
|
||
(define-property llist->list-is-inverse-of-list->llist | ||
([xs (gen:list gen:natural)]) | ||
(check-equal? (llist->list (list->llist xs)) xs)) | ||
|
||
(define-property llist-append-associative | ||
([as (gen:list gen:natural)] | ||
[bs (gen:list gen:natural)] | ||
[cs (gen:list gen:natural)]) | ||
(let ([a (list->llist as)] | ||
[b (list->llist bs)] | ||
[c (list->llist cs)]) | ||
(check-equal? | ||
(llist->list (llist-append a (llist-append b c))) | ||
(llist->list (llist-append (llist-append a b) c))))) | ||
|
||
(define-property llist-null-is-neutral-for-append | ||
([xs (gen:list gen:natural)]) | ||
(let ([x (list->llist xs)]) | ||
(check-equal? | ||
(llist->list (llist-append llist-null x)) | ||
xs) | ||
|
||
(check-equal? | ||
(llist->list (llist-append llist-null x)) | ||
(llist->list (llist-append x llist-null))))) | ||
|
||
(check-property llist->list-is-inverse-of-list->llist) | ||
(check-property llist-append-associative) | ||
(check-property llist-null-is-neutral-for-append) |
Oops, something went wrong.