docs improvements
This commit is contained in:
parent
0a81627eca
commit
03d8ead644
|
@ -268,6 +268,39 @@ of random mutators:
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Example:
|
||||||
|
@racketblock[(save-random-mutator "tmp.rkt" "mygc.rkt" #:gc2? #t)]
|
||||||
|
will write to @filepath{tmp.rkt} with a program like this one:
|
||||||
|
@codeblock{
|
||||||
|
#lang plai/gc2/mutator
|
||||||
|
(allocator-setup "mygc.rkt" 200)
|
||||||
|
(define (build-one)
|
||||||
|
(let* ((x0 1)
|
||||||
|
(x1 (cons #f #f))
|
||||||
|
(x2
|
||||||
|
(lambda (x)
|
||||||
|
(if (= x 0)
|
||||||
|
x0
|
||||||
|
(if (= x 1) x0 (if (= x 2) x1 (if (= x 3) x1 x0))))))
|
||||||
|
(x3 1)
|
||||||
|
(x4 (cons x3 x3))
|
||||||
|
(x5 (lambda (x) (if (= x 0) x4 (if (= x 1) x1 x2)))))
|
||||||
|
(set-first! x1 x2)
|
||||||
|
(set-rest! x1 x3)
|
||||||
|
x5))
|
||||||
|
(define (traverse-one x5) (= 1 (first (x5 0))))
|
||||||
|
(define (trigger-gc n)
|
||||||
|
(if (zero? n) 0 (begin (cons n n) (trigger-gc (- n 1)))))
|
||||||
|
(define (loop i)
|
||||||
|
(if (zero? i)
|
||||||
|
'passed
|
||||||
|
(let ((obj (build-one)))
|
||||||
|
(trigger-gc 200)
|
||||||
|
(if (traverse-one obj) (loop (- i 1)) 'failed))))
|
||||||
|
(loop 200)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@defproc[(find-heap-values [input (or/c path-string? input-port?)])
|
@defproc[(find-heap-values [input (or/c path-string? input-port?)])
|
||||||
(listof heap-value?)]{
|
(listof heap-value?)]{
|
||||||
Processes @racket[input] looking for occurrences of @racket[heap-value?]s in
|
Processes @racket[input] looking for occurrences of @racket[heap-value?]s in
|
||||||
|
|
Loading…
Reference in New Issue
Block a user