-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
64 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#[macro_use] | ||
extern crate holmes; | ||
use holmes::simple::*; | ||
use std::time::{Duration, Instant}; | ||
|
||
// The whole point of this test is to take an excessively long execution | ||
// and make sure it terminates about on time if a limiter is provided | ||
#[test] | ||
pub fn infinity() { | ||
single(&|holmes: &mut Engine, core: &mut Core| { | ||
// Amount of time holmes gets | ||
let limit = Duration::new(2, 0); | ||
// Wiggle room to shut things down | ||
let wiggle = Duration::new(1, 0); | ||
holmes.limit_time(limit.clone()); | ||
let start = Instant::now(); | ||
try!(holmes_exec!(holmes, { | ||
predicate!(count(uint64)); | ||
fact!(count(0)); | ||
func!(let inc: uint64 -> uint64 = |i: &u64| *i + 1); | ||
rule!(inc: count(n_plus_one) <= count(n), { | ||
let n_plus_one = {inc([n])} | ||
}) | ||
})); | ||
core.run(holmes.quiesce()).unwrap(); | ||
assert!(start.elapsed() < limit + wiggle); | ||
Ok(()) | ||
}) | ||
} |