// Every kind of value, to check how spock check prints them.
type Proc;
type Msg = | Ping | Data { from: Proc, n: Int } | Pair(Int, Bool)
struct Inner { a: Int, b: Bool }
struct State {
o: Option<Int>,
t: (Int, Bool),
s: Seq<Int>,
m: Set<Msg>,
inner: Inner,
k: Map<Proc, Int>,
}
impl State {
action init() -> State {
State {
o: None,
t: (1, true),
s: [],
m: {Ping},
inner: Inner { a: 0, b: false },
k: { p -> 0 for p: Proc },
}
}
action next(self) -> State {
require self.inner.a < 1;
let p = one_of({p for p: Proc});
Self {
..self,
o: Some(3),
s: self.s.push(7),
m: self.m | {Data { from: p, n: 2 }, Pair(1, false)},
inner: Inner { ..self.inner, a: 1 },
k: self.k.update(p, 5),
}
}
fn small(self) -> Bool {
self.inner.a < 1
}
}
model m {
type Proc = {a, b};
init = State::init;
next = State::next;
invariants = [State::small];
}