-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathparallel_test.mbt
More file actions
27 lines (27 loc) · 983 Bytes
/
parallel_test.mbt
File metadata and controls
27 lines (27 loc) · 983 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
///|
// Parallel linearisation smoke test:
// The sad-state blog explains parallel checking as collecting concurrent
// history and finding an interleaving accepted by the sequential model. This
// library currently uses a deterministic linearisation path; the test pins the
// prefix-left-right order that later linearizability checks will refine.
test "parallel commands linearise deterministically" {
let first = @quickcheck_statemachine.Command::{
command: CounterIncr,
response: CounterIncrDone,
vars: [],
}
let second = @quickcheck_statemachine.Command::{
command: CounterGet,
response: CounterGot(1),
vars: [],
}
let parallel = @quickcheck_statemachine.ParallelCommands::{
prefix: { commands: [first] },
left: { commands: [second] },
right: { commands: [] },
}
guard @quickcheck_statemachine.linearise(parallel) is Some(commands) else {
fail("expected deterministic linearization")
}
assert_eq(commands.length(), 2)
}