Add wasm tests (#74)
This commit is contained in:
parent
2b2881a375
commit
5077768172
13 changed files with 92 additions and 29 deletions
|
|
@ -7,7 +7,7 @@ use std::ops::{Index, Range};
|
|||
|
||||
use crate::algorithms::utils::{common_prefix_len, common_suffix_len, is_empty_range};
|
||||
use crate::algorithms::DiffHook;
|
||||
use crate::Instant;
|
||||
use crate::deadline_support::{deadline_exceeded, Instant};
|
||||
|
||||
/// LCS diff algorithm.
|
||||
///
|
||||
|
|
@ -166,10 +166,8 @@ where
|
|||
|
||||
for i in (0..new_len).rev() {
|
||||
// are we running for too long? give up on the table
|
||||
if let Some(deadline) = deadline {
|
||||
if Instant::now() > deadline {
|
||||
return None;
|
||||
}
|
||||
if deadline_exceeded(deadline) {
|
||||
return None;
|
||||
}
|
||||
|
||||
for j in (0..old_len).rev() {
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ pub(crate) mod utils;
|
|||
use std::hash::Hash;
|
||||
use std::ops::{Index, Range};
|
||||
|
||||
use crate::Instant;
|
||||
use crate::deadline_support::Instant;
|
||||
pub use capture::Capture;
|
||||
pub use compact::Compact;
|
||||
pub use hook::{DiffHook, NoFinishHook};
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ use std::ops::{Index, IndexMut, Range};
|
|||
|
||||
use crate::algorithms::utils::{common_prefix_len, common_suffix_len, is_empty_range};
|
||||
use crate::algorithms::DiffHook;
|
||||
use crate::Instant;
|
||||
use crate::deadline_support::{deadline_exceeded, Instant};
|
||||
|
||||
/// Myers' diff algorithm.
|
||||
///
|
||||
|
|
@ -175,10 +175,8 @@ where
|
|||
|
||||
for d in 0..d_max as isize {
|
||||
// are we running for too long?
|
||||
if let Some(deadline) = deadline {
|
||||
if Instant::now() > deadline {
|
||||
break;
|
||||
}
|
||||
if deadline_exceeded(deadline) {
|
||||
break;
|
||||
}
|
||||
|
||||
// Forward path
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ use std::hash::Hash;
|
|||
use std::ops::{Index, Range};
|
||||
|
||||
use crate::algorithms::{myers, DiffHook, NoFinishHook, Replace};
|
||||
use crate::Instant;
|
||||
use crate::deadline_support::Instant;
|
||||
|
||||
use super::utils::{unique, UniqueItem};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue