Changeset 8915 in project for nondescript


Ignore:
Timestamp:
02/25/08 16:39:29 (11 years ago)
Author:
kon
Message:

Save.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • nondescript/binary-tree/tests/binary-tree-test.scm

    r5064 r8915  
    55(use srfi-1 srfi-13)
    66
    7 ;;
     7;;;
    88
    99(define-inline (->boolean obj)
    10         (not (not obj)) )
     10        (and obj #t) )
    1111
    1212(define (random-alist n #!optional (lim (* n 10)))
    1313        (let loop ([n n] [al '()])
    1414                (if (zero? n)
    15                         al
    16                         (loop (sub1 n) (alist-cons (random lim) (gensym) al)) ) ) )
     15        al
     16        (loop (sub1 n) (alist-cons (random lim) (gensym) al)) ) ) )
    1717
    1818(define (alist-same? al1 al2)
    1919        (every
    20                 (lambda (pair)
    21                         (and-let* ([v2 (alist-ref (car pair) al2 equal?)])
    22                                 (equal? v2 (cdr pair)) ) )
     20                (lambda (pare)
     21                        (and-let* ([v2 (alist-ref (car pare) al2 equal?)])
     22                                (equal? v2 (cdr pare)) ) )
    2323                al1) )
    24 
    25 (define-expect-binary alist-same? alist-same "alist same key-value pairs, w/o ordering")
    2624
    2725(define (list-same? l1 l2)
    2826        (every (lambda (x) (->boolean (member x l2))) l1) )
    2927
    30 (define-expect-binary list-same? list-same "list same values, w/o ordering")
    31 
    3228(define (random-tree n)
    3329        (alist->avltree (random-alist n) <) )
    3430
    35 ;;
     31;;;
     32
     33(define-expect-binary alist-same? alist-same "alist same key-value pairs, w/o ordering")
     34
     35(define-expect-binary list-same? list-same "list same values, w/o ordering")
     36
     37;;;
    3638
    3739(define-test avltree-test "Avl-Tree"
     
    130132(test::styler-set! avltree-test test::output-style-human)
    131133(run-test "AVL Tree Tests")
     134
     135(test::forget!)
Note: See TracChangeset for help on using the changeset viewer.