Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions tests/model_based.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
//! Model-based tests: traces generated from `spec/planner.qnt` are replayed
//! against the Rust implementation, and both states are compared after each
//! step.
//!
//! This file is the exercise of step 1: fill in every `TODO` below.
//! See `docs/tutorial.md` for what each of them is asking for.

use itf::de::{self, As};
use quint_connect::{Config, Driver, Result, State, Step, quint_run, switch};
Expand Down Expand Up @@ -35,7 +32,9 @@ impl State<PlannerDriver> for ModelState {
let planner = &driver.planner;
Ok(Self {
start: planner.start(),
// TODO: read the three remaining values out of `planner`.
goal: planner.goal(),
obstacle: planner.obstacle(),
result: planner.result().clone(),
})
}
}
Expand All @@ -50,10 +49,9 @@ impl Driver for PlannerDriver {
type State = ModelState;

fn config() -> Config {
// The whole state of the specification lives in a single variable.
// The whole state of the specification lives in the `state` variable.
Config {
// TODO: name that variable.
state: &["<target variable>"],
state: &["state"],
..Config::default()
}
}
Expand All @@ -69,7 +67,8 @@ impl Driver for PlannerDriver {
fn step(&mut self, step: &Step) -> Result {
switch!(step {
init(start, goal, obstacle, blocked) => self.set_inputs(start, goal, obstacle, blocked),
// TODO: add an arm for every other action the specification can take.
reset(start, goal, obstacle, blocked) => self.set_inputs(start, goal, obstacle, blocked),
computePlan => self.planner.compute_plan(),
})
}
}
Expand All @@ -94,6 +93,7 @@ impl PlannerDriver {
///
/// Failures report the seed the traces were generated from; set `QUINT_SEED` to
/// that value to replay exactly the same ones.
// TODO: name the specification file.
#[quint_run(spec = "<target spec>", max_samples = 100, max_steps = 20)]
// TODO: add the test function, which returns the driver to replay the traces through.
#[quint_run(spec = "spec/planner.qnt", max_samples = 100, max_steps = 20)]
fn planner_model_based_test() -> impl Driver {
PlannerDriver::default()
}
Loading