Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
21
Task/Loops-Wrong-ranges/Racket/loops-wrong-ranges.rkt
Normal file
21
Task/Loops-Wrong-ranges/Racket/loops-wrong-ranges.rkt
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
#lang racket
|
||||
|
||||
(require racket/sandbox)
|
||||
|
||||
(define tests '([-2 2 1 "Normal"]
|
||||
[-2 2 0 "Zero increment"]
|
||||
[-2 2 -1 "Increments away from stop value"]
|
||||
[-2 2 10 "First increment is beyond stop value"]
|
||||
[2 -2 1 "Start more than stop: positive increment"]
|
||||
[2 2 1 "Start equal stop: positive increment"]
|
||||
[2 2 -1 "Start equal stop: negative increment"]
|
||||
[2 2 0 "Start equal stop: zero increment"]
|
||||
[0 0 0 "Start equal stop equal zero: zero increment"]))
|
||||
|
||||
(for ([test (in-list tests)])
|
||||
(match-define (list st ed inc desc) test)
|
||||
(printf "~a:\n (in-range ~a ~a ~a) = ~a\n\n"
|
||||
desc st ed inc
|
||||
(with-handlers ([exn:fail:resource? (thunk* 'timeout)])
|
||||
(with-limits 1 #f
|
||||
(sequence->list (in-range st ed inc))))))
|
||||
Loading…
Add table
Add a link
Reference in a new issue