1
// Skipped under Miri: these tests compile+run wasm via wasmtime, whose
2
// Cranelift backend refuses to run under Miri.
3
#![cfg(not(miri))]
4

            
5
//! PERSIST rows: an instance survives beside a heap that is cyclic or large;
6
//! the read of the heap visits each object once.
7

            
8
#[path = "persist/rows.rs"]
9
mod persist;
10

            
11
use persist::{Row, assert_pinned, row};
12

            
13
const PT: &str = "(defstruct pt x)";
14
const P: &str = "(defvar *p* (make-pt :x 1))";
15

            
16
1
fn rows() -> Vec<Row> {
17
1
    vec![
18
1
        row(
19
1
            "K2a",
20
1
            &[
21
1
                PT,
22
1
                P,
23
1
                "(defvar *h* (let ((g (lambda () 0))) (setf g (lambda () (funcall g))) g))",
24
1
                "(pt-x *p*)",
25
1
            ],
26
1
        ),
27
1
        row(
28
1
            "K2b",
29
1
            &[
30
1
                PT,
31
1
                P,
32
1
                "(defvar *l* (do ((i 0 (+ i 1)) (acc nil (cons i acc))) ((= i 600000) acc)))",
33
1
                "(pt-x *p*)",
34
1
                "(length *l*)",
35
1
            ],
36
1
        ),
37
    ]
38
1
}
39

            
40
/// CL: K2a 1, K2b 1 and 600000.
41
const CL: &[(&str, &[&str])] = &[
42
    ("K2a", &["pt", "-", "-", "1"]),
43
    ("K2b", &["pt", "-", "-", "1", "600000"]),
44
];
45

            
46
#[test]
47
1
fn every_row_reads_as_common_lisp() {
48
1
    assert_pinned(&rows(), CL);
49
1
}