[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

test suite candidate




Has anyone worked on a test suite?  Here's a suggestion for inclusion,
which, fortunately, works in the three implementation in which I tried
it.  I leave the significance of this test as an exercise.

		- Jonathan


(define (tst)
  
  (define k1 #f)
  (define k2 #f)
  (define cwcc call-with-current-continuation)
  (define step 0)
  
  (define (detect-lossage)
    (set! step (+ step 1))
    (case step
      ((1) (cwcc (lambda (k) (set! k1 k) 'a)))
      ((2) (cwcc (lambda (k) (set! k2 k) 'b)))
      ((4) 'd)))
  
  (let ((answer (list (detect-lossage) (detect-lossage))))
    (set! step (+ step 1))
    (case step
      ((3) (k1 'c))   ;answer = (a b) or (b a)
      ((5) (k2 'e))   ;answer = (c d) or (d c)
      ((6)
       (cond ((or (equal? answer '(a e))
		  (equal? answer '(e a)))
	      'wins)
	     ((or (equal? answer '(c e))
		  (equal? answer '(e c)))
	      'loses)
	     (else (list 'really-loses answer)))))))