Changeset 30449 in project


Ignore:
Timestamp:
02/11/14 17:36:16 (6 years ago)
Author:
juergen
Message:

yasos 1.4 with compound-test instead of simple-test

Location:
release/4/yasos
Files:
2 edited
5 copied

Legend:

Unmodified
Added
Removed
  • release/4/yasos/tags/1.4/tests/run.scm

    r29850 r30449  
    131131 ;;; eof yasos-examples.scm
    132132
    133 (compound-test ('YASOS)
    134   (simple-test ('POINTS)
    135     (import points)
    136     (define eps 0.0001)
    137     (define cart (make-point-cartesian -1 0))
    138     (define pol (make-point-polar 1 (acos -1)))
    139     (< (distance cart pol) eps)
    140     (= (rho cart) 1)
    141     (scale! pol 5)
    142     (< (abs (- (x pol) -5)) eps)
    143     (translate! cart 1 1)
    144     (= (x cart) 0)
    145     (= (y cart) 1)
    146     (rotate! pol 3.14159)
    147     (< (distance pol (make-point-cartesian 5 0)) eps)
    148     (= (size pol) 2)
    149     )
    150 
    151   (simple-test ("STACKS")
    152     (import stacks)
    153     (define st (make-stack))
    154     (stack? st)
    155     (not (ra-stack? st))
    156     (empty? st)
    157     (push! st 0)
    158     (push! st 1)
    159     (push! st 2)
    160     (= (size st) 3)
    161     (not (empty? st))
    162     (= (top st) 2)
    163     (pop! st)
    164     (= (top st) 1)
    165     (pop! st)
    166     (= (size st) 1)
    167     (clear! st)
    168     (empty? st)
    169 
    170     (define rst (make-ra-stack))
    171     (ra-stack? rst)
    172     (stack? rst)
    173     (push! rst 0)
    174     (push! rst 1)
    175     (push! rst 2)
    176     (= (down rst 1) 1)
    177     (= (top rst) 2)
    178     (pop! rst)
    179     (= (top rst) 1)
    180     (= (down rst 1) 0)
    181     (equal? (protocol rst)
    182             '(ra-stack? show down (stack? empty? size show state top push!
    183                                      pop! clear!)))
    184     (equal? (protocol rst 'down) '(down self k))
    185     )
    186 
    187   (simple-test ("QUEUES")
    188     (import queues)
    189     (define qu (make-queue))
    190     (queue? qu)
    191     (not (queue? #f))
    192     (empty? qu)
    193     (enq! qu 0)
    194     (enq! qu 1)
    195     (enq! qu 2)
    196     (= (size qu) 3)
    197     (not (empty? qu))
    198     (= (front qu) 0)
    199     (deq! qu)
    200     (= (front qu) 1)
    201     (deq! qu)
    202     (= (size qu) 1)
    203     (clear! qu)
    204     (empty? qu)
    205     (equal? (protocol qu)
    206             '(queue? empty? size show state front enq! deq! clear!))
    207     )
    208 
    209   (simple-test ("PERSON and BANK-ACCOUNT")
     133(define-test (accounts?)
     134  (check
    210135    (define fred  (make-person  "Fred"  19 "573-19-4279" 'FadeCafe))
    211136    (define sally (make-account "Sally" 26 "629-26-9742" 'FeedBabe 263 'bank-password))
     
    250175            '(ssn self password))
    251176    ))
     177
     178(define-test (points?)
     179  (check
     180    (import points)
     181    (define eps 0.0001)
     182    (define cart (make-point-cartesian -1 0))
     183    (define pol (make-point-polar 1 (acos -1)))
     184    (< (distance cart pol) eps)
     185    (= (rho cart) 1)
     186    (scale! pol 5)
     187    (< (abs (- (x pol) -5)) eps)
     188    (translate! cart 1 1)
     189    (= (x cart) 0)
     190    (= (y cart) 1)
     191    (rotate! pol 3.14159)
     192    (< (distance pol (make-point-cartesian 5 0)) eps)
     193    (= (size pol) 2)
     194    ))
     195
     196(import stacks)
     197(define-test (stacks?)
     198  (check
     199    (define st (make-stack))
     200    (stack? st)
     201    (not (ra-stack? st))
     202    (empty? st)
     203    (push! st 0)
     204    (push! st 1)
     205    (push! st 2)
     206    (= (size st) 3)
     207    (not (empty? st))
     208    (= (top st) 2)
     209    (pop! st)
     210    (= (top st) 1)
     211    (pop! st)
     212    (= (size st) 1)
     213    (clear! st)
     214    (empty? st)
     215
     216    (define rst (make-ra-stack))
     217    (ra-stack? rst)
     218    (stack? rst)
     219    (push! rst 0)
     220    (push! rst 1)
     221    (push! rst 2)
     222    (= (down rst 1) 1)
     223    (= (top rst) 2)
     224    (pop! rst)
     225    (= (top rst) 1)
     226    (= (down rst 1) 0)
     227    (equal? (protocol rst)
     228            '(ra-stack? show down (stack? empty? size show state top push!
     229                                     pop! clear!)))
     230    (equal? (protocol rst 'down) '(down self k))
     231    ))
     232
     233(import queues)
     234(define-test (queues?)
     235  (check
     236    (define qu (make-queue))
     237    (queue? qu)
     238    (not (queue? #f))
     239    (empty? qu)
     240    (enq! qu 0)
     241    (enq! qu 1)
     242    (enq! qu 2)
     243    (= (size qu) 3)
     244    (not (empty? qu))
     245    (= (front qu) 0)
     246    (deq! qu)
     247    (= (front qu) 1)
     248    (deq! qu)
     249    (= (size qu) 1)
     250    (clear! qu)
     251    (empty? qu)
     252    (equal? (protocol qu)
     253            '(queue? empty? size show state front enq! deq! clear!))
     254    ))
     255
     256(compound-test (YASOS)
     257  (accounts?)
     258  (points?)
     259  (stacks?)
     260  (queues?)
     261  )
  • release/4/yasos/tags/1.4/yasos.setup

    r29850 r30449  
    1111 'yasos
    1212 '("yasos.so" "yasos.import.so" "stacks.import.so" "queues.import.so" "points.import.so")
    13  '((version 1.3.1)))
     13 '((version 1.4)))
  • release/4/yasos/trunk/tests/run.scm

    r29850 r30449  
    131131 ;;; eof yasos-examples.scm
    132132
    133 (compound-test ('YASOS)
    134   (simple-test ('POINTS)
    135     (import points)
    136     (define eps 0.0001)
    137     (define cart (make-point-cartesian -1 0))
    138     (define pol (make-point-polar 1 (acos -1)))
    139     (< (distance cart pol) eps)
    140     (= (rho cart) 1)
    141     (scale! pol 5)
    142     (< (abs (- (x pol) -5)) eps)
    143     (translate! cart 1 1)
    144     (= (x cart) 0)
    145     (= (y cart) 1)
    146     (rotate! pol 3.14159)
    147     (< (distance pol (make-point-cartesian 5 0)) eps)
    148     (= (size pol) 2)
    149     )
    150 
    151   (simple-test ("STACKS")
    152     (import stacks)
    153     (define st (make-stack))
    154     (stack? st)
    155     (not (ra-stack? st))
    156     (empty? st)
    157     (push! st 0)
    158     (push! st 1)
    159     (push! st 2)
    160     (= (size st) 3)
    161     (not (empty? st))
    162     (= (top st) 2)
    163     (pop! st)
    164     (= (top st) 1)
    165     (pop! st)
    166     (= (size st) 1)
    167     (clear! st)
    168     (empty? st)
    169 
    170     (define rst (make-ra-stack))
    171     (ra-stack? rst)
    172     (stack? rst)
    173     (push! rst 0)
    174     (push! rst 1)
    175     (push! rst 2)
    176     (= (down rst 1) 1)
    177     (= (top rst) 2)
    178     (pop! rst)
    179     (= (top rst) 1)
    180     (= (down rst 1) 0)
    181     (equal? (protocol rst)
    182             '(ra-stack? show down (stack? empty? size show state top push!
    183                                      pop! clear!)))
    184     (equal? (protocol rst 'down) '(down self k))
    185     )
    186 
    187   (simple-test ("QUEUES")
    188     (import queues)
    189     (define qu (make-queue))
    190     (queue? qu)
    191     (not (queue? #f))
    192     (empty? qu)
    193     (enq! qu 0)
    194     (enq! qu 1)
    195     (enq! qu 2)
    196     (= (size qu) 3)
    197     (not (empty? qu))
    198     (= (front qu) 0)
    199     (deq! qu)
    200     (= (front qu) 1)
    201     (deq! qu)
    202     (= (size qu) 1)
    203     (clear! qu)
    204     (empty? qu)
    205     (equal? (protocol qu)
    206             '(queue? empty? size show state front enq! deq! clear!))
    207     )
    208 
    209   (simple-test ("PERSON and BANK-ACCOUNT")
     133(define-test (accounts?)
     134  (check
    210135    (define fred  (make-person  "Fred"  19 "573-19-4279" 'FadeCafe))
    211136    (define sally (make-account "Sally" 26 "629-26-9742" 'FeedBabe 263 'bank-password))
     
    250175            '(ssn self password))
    251176    ))
     177
     178(define-test (points?)
     179  (check
     180    (import points)
     181    (define eps 0.0001)
     182    (define cart (make-point-cartesian -1 0))
     183    (define pol (make-point-polar 1 (acos -1)))
     184    (< (distance cart pol) eps)
     185    (= (rho cart) 1)
     186    (scale! pol 5)
     187    (< (abs (- (x pol) -5)) eps)
     188    (translate! cart 1 1)
     189    (= (x cart) 0)
     190    (= (y cart) 1)
     191    (rotate! pol 3.14159)
     192    (< (distance pol (make-point-cartesian 5 0)) eps)
     193    (= (size pol) 2)
     194    ))
     195
     196(import stacks)
     197(define-test (stacks?)
     198  (check
     199    (define st (make-stack))
     200    (stack? st)
     201    (not (ra-stack? st))
     202    (empty? st)
     203    (push! st 0)
     204    (push! st 1)
     205    (push! st 2)
     206    (= (size st) 3)
     207    (not (empty? st))
     208    (= (top st) 2)
     209    (pop! st)
     210    (= (top st) 1)
     211    (pop! st)
     212    (= (size st) 1)
     213    (clear! st)
     214    (empty? st)
     215
     216    (define rst (make-ra-stack))
     217    (ra-stack? rst)
     218    (stack? rst)
     219    (push! rst 0)
     220    (push! rst 1)
     221    (push! rst 2)
     222    (= (down rst 1) 1)
     223    (= (top rst) 2)
     224    (pop! rst)
     225    (= (top rst) 1)
     226    (= (down rst 1) 0)
     227    (equal? (protocol rst)
     228            '(ra-stack? show down (stack? empty? size show state top push!
     229                                     pop! clear!)))
     230    (equal? (protocol rst 'down) '(down self k))
     231    ))
     232
     233(import queues)
     234(define-test (queues?)
     235  (check
     236    (define qu (make-queue))
     237    (queue? qu)
     238    (not (queue? #f))
     239    (empty? qu)
     240    (enq! qu 0)
     241    (enq! qu 1)
     242    (enq! qu 2)
     243    (= (size qu) 3)
     244    (not (empty? qu))
     245    (= (front qu) 0)
     246    (deq! qu)
     247    (= (front qu) 1)
     248    (deq! qu)
     249    (= (size qu) 1)
     250    (clear! qu)
     251    (empty? qu)
     252    (equal? (protocol qu)
     253            '(queue? empty? size show state front enq! deq! clear!))
     254    ))
     255
     256(compound-test (YASOS)
     257  (accounts?)
     258  (points?)
     259  (stacks?)
     260  (queues?)
     261  )
  • release/4/yasos/trunk/yasos.setup

    r29850 r30449  
    1111 'yasos
    1212 '("yasos.so" "yasos.import.so" "stacks.import.so" "queues.import.so" "points.import.so")
    13  '((version 1.3.1)))
     13 '((version 1.4)))
Note: See TracChangeset for help on using the changeset viewer.