Skip to content

Commit

Permalink
Fix doc tests
Browse files Browse the repository at this point in the history
  • Loading branch information
oeb25 committed Jul 31, 2024
1 parent 7a75c69 commit 2bd13db
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ cargo add smtlib
Now you can go ahead and use the library in your project.

```rust
use smtlib::{backend::z3_binary::Z3Binary, Int, SatResultWithModel, Solver, Sort};
use smtlib::{backend::z3_binary::Z3Binary, Int, SatResultWithModel, Solver, prelude::*};

fn main() -> Result<(), Box<dyn std::error::Error>> {
// Initialize the solver with the Z3 backend. The "z3" string refers the
Expand All @@ -38,8 +38,8 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut solver = Solver::new(Z3Binary::new("z3")?)?;

// Declare two new variables
let x = Int::from_name("x");
let y = Int::from_name("y");
let x = Int::new_const("x");
let y = Int::new_const("y");

// Assert some constraints. This tells the solver that these expressions
// must be true, so any solution will satisfy these.
Expand Down
4 changes: 2 additions & 2 deletions smtlib/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,10 @@ impl Model {
/// expression asserted.
///
/// ```
/// # use smtlib::{Int, Sort};
/// # use smtlib::{Int, prelude::*};
/// # fn main() -> Result<(), Box<dyn std::error::Error>> {
/// # let mut solver = smtlib::Solver::new(smtlib::backend::z3_binary::Z3Binary::new("z3")?)?;
/// let x = Int::from_name("x");
/// let x = Int::new_const("x");
/// solver.assert(x._eq(12))?;
/// let model = solver.check_sat_with_model()?.expect_sat()?;
/// match model.eval(x) {
Expand Down
4 changes: 2 additions & 2 deletions smtlib/src/solver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ use crate::{
/// The [`Solver`] type is the primary entrypoint to interaction with the
/// solver. Checking for validity of a set of assertions requires:
/// ```
/// # use smtlib::{Int, Sort};
/// # use smtlib::{Int, prelude::*};
/// # fn main() -> Result<(), Box<dyn std::error::Error>> {
/// // 1. Set up the backend (in this case z3)
/// let backend = smtlib::backend::z3_binary::Z3Binary::new("z3")?;
/// // 2. Set up the solver
/// let mut solver = smtlib::Solver::new(backend)?;
/// // 3. Declare the necessary constants
/// let x = Int::from_name("x");
/// let x = Int::new_const("x");
/// // 4. Add assertions to the solver
/// solver.assert(x._eq(12))?;
/// // 5. Check for validity, and optionally construct a model
Expand Down
4 changes: 2 additions & 2 deletions smtlib/src/tokio_solver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ use crate::{Bool, Error, Logic, Model, SatResult, SatResultWithModel};
/// The [`TokioSolver`] type is the primary entrypoint to interaction with the
/// solver. Checking for validity of a set of assertions requires:
/// ```
/// # use smtlib::{Int, Sort};
/// # use smtlib::{Int, prelude::*};
/// # fn main() -> Result<(), Box<dyn std::error::Error>> {
/// # tokio_test::block_on(async {
/// // 1. Set up the backend (in this case z3)
/// let backend = smtlib::backend::z3_binary::tokio::Z3BinaryTokio::new("z3").await?;
/// // 2. Set up the solver
/// let mut solver = smtlib::TokioSolver::new(backend).await?;
/// // 3. Declare the necessary constants
/// let x = Int::from_name("x");
/// let x = Int::new_const("x");
/// // 4. Add assertions to the solver
/// solver.assert(x._eq(12)).await?;
/// // 5. Check for validity, and optionally construct a model
Expand Down

0 comments on commit 2bd13db

Please sign in to comment.