Add wasm tests (#74)

This commit is contained in:
Armin Ronacher 2025-01-19 15:36:34 +01:00 committed by GitHub
parent 2b2881a375
commit 5077768172
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 92 additions and 29 deletions

View file

@ -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() {

View file

@ -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};

View file

@ -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

View file

@ -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};