(declare (block) (standard-bindings) (extended-bindings))
(begin
  (define std/test#!check-fail::t
    (make-struct-type
     'std/test#!check-fail::t
     '#f
     '3
     '!check-fail
     '()
     '#f
     '(e value loc)))
  (define std/test#!check-fail?
    (make-struct-predicate std/test#!check-fail::t))
  (define std/test#make-!check-fail
    (lambda _$args38906_
      (apply make-struct-instance std/test#!check-fail::t _$args38906_)))
  (define std/test#!check-fail-e
    (make-struct-field-accessor std/test#!check-fail::t '0))
  (define std/test#!check-fail-value
    (make-struct-field-accessor std/test#!check-fail::t '1))
  (define std/test#!check-fail-loc
    (make-struct-field-accessor std/test#!check-fail::t '2))
  (define std/test#!check-fail-e-set!
    (make-struct-field-mutator std/test#!check-fail::t '0))
  (define std/test#!check-fail-value-set!
    (make-struct-field-mutator std/test#!check-fail::t '1))
  (define std/test#!check-fail-loc-set!
    (make-struct-field-mutator std/test#!check-fail::t '2))
  (define std/test#!check-error::t
    (make-struct-type
     'std/test#!check-error::t
     '#f
     '3
     '!check-error
     '()
     '#f
     '(exn check loc)))
  (define std/test#!check-error?
    (make-struct-predicate std/test#!check-error::t))
  (define std/test#make-!check-error
    (lambda _$args38903_
      (apply make-struct-instance std/test#!check-error::t _$args38903_)))
  (define std/test#!check-error-exn
    (make-struct-field-accessor std/test#!check-error::t '0))
  (define std/test#!check-error-check
    (make-struct-field-accessor std/test#!check-error::t '1))
  (define std/test#!check-error-loc
    (make-struct-field-accessor std/test#!check-error::t '2))
  (define std/test#!check-error-exn-set!
    (make-struct-field-mutator std/test#!check-error::t '0))
  (define std/test#!check-error-check-set!
    (make-struct-field-mutator std/test#!check-error::t '1))
  (define std/test#!check-error-loc-set!
    (make-struct-field-mutator std/test#!check-error::t '2))
  (define std/test#!test-suite::t
    (make-struct-type
     'std/test#!test-suite::t
     '#f
     '3
     '!test-suite
     '()
     '#f
     '(desc thunk tests)))
  (define std/test#!test-suite?
    (make-struct-predicate std/test#!test-suite::t))
  (define std/test#make-!test-suite
    (lambda _$args38900_
      (apply make-struct-instance std/test#!test-suite::t _$args38900_)))
  (define std/test#!test-suite-desc
    (make-struct-field-accessor std/test#!test-suite::t '0))
  (define std/test#!test-suite-thunk
    (make-struct-field-accessor std/test#!test-suite::t '1))
  (define std/test#!test-suite-tests
    (make-struct-field-accessor std/test#!test-suite::t '2))
  (define std/test#!test-suite-desc-set!
    (make-struct-field-mutator std/test#!test-suite::t '0))
  (define std/test#!test-suite-thunk-set!
    (make-struct-field-mutator std/test#!test-suite::t '1))
  (define std/test#!test-suite-tests-set!
    (make-struct-field-mutator std/test#!test-suite::t '2))
  (define std/test#!test-case::t
    (make-struct-type
     'std/test#!test-case::t
     '#f
     '4
     '!test-case
     '()
     '#f
     '(desc checks fail error)))
  (define std/test#!test-case? (make-struct-predicate std/test#!test-case::t))
  (define std/test#make-!test-case
    (lambda _$args38897_
      (apply make-struct-instance std/test#!test-case::t _$args38897_)))
  (define std/test#!test-case-desc
    (make-struct-field-accessor std/test#!test-case::t '0))
  (define std/test#!test-case-checks
    (make-struct-field-accessor std/test#!test-case::t '1))
  (define std/test#!test-case-fail
    (make-struct-field-accessor std/test#!test-case::t '2))
  (define std/test#!test-case-error
    (make-struct-field-accessor std/test#!test-case::t '3))
  (define std/test#!test-case-desc-set!
    (make-struct-field-mutator std/test#!test-case::t '0))
  (define std/test#!test-case-checks-set!
    (make-struct-field-mutator std/test#!test-case::t '1))
  (define std/test#!test-case-fail-set!
    (make-struct-field-mutator std/test#!test-case::t '2))
  (define std/test#!test-case-error-set!
    (make-struct-field-mutator std/test#!test-case::t '3))
  (define std/test#!check-error::display-exception
    (lambda (_self38858_ _port38859_)
      (let* ((_self3886038868_ _self38858_)
             (_E3886238872_
              (lambda () (error '"No clause matching" _self3886038868_)))
             (_K3886338879_
              (lambda (_loc38875_ _check38876_ _exn38877_)
                (std/format#fprintf
                 _port38859_
                 '"~a at ~a: "
                 _check38876_
                 _loc38875_)
                (display-exception _exn38877_ _port38859_))))
        (if (##structure-instance-of?
             _self3886038868_
             'std/test#!check-error::t)
            (let* ((_e3886438882_ (##vector-ref _self3886038868_ '1))
                   (_exn38885_ _e3886438882_)
                   (_e3886538887_ (##vector-ref _self3886038868_ '2))
                   (_check38890_ _e3886538887_)
                   (_e3886638892_ (##vector-ref _self3886038868_ '3))
                   (_loc38895_ _e3886638892_))
              (_K3886338879_ _loc38895_ _check38890_ _exn38885_))
            (_E3886238872_)))))
  (bind-method!
   std/test#!check-error::t
   'display-exception
   std/test#!check-error::display-exception
   '#f)
  (define std/test#!check-fail::display-exception
    (lambda (_self38697_ _port38698_)
      (let* ((_self3869938707_ _self38697_)
             (_E3870138711_
              (lambda () (error '"No clause matching" _self3869938707_)))
             (_K3870238718_
              (lambda (_loc38714_ _value38715_ _check38716_)
                (std/format#fprintf
                 _port38698_
                 '"check ~a at ~a FAILED: ~a~n"
                 _check38716_
                 _loc38714_
                 _value38715_))))
        (if (##structure-instance-of?
             _self3869938707_
             'std/test#!check-fail::t)
            (let* ((_e3870338721_ (##vector-ref _self3869938707_ '1))
                   (_check38724_ _e3870338721_)
                   (_e3870438726_ (##vector-ref _self3869938707_ '2))
                   (_value38729_ _e3870438726_)
                   (_e3870538731_ (##vector-ref _self3869938707_ '3))
                   (_loc38734_ _e3870538731_))
              (_K3870238718_ _loc38734_ _value38729_ _check38724_))
            (_E3870138711_)))))
  (bind-method!
   std/test#!check-fail::t
   'display-exception
   std/test#!check-fail::display-exception
   '#f)
  (define std/test#*test-verbose* '#t)
  (define std/test#set-test-verbose!
    (lambda (_val38573_) (set! std/test#*test-verbose* _val38573_)))
  (define std/test#verbose
    (lambda (_fmt38570_ . _args38571_)
      (if std/test#*test-verbose*
          (apply std/format#printf _fmt38570_ _args38571_)
          '#!void)))
  (define std/test#not-eq?
    (lambda (_x38567_ _y38568_) (not (eq? _x38567_ _y38568_))))
  (define std/test#not-eqv?
    (lambda (_x38564_ _y38565_) (not (eqv? _x38564_ _y38565_))))
  (define std/test#equal-values?
    (lambda (_obj-a38561_ _obj-b38562_)
      (if (##values? _obj-a38561_)
          (if (##values? _obj-b38562_)
              (equal? (##vector->list _obj-a38561_)
                      (##vector->list _obj-b38562_))
              '#f)
          (equal? _obj-a38561_ _obj-b38562_))))
  (define std/test#not-equal-values?
    (lambda (_x38558_ _y38559_)
      (not (std/test#equal-values? _x38558_ _y38559_))))
  (define std/test#with-check-error
    (lambda (_thunk38547_ _what38548_ _loc38549_)
      (with-exception-catcher
       (lambda (_g3855038552_)
         (if '#t
             (let ((_e38555_ _g3855038552_))
               (raise (##structure
                       std/test#!check-error::t
                       _e38555_
                       _what38548_
                       _loc38549_)))
             (raise _g3855038552_)))
       (lambda () (_thunk38547_)))))
  (define std/test#current-test-case (make-parameter '#f))
  (define std/test#current-test-suite (make-parameter '#f))
  (define std/test#*tests* '())
  (define std/test#make-test-suite
    (lambda (_desc38544_ _thunk38545_)
      (##structure std/test#!test-suite::t _desc38544_ _thunk38545_ '())))
  (define std/test#run-tests!
    (lambda (_suite38541_ . _more38542_)
      (std/test#test-begin!)
      (std/test#run-test-suite! _suite38541_)
      (for-each std/test#run-test-suite! _more38542_)))
  (define std/test#test-report-summary!
    (lambda ()
      (let ((_tests38539_ (reverse std/test#*tests*)))
        (if (null? _tests38539_)
            '#!void
            (begin
              (std/format#eprintf '"--- Test Summary\n")
              (for-each std/test#test-suite-summary! _tests38539_)
              (std/format#eprintf '"~a~n" (std/test#test-result)))))))
  (define std/test#test-result
    (lambda ()
      (let _lp38495_ ((_rest38497_ std/test#*tests*))
        (let* ((_rest3849838506_ _rest38497_)
               (_else3850038514_ (lambda () 'OK))
               (_K3850238526_
                (lambda (_rest38517_ _suite38518_)
                  (if (ormap1 (lambda (_$obj38520_)
                                (or (##structure-ref
                                     _$obj38520_
                                     '3
                                     std/test#!test-case::t
                                     '#f)
                                    (##structure-ref
                                     _$obj38520_
                                     '4
                                     std/test#!test-case::t
                                     '#f)))
                              (##structure-ref
                               _suite38518_
                               '3
                               std/test#!test-suite::t
                               '#f))
                      'FAILURE
                      (_lp38495_ _rest38517_)))))
          (if (##pair? _rest3849838506_)
              (let ((_hd3850338529_ (##car _rest3849838506_))
                    (_tl3850438531_ (##cdr _rest3849838506_)))
                (let* ((_suite38534_ _hd3850338529_)
                       (_rest38536_ _tl3850438531_))
                  (_K3850238526_ _rest38536_ _suite38534_)))
              (_else3850038514_))))))
  (define std/test#test-suite-summary!
    (lambda (_suite38470_)
      (letrec ((_print-failed38472_
                (lambda (_tc38482_)
                  (let ((_$e38484_
                         (##structure-ref
                          _tc38482_
                          '3
                          std/test#!test-case::t
                          '#f)))
                    (if _$e38484_
                        ((lambda (_fail38487_)
                           (std/format#eprintf
                            '"~a: Check FAILED ~a at ~a~n"
                            (##structure-ref
                             _tc38482_
                             '1
                             std/test#!test-case::t
                             '#f)
                            (##structure-ref
                             _fail38487_
                             '1
                             std/test#!check-fail::t
                             '#f)
                            (##structure-ref
                             _fail38487_
                             '3
                             std/test#!check-fail::t
                             '#f)))
                         _$e38484_)
                        (let ((_$e38489_
                               (##structure-ref
                                _tc38482_
                                '4
                                std/test#!test-case::t
                                '#f)))
                          (if _$e38489_
                              ((lambda (_exn38492_)
                                 (std/format#eprintf
                                  '"~a: ERROR "
                                  (##structure-ref
                                   _tc38482_
                                   '1
                                   std/test#!test-case::t
                                   '#f))
                                 (display-exception
                                  _exn38492_
                                  (current-error-port)))
                               _$e38489_)
                              '#!void)))))))
        (let ((_tests38474_
               (##structure-ref _suite38470_ '3 std/test#!test-suite::t '#f)))
          (if (ormap1 (lambda (_$obj38476_)
                        (or (##structure-ref
                             _$obj38476_
                             '3
                             std/test#!test-case::t
                             '#f)
                            (##structure-ref
                             _$obj38476_
                             '4
                             std/test#!test-case::t
                             '#f)))
                      _tests38474_)
              (begin
                (std/format#eprintf
                 '"~a: FAILED~n"
                 (##structure-ref _suite38470_ '1 std/test#!test-suite::t '#f))
                (for-each _print-failed38472_ _tests38474_))
              (std/format#eprintf
               '"~a: OK~n"
               (##structure-ref
                _suite38470_
                '1
                std/test#!test-suite::t
                '#f)))))))
  (define std/test#test-begin! (lambda () (set! std/test#*tests* '())))
  (define std/test#test-add-test!
    (lambda (_suite38467_)
      (set! std/test#*tests* (cons _suite38467_ std/test#*tests*))))
  (define std/test#run-test-suite!
    (lambda (_suite38464_)
      (std/test#test-suite-begin! _suite38464_)
      (call-with-parameters
       (lambda ()
         ((##structure-ref _suite38464_ '2 std/test#!test-suite::t '#f)))
       std/test#current-test-suite
       _suite38464_)
      (std/test#test-suite-end! _suite38464_)))
  (define std/test#test-suite-begin!
    (lambda (_suite38462_)
      (##structure-set! _suite38462_ '() '3 std/test#!test-suite::t '#f)
      (std/test#test-add-test! _suite38462_)
      (std/format#eprintf
       '"Test suite: ~a~n"
       (##structure-ref _suite38462_ '1 std/test#!test-suite::t '#f))))
  (define std/test#test-suite-end!
    (lambda (_suite38454_)
      (if (find (lambda (_$obj38456_)
                  (or (##structure-ref
                       _$obj38456_
                       '3
                       std/test#!test-case::t
                       '#f)
                      (##structure-ref
                       _$obj38456_
                       '4
                       std/test#!test-case::t
                       '#f)))
                (##structure-ref _suite38454_ '3 std/test#!test-suite::t '#f))
          (std/format#eprintf '"*** Test FAILED~n")
          (std/format#eprintf '"... All tests OK~n"))))
  (define std/test#test-suite-add-test!
    (lambda (_suite38451_ _tc38452_)
      (##structure-set!
       _suite38451_
       (cons _tc38452_
             (##structure-ref _suite38451_ '3 std/test#!test-suite::t '#f))
       '3
       std/test#!test-suite::t
       '#f)))
  (define std/test#run-test-case!
    (lambda (_desc38433_ _thunk38434_)
      (let ((_tc38436_
             (##structure std/test#!test-case::t _desc38433_ '0 '#f '#f)))
        (std/test#test-case-begin! _tc38436_)
        (with-exception-catcher
         (lambda (_g3843738439_)
           (if ((lambda (_$obj38442_)
                  (##structure-instance-of?
                   _$obj38442_
                   'std/test#!check-fail::t))
                _g3843738439_)
               (let ((_e38445_ _g3843738439_))
                 (##structure-set!
                  _tc38436_
                  _e38445_
                  '3
                  std/test#!test-case::t
                  '#f))
               (if '#t
                   (let ((_e38447_ _g3843738439_))
                     (##structure-set!
                      _tc38436_
                      _e38447_
                      '4
                      std/test#!test-case::t
                      '#f))
                   (raise _g3843738439_))))
         (lambda ()
           (call-with-parameters
            (lambda () (_thunk38434_))
            std/test#current-test-case
            _tc38436_)))
        (if std/test#*test-verbose* (force-output) '#!void)
        (std/test#test-case-end! _tc38436_))))
  (define std/test#test-case-begin!
    (lambda (_tc38424_)
      (std/format#eprintf
       '"Test case: ~a~n"
       (##structure-ref _tc38424_ '1 std/test#!test-case::t '#f))
      (let ((_$e38426_ (std/test#current-test-suite)))
        (if _$e38426_
            ((lambda (_g3842838430_)
               (std/test#test-suite-add-test! _g3842838430_ _tc38424_))
             _$e38426_)
            '#!void))))
  (define std/test#test-case-end!
    (lambda (_tc38412_)
      (let ((_$e38414_
             (##structure-ref _tc38412_ '3 std/test#!test-case::t '#f)))
        (if _$e38414_
            ((lambda (_fail38417_)
               (std/format#eprintf
                '"*** FAILED: ~a at ~a; value: ~s~n"
                (##structure-ref _fail38417_ '1 std/test#!check-fail::t '#f)
                (##structure-ref _fail38417_ '3 std/test#!check-fail::t '#f)
                (##structure-ref _fail38417_ '2 std/test#!check-fail::t '#f)))
             _$e38414_)
            (let ((_$e38419_
                   (##structure-ref _tc38412_ '4 std/test#!test-case::t '#f)))
              (if _$e38419_
                  ((lambda (_e38422_)
                     (std/format#eprintf '"*** ERROR: ")
                     (display-exception _e38422_ (current-error-port)))
                   _$e38419_)
                  (std/format#eprintf
                   '"... ~a checks OK~n"
                   (##structure-ref
                    _tc38412_
                    '2
                    std/test#!test-case::t
                    '#f))))))))
  (define std/test#test-case-add-check!
    (lambda (_tc38410_)
      (if _tc38410_
          (##structure-set!
           _tc38410_
           (fx+ (##structure-ref _tc38410_ '2 std/test#!test-case::t '#f) '1)
           '2
           std/test#!test-case::t
           '#f)
          '#!void)))
  (define std/test#test-check-e
    (lambda (_what38402_ _eqf38403_ _thunk38404_ _value38405_ _loc38406_)
      (std/test#test-case-add-check! (std/test#current-test-case))
      (let ((_val38408_
             (std/test#with-check-error _thunk38404_ _what38402_ _loc38406_)))
        (if (_eqf38403_ _val38408_ _value38405_)
            '#!void
            (raise (##structure
                    std/test#!check-fail::t
                    _what38402_
                    _val38408_
                    _loc38406_))))))
  (define std/test#test-check-output
    (lambda (_what38394_ _thunk38395_ _value38396_ _loc38397_)
      (std/test#test-case-add-check! (std/test#current-test-case))
      (let ((_val38400_
             (with-output-to-string
              '()
              (lambda ()
                (std/test#with-check-error
                 _thunk38395_
                 _what38394_
                 _loc38397_)))))
        (if (equal? _val38400_ _value38396_)
            '#!void
            (raise (##structure
                    std/test#!check-fail::t
                    _what38394_
                    _val38400_
                    _loc38397_))))))
  (define std/test#test-check-predicate
    (lambda (_what38387_ _thunk38388_ _pred38389_ _loc38390_)
      (std/test#test-case-add-check! (std/test#current-test-case))
      (let ((_val38392_
             (std/test#with-check-error _thunk38388_ _what38387_ _loc38390_)))
        (if (_pred38389_ _val38392_)
            '#!void
            (raise (##structure
                    std/test#!check-fail::t
                    _what38387_
                    _val38392_
                    _loc38390_))))))
  (define std/test#test-check-exception
    (lambda (_what38375_ _thunk38376_ _pred38377_ _loc38378_)
      (std/test#test-case-add-check! (std/test#current-test-case))
      (call-with-current-continuation
       (lambda (_success38380_)
         (call-with-current-continuation
          (lambda (_fail-to-throw38382_)
            (let ((_val38385_
                   (with-exception-catcher
                    values
                    (lambda () (_thunk38376_) (_fail-to-throw38382_)))))
              (if (_pred38377_ _val38385_)
                  (_success38380_)
                  (raise (##structure
                          std/test#!check-fail::t
                          _what38375_
                          _val38385_
                          _loc38378_))))))
         (raise (##structure
                 std/test#!check-fail::t
                 _what38375_
                 '(failed to throw an exception)
                 _loc38378_)))))))
