/[gcl]/gcl/ansi-tests/defgeneric.lsp
ViewVC logotype

Diff of /gcl/ansi-tests/defgeneric.lsp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.7 by pfdietz, Fri May 23 12:41:33 2003 UTC revision 1.8 by pfdietz, Sat May 24 11:37:12 2003 UTC
# Line 413  Line 413 
413     (1 nil)     (1 nil)
414     (a nil))     (a nil))
415    
416     (deftest defgeneric.15
417       (let ((fn (eval '(defgeneric defgeneric.fun.15 (x &key)
418                          (:method ((x number) &key foo &allow-other-keys)
419                                   (list x foo))
420                          (:method ((x symbol) &key bar) (list x bar))))))
421         (values
422          (funcall fn 1)
423          (funcall fn 'a)
424          (funcall fn 1 :foo 2)
425          (funcall fn 1 :foo 2 :bar 3)
426          (funcall fn 1 :bar 4)
427          (funcall fn 'a :foo 'b)
428          (funcall fn 'a :bar 'b)
429          (funcall fn 'a :foo 'c :bar 'b)
430          (funcall fn 1 :baz 10)
431          (funcall fn 'a :baz 10)
432          (funcall fn 1 :allow-other-keys nil :baz 'a)
433          (funcall fn 'a :allow-other-keys nil :baz 'b)
434          ))
435       (1 nil)
436       (a nil)
437       (1 2)
438       (1 2)
439       (1 nil)
440       (a nil)
441       (a b)
442       (a b)
443       (1 nil)
444       (a nil)
445       (1 nil)
446       (a nil))
447    
448     (deftest defgeneric.16
449       (let ((fn (eval '(defgeneric defgeneric.fun.16 (x &key)
450                          (:method ((x number) &key (foo 'a))
451                                   (list x foo))
452                          (:method ((x symbol) &key foo)
453                                   (list x foo))))))
454         (values
455          (funcall fn 1)
456          (funcall fn 1 :foo nil)
457          (funcall fn 1 :foo 2)
458          (funcall fn 'x)
459          (funcall fn 'x :foo nil)
460          (funcall fn 'x :foo 'y)))
461       (1 a)
462       (1 nil)
463       (1 2)
464       (x nil)
465       (x nil)
466       (x y))
467    
468     (deftest defgeneric.17
469       (let ((fn (eval '(defgeneric defgeneric.fun.17 (x &key)
470                          (:method ((x number) &key (foo 'a foo-p))
471                                   (list x foo (notnot foo-p)))
472                          (:method ((x symbol) &key foo)
473                                   (list x foo))))))
474         (values
475          (funcall fn 1)
476          (funcall fn 1 :foo nil)
477          (funcall fn 1 :foo 2)
478          (funcall fn 'x)
479          (funcall fn 'x :foo nil)
480          (funcall fn 'x :foo 'y)))
481       (1 a nil)
482       (1 nil t)
483       (1 2 t)
484       (x nil)
485       (x nil)
486       (x y))
487    
488    (deftest defgeneric.18
489       (let ((fn (eval '(defgeneric defgeneric.fun.18 (x &optional y)
490                          (:method ((x number) &optional (y 'a))
491                                   (list x y))
492                          (:method ((x symbol) &optional (z nil z-p))
493                                   (list x z (notnot z-p)))))))
494         (values
495          (funcall fn 1)
496          (funcall fn 1 nil)
497          (funcall fn 1 2)
498          (funcall fn 'x)
499          (funcall fn 'x nil)
500          (funcall fn 'x 'y)))
501       (1 a)
502       (1 nil)
503       (1 2)
504       (x nil nil)
505       (x nil t)
506       (x y t))
507    
508     (deftest defgeneric.19
509       (let ((fn (eval '(defgeneric defgeneric.fun.19 (x &key)
510                          (:method ((x number) &key ((:bar foo) 'a foo-p))
511                                   (list x foo (notnot foo-p)))))))
512         (values
513          (funcall fn 1)
514          (funcall fn 1 :bar nil)
515          (funcall fn 1 :bar 2)))
516       (1 a nil)
517       (1 nil t)
518       (1 2 t))
519    
520    (deftest defgeneric.20
521       (let ((fn (eval '(defgeneric defgeneric.fun.20 (x &optional y z)
522                          (:method ((x number)
523                                    &optional (y (1+ x) y-p)
524                                              (z (if y-p (1+ y) (+ x 10))
525                                                 z-p))
526                                   (list x y (notnot y-p) z (notnot z-p)))))))
527         (values
528          (funcall fn 1)
529          (funcall fn 1 5)
530          (funcall fn 1 5 9)))
531       (1 2 nil 11 nil)
532       (1 5 t 6 nil)
533       (1 5 t 9 t))
534    
535    

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26