Re: [racket-users] testing for timeout in Rackunit?

2016-08-19 Thread Mitchell Wand
Thanks!  You guys are better than a manual.  --Mitch

On Thu, Aug 18, 2016 at 7:56 PM, Ben Greenman 
wrote:

> Also try `call-with-limits` from racket/sandbox
> http://docs.racket-lang.org/reference/Sandboxed_
> Evaluation.html#%28def._%28%28lib._racket%2Fsandbox..rkt%
> 29._call-with-limits%29%29
>
> On Thu, Aug 18, 2016 at 6:37 PM, Matthias Felleisen 
> wrote:
>
>>
>> Do you mean something like this:
>>
>>
>> (define time-limit .1)
>>
>> (define-syntax-rule
>>   (check-termination e)
>>   (check-false (false? (sync/timeout time-limit (thread (λ () (list
>> e)))
>>
>> (check-termination (+ 1 1))
>> (check-termination #f)
>> (check-termination (let loop () (loop)))
>>
>>
>> — Matthias
>>
>>
>> > On Aug 18, 2016, at 5:59 PM, Mitchell Wand  wrote:
>> >
>> > Of course you can't test for non-termination, but is there a relatively
>> simple way to write something like
>> >
>> > (check-doesnt-terminate-quickly  )
>> >
>> > which would fail if the thunk terminates within the time limit, and
>> succeeds otherwise?
>> >
>> > This would be useful in testing expressions that are claimed not to
>> terminate.
>> >
>> > For this use case, it doesn't matter if the time limit is only
>> approximate.
>> >
>> > --Mitch
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> Groups "Racket Users" group.
>> > To unsubscribe from this group and stop receiving emails from it, send
>> an email to racket-users+unsubscr...@googlegroups.com.
>> > For more options, visit https://groups.google.com/d/optout.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Racket Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to racket-users+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] testing for timeout in Rackunit?

2016-08-18 Thread Ben Greenman
Also try `call-with-limits` from racket/sandbox
http://docs.racket-lang.org/reference/Sandboxed_Evaluation.html#%28def._%28%28lib._racket%2Fsandbox..rkt%29._call-with-limits%29%29

On Thu, Aug 18, 2016 at 6:37 PM, Matthias Felleisen 
wrote:

>
> Do you mean something like this:
>
>
> (define time-limit .1)
>
> (define-syntax-rule
>   (check-termination e)
>   (check-false (false? (sync/timeout time-limit (thread (λ () (list
> e)))
>
> (check-termination (+ 1 1))
> (check-termination #f)
> (check-termination (let loop () (loop)))
>
>
> — Matthias
>
>
> > On Aug 18, 2016, at 5:59 PM, Mitchell Wand  wrote:
> >
> > Of course you can't test for non-termination, but is there a relatively
> simple way to write something like
> >
> > (check-doesnt-terminate-quickly  )
> >
> > which would fail if the thunk terminates within the time limit, and
> succeeds otherwise?
> >
> > This would be useful in testing expressions that are claimed not to
> terminate.
> >
> > For this use case, it doesn't matter if the time limit is only
> approximate.
> >
> > --Mitch
> >
> > --
> > You received this message because you are subscribed to the Google
> Groups "Racket Users" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> an email to racket-users+unsubscr...@googlegroups.com.
> > For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] testing for timeout in Rackunit?

2016-08-18 Thread Matthias Felleisen

Do you mean something like this: 


(define time-limit .1)

(define-syntax-rule
  (check-termination e)
  (check-false (false? (sync/timeout time-limit (thread (λ () (list e)))

(check-termination (+ 1 1))
(check-termination #f)
(check-termination (let loop () (loop)))


— Matthias


> On Aug 18, 2016, at 5:59 PM, Mitchell Wand  wrote:
> 
> Of course you can't test for non-termination, but is there a relatively 
> simple way to write something like
> 
> (check-doesnt-terminate-quickly  )
> 
> which would fail if the thunk terminates within the time limit, and succeeds 
> otherwise?  
> 
> This would be useful in testing expressions that are claimed not to terminate.
> 
> For this use case, it doesn't matter if the time limit is only approximate.
> 
> --Mitch
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] testing for timeout in Rackunit?

2016-08-18 Thread Mitchell Wand
Of course you can't test for non-termination, but is there a relatively simple 
way to write something like

(check-doesnt-terminate-quickly  )

which would fail if the thunk terminates within the time limit, and succeeds 
otherwise?  

This would be useful in testing expressions that are claimed not to terminate.

For this use case, it doesn't matter if the time limit is only approximate.

--Mitch

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.