Changeset 14566 in project


Ignore:
Timestamp:
05/08/09 15:29:06 (11 years ago)
Author:
Kon Lovett
Message:

Mvd common inline. Updated test for curr err msg.

Location:
release/4/srfi-41/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • release/4/srfi-41/trunk/streams-derived.scm

    r14192 r14566  
    2828(include "streams-inlines")
    2929(include "inline-type-checks")
    30 
    31 ;;;
    32 
    33 (define-inline (%check-streams loc strms nam)
    34   (when (%any/1 not-stream? strms)
    35     (error-stream loc strms nam) ) )
    3630
    3731(module streams-derived (;export
  • release/4/srfi-41/trunk/streams-inlines.scm

    r14192 r14566  
    1010  (unless (%stream? obj)
    1111    (error-stream loc obj argnam) ) )
     12
     13(define-inline (%check-streams loc strms nam)
     14  (when (%any/1 not-stream? strms)
     15    (error-stream loc strms nam) ) )
  • release/4/srfi-41/trunk/streams-utils.scm

    r14192 r14566  
    2626(include "streams-inlines")
    2727(include "inline-type-checks")
    28 
    29 ;;;
    30 
    31 (define-inline (%check-streams loc strms nam)
    32   (when (%any/1 not-stream? strms)
    33     (error-stream loc strms nam) ) )
    3428
    3529(module streams-utils (;export
  • release/4/srfi-41/trunk/tests/run.scm

    r14192 r14566  
    6565
    6666  ; stream-car
    67   (tester (stream-car "four") "stream-car: bad `stream' argument type - expected a stream")
    68   (tester (stream-car stream-null) "stream-car: bad `stream' argument type - expected a stream-occupied")
     67  (tester (stream-car "four") "stream-car: bad `stream' argument type - not a stream")
     68  (tester (stream-car stream-null) "stream-car: bad `stream' argument type - not a stream-occupied")
    6969  (tester (stream-car strm123) 1)
    7070
    7171  ; stream-cdr
    72   (tester (stream-cdr "four") "stream-cdr: bad `stream' argument type - expected a stream")
    73   (tester (stream-cdr stream-null) "stream-cdr: bad `stream' argument type - expected a stream-occupied")
     72  (tester (stream-cdr "four") "stream-cdr: bad `stream' argument type - not a stream")
     73  (tester (stream-cdr stream-null) "stream-cdr: bad `stream' argument type - not a stream-occupied")
    7474  (tester (stream-car (stream-cdr strm123)) 2)
    7575
     
    101101
    102102  ; list->stream
    103   (tester (list->stream "four") "list->stream: bad `objects' argument type - expected a list")
     103  (tester (list->stream "four") "list->stream: bad `objects' argument type - not a list")
    104104  (tester (stream->list (list->stream '())) '())
    105105  (tester (stream->list (list->stream '(1 2 3))) '(1 2 3))
     
    108108  (let* ((p (open-input-file "streams.ss"))
    109109         (s (port->stream p)))
    110     (tester (port->stream "four") "port->stream: bad `port' argument type - expected an input-port")
     110    (tester (port->stream "four") "port->stream: bad `port' argument type - not an input-port")
    111111    (tester (string=? (list->string (stream->list 11 s)) "; Copyright") #t)
    112112    (close-input-port p))
     
    118118
    119119  ; stream->list
    120   (tester (stream->list '()) "stream->list: bad `stream' argument type - expected a stream")
    121   (tester (stream->list "four" strm123) "stream->list: bad `count' argument type - expected a cardinal-integer")
    122   (tester (stream->list -1 strm123) "stream->list: bad `count' argument type - expected a cardinal-integer")
     120  (tester (stream->list '()) "stream->list: bad `stream' argument type - not a stream")
     121  (tester (stream->list "four" strm123) "stream->list: bad `count' argument type - not a cardinal-integer")
     122  (tester (stream->list -1 strm123) "stream->list: bad `count' argument type - not a cardinal-integer")
    123123  (tester (stream->list (stream)) '())
    124124  (tester (stream->list strm123) '(1 2 3))
     
    127127
    128128  ; stream-append
    129   (tester (stream-append "four") "stream-append: bad `stream' argument type - expected a stream")
     129  (tester (stream-append "four") "stream-append: bad `stream' argument type - not a stream")
    130130  (tester (stream->list (stream-append strm123)) '(1 2 3))
    131131  (tester (stream->list (stream-append strm123 strm123)) '(1 2 3 1 2 3))
     
    135135
    136136  ; stream-concat
    137   (tester (stream-concat "four") "stream-concat: bad `stream' argument type - expected a stream")
     137  (tester (stream-concat "four") "stream-concat: bad `stream' argument type - not a stream")
    138138  (tester (stream->list (stream-concat (stream strm123))) '(1 2 3))
    139139  (tester (stream->list (stream-concat (stream strm123 strm123))) '(1 2 3 1 2 3))
     
    145145
    146146  ; stream-drop
    147   (tester (stream-drop "four" strm123) "stream-drop: bad `count' argument type - expected a cardinal-integer")
    148   (tester (stream-drop -1 strm123) "stream-drop: bad `count' argument type - expected a cardinal-integer")
    149   (tester (stream-drop 2 "four") "stream-drop: bad `stream' argument type - expected a stream")
     147  (tester (stream-drop "four" strm123) "stream-drop: bad `count' argument type - not a cardinal-integer")
     148  (tester (stream-drop -1 strm123) "stream-drop: bad `count' argument type - not a cardinal-integer")
     149  (tester (stream-drop 2 "four") "stream-drop: bad `stream' argument type - not a stream")
    150150  (tester (stream->list (stream-drop 0 stream-null)) '())
    151151  (tester (stream->list (stream-drop 0 strm123)) '(1 2 3))
     
    154154
    155155  ; stream-drop-while
    156   (tester (stream-drop-while "four" strm123) "stream-drop-while: bad `predicate?' argument type - expected a procedure")
    157   (tester (stream-drop-while odd? "four") "stream-drop-while: bad `stream' argument type - expected a stream")
     156  (tester (stream-drop-while "four" strm123) "stream-drop-while: bad `predicate?' argument type - not a procedure")
     157  (tester (stream-drop-while odd? "four") "stream-drop-while: bad `stream' argument type - not a stream")
    158158  (tester (stream->list (stream-drop-while odd? stream-null)) '())
    159159  (tester (stream->list (stream-drop-while odd? strm123)) '(2 3))
     
    163163
    164164  ; stream-filter
    165   (tester (stream-filter "four" strm123) "stream-filter: bad `predicate?' argument type - expected a procedure")
    166   (tester (stream-filter odd? '()) "stream-filter: bad `stream' argument type - expected a stream")
     165  (tester (stream-filter "four" strm123) "stream-filter: bad `predicate?' argument type - not a procedure")
     166  (tester (stream-filter odd? '()) "stream-filter: bad `stream' argument type - not a stream")
    167167  (tester (stream-null? (stream-filter odd? (stream))) #t)
    168168  (tester (stream->list (stream-filter odd? strm123)) '(1 3))
     
    178178
    179179  ; stream-fold
    180   (tester (stream-fold "four" 0 strm123) "stream-fold: bad `function' argument type - expected a procedure")
    181   (tester (stream-fold + 0 '()) "stream-fold: bad `stream' argument type - expected a stream")
     180  (tester (stream-fold "four" 0 strm123) "stream-fold: bad `function' argument type - not a procedure")
     181  (tester (stream-fold + 0 '()) "stream-fold: bad `stream' argument type - not a stream")
    182182  (tester (stream-fold + 0 strm123) 6)
    183183
    184184  ; stream-for-each
    185   (tester (stream-for-each "four" strm123) "stream-for-each: bad `procedure' argument type - expected a procedure")
     185  (tester (stream-for-each "four" strm123) "stream-for-each: bad `procedure' argument type - not a procedure")
    186186  #;(tester (stream-for-each display) "stream-for-each: no stream arguments")
    187   (tester (stream-for-each display "four") "stream-for-each: bad `stream' argument type - expected a stream")
     187  (tester (stream-for-each display "four") "stream-for-each: bad `stream' argument type - not a stream")
    188188  (tester (let ((sum 0)) (stream-for-each (lambda (x) (set! sum (+ sum x))) strm123) sum) 6)
    189189
    190190  ; stream-from
    191   (tester (stream-from "four") "stream-from: bad `first' argument type - expected a number")
    192   (tester (stream-from 1 "four") "stream-from: bad `delta' argument type - expected a number")
     191  (tester (stream-from "four") "stream-from: bad `first' argument type - not a number")
     192  (tester (stream-from 1 "four") "stream-from: bad `delta' argument type - not a number")
    193193  (tester (stream-ref (stream-from 0) 100) 100)
    194194  (tester (stream-ref (stream-from 1 2) 100) 201)
     
    196196
    197197  ; stream-iterate
    198   (tester (stream-iterate "four" 0) "stream-iterate: bad `function' argument type - expected a procedure")
     198  (tester (stream-iterate "four" 0) "stream-iterate: bad `function' argument type - not a procedure")
    199199  (tester (stream->list 3 (stream-iterate (left-section + 1) 1)) '(1 2 3))
    200200
    201201  ; stream-length
    202   (tester (stream-length "four") "stream-length: bad `stream' argument type - expected a stream")
     202  (tester (stream-length "four") "stream-length: bad `stream' argument type - not a stream")
    203203  (tester (stream-length (stream)) 0)
    204204  (tester (stream-length strm123) 3)
     
    215215
    216216  ; stream-map
    217   (tester (stream-map "four" strm123) "stream-map: bad `function' argument type - expected a procedure")
     217  (tester (stream-map "four" strm123) "stream-map: bad `function' argument type - not a procedure")
    218218  #;(tester (stream-map odd?) "stream-map: no stream arguments")
    219   (tester (stream-map odd? "four") "stream-map: bad `stream' argument type - expected a stream")
     219  (tester (stream-map odd? "four") "stream-map: bad `stream' argument type - not a stream")
    220220  (tester (stream->list (stream-map - strm123)) '(-1 -2 -3))
    221221  (tester (stream->list (stream-map + strm123 strm123)) '(2 4 6))
     
    225225
    226226  ; stream-match
    227   (tester (stream-match '(1 2 3) (_ 'ok)) "stream-match: bad `stream' argument type - expected a stream")
     227  (tester (stream-match '(1 2 3) (_ 'ok)) "stream-match: bad `stream' argument type - not a stream")
    228228  (tester (stream-match strm123 (() 42)) "stream-match: no matching pattern")
    229229  (tester (stream-match stream-null (() 'ok)) 'ok)
     
    255255
    256256  ; stream-range
    257   (tester (stream-range "four" 0) "stream-range: bad `first' argument type - expected a number")
    258   (tester (stream-range 0 "four") "stream-range: bad `past' argument type - expected a number")
    259   (tester (stream-range 1 2 "three") "stream-range: bad `delta' argument type - expected a number")
     257  (tester (stream-range "four" 0) "stream-range: bad `first' argument type - not a number")
     258  (tester (stream-range 0 "four") "stream-range: bad `past' argument type - not a number")
     259  (tester (stream-range 1 2 "three") "stream-range: bad `delta' argument type - not a number")
    260260  (tester (stream->list (stream-range 0 5)) '(0 1 2 3 4))
    261261  (tester (stream->list (stream-range 5 0)) '(5 4 3 2 1))
     
    265265
    266266  ; stream-ref
    267   (tester (stream-ref '() 4) "stream-ref: bad `stream' argument type - expected a stream")
    268   (tester (stream-ref natural-numbers-stream 3.5) "stream-ref: bad `index' argument type - expected a cardinal-integer")
    269   (tester (stream-ref natural-numbers-stream -3) "stream-ref: bad `index' argument type - expected a cardinal-integer")
     267  (tester (stream-ref '() 4) "stream-ref: bad `stream' argument type - not a stream")
     268  (tester (stream-ref natural-numbers-stream 3.5) "stream-ref: bad `index' argument type - not a cardinal-integer")
     269  (tester (stream-ref natural-numbers-stream -3) "stream-ref: bad `index' argument type - not a cardinal-integer")
    270270  (tester (stream-ref strm123 5) "stream-ref: beyond end of stream")
    271271  (tester (stream-ref strm123 0) 1)
     
    274274
    275275  ; stream-reverse
    276   (tester (stream-reverse '()) "stream-reverse: bad `stream' argument type - expected a stream")
     276  (tester (stream-reverse '()) "stream-reverse: bad `stream' argument type - not a stream")
    277277  (tester (stream->list (stream-reverse (stream))) '())
    278278  (tester (stream->list (stream-reverse strm123)) '(3 2 1))
    279279
    280280  ; stream-scan
    281   (tester (stream-scan "four" 0 strm123) "stream-scan: bad `function' argument type - expected a procedure")
    282   (tester (stream-scan + 0 '()) "stream-scan: bad `stream' argument type - expected a stream")
     281  (tester (stream-scan "four" 0 strm123) "stream-scan: bad `function' argument type - not a procedure")
     282  (tester (stream-scan + 0 '()) "stream-scan: bad `stream' argument type - not a stream")
    283283  (tester (stream->list (stream-scan + 0 strm123)) '(0 1 3 6))
    284284
    285285  ; stream-take
    286   (tester (stream-take 5 "four") "stream-take: bad `stream' argument type - expected a stream")
    287   (tester (stream-take "four" strm123) "stream-take: bad `count' argument type - expected a cardinal-integer")
    288   (tester (stream-take -4 strm123) "stream-take: bad `count' argument type - expected a cardinal-integer")
     286  (tester (stream-take 5 "four") "stream-take: bad `stream' argument type - not a stream")
     287  (tester (stream-take "four" strm123) "stream-take: bad `count' argument type - not a cardinal-integer")
     288  (tester (stream-take -4 strm123) "stream-take: bad `count' argument type - not a cardinal-integer")
    289289  (tester (stream->list (stream-take 5 stream-null)) '())
    290290  (tester (stream->list (stream-take 0 stream-null)) '())
     
    295295
    296296  ; stream-take-while
    297   (tester (stream-take-while odd? "four") "stream-take-while: bad `stream' argument type - expected a stream")
    298   (tester (stream-take-while "four" strm123) "stream-take-while: bad `predicate?' argument type - expected a procedure")
     297  (tester (stream-take-while odd? "four") "stream-take-while: bad `stream' argument type - not a stream")
     298  (tester (stream-take-while "four" strm123) "stream-take-while: bad `predicate?' argument type - not a procedure")
    299299  (tester (stream->list (stream-take-while odd? strm123)) '(1))
    300300  (tester (stream->list (stream-take-while even? strm123)) '())
     
    303303
    304304  ; stream-unfold
    305   (tester (stream-unfold "four" odd? + 0) "stream-unfold: bad `mapper' argument type - expected a procedure")
    306   (tester (stream-unfold + "four" + 0) "stream-unfold: bad `predicate?' argument type - expected a procedure")
    307   (tester (stream-unfold + odd? "four" 0) "stream-unfold: bad `generator' argument type - expected a procedure")
     305  (tester (stream-unfold "four" odd? + 0) "stream-unfold: bad `mapper' argument type - not a procedure")
     306  (tester (stream-unfold + "four" + 0) "stream-unfold: bad `predicate?' argument type - not a procedure")
     307  (tester (stream-unfold + odd? "four" 0) "stream-unfold: bad `generator' argument type - not a procedure")
    308308  (tester (stream->list (stream-unfold (right-section expt 2) (right-section < 10) (right-section + 1) 0))
    309309          '(0 1 4 9 16 25 36 49 64 81))
     
    323323  ; stream-zip
    324324  #;(tester (stream-zip) "stream-zip: no stream arguments")
    325   (tester (stream-zip "four") "stream-zip: bad `stream' argument type - expected a stream")
    326   (tester (stream-zip strm123 "four") "stream-zip: bad `stream' argument type - expected a stream")
     325  (tester (stream-zip "four") "stream-zip: bad `stream' argument type - not a stream")
     326  (tester (stream-zip strm123 "four") "stream-zip: bad `stream' argument type - not a stream")
    327327  (tester (stream->list (stream-zip strm123 stream-null)) '())
    328328  (tester (stream->list (stream-zip strm123)) '((1) (2) (3)))
Note: See TracChangeset for help on using the changeset viewer.