-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Blocker #36
base: main
Are you sure you want to change the base?
Blocker #36
Conversation
src-tauri/src/blocker.rs
Outdated
#[quickcheck] | ||
fn random_vec_check(bytes: Vec<u8>) -> bool { | ||
let blocker = BitBlocker {}; | ||
let bits = BitVec::from_vec(bytes.clone()); | ||
if bytes.len() > 0 { | ||
bits == blocker.rebuild(blocker.block(bits.clone(), 20, 15), 15) | ||
} else { | ||
true | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Initial sequence: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
Blocked sequences:
Bl0: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
Bl1: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
thread 'blocker::tests::random_vec_check' panicked at src/blocker.rs:55:13:
Error: No starting block found!
Initial sequence: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
Blocked sequences:
Bl0: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
thread 'blocker::tests::random_vec_check' panicked at src/blocker.rs:55:13:
Error: No starting block found!
Initial sequence: [0, 0, 0, 0, 0, 0, 0, 0]
Blocked sequences:
Bl0: [0, 0, 0, 0, 0, 0, 0, 0]
thread 'blocker::tests::random_vec_check' panicked at src/blocker.rs:41:37:
attempt to subtract with overflow
thread 'blocker::tests::random_vec_check' panicked at /Users/lucyhao/.cargo/registry/src/index.crates.io-6f17d22bba15001f/quickcheck-1.0.3/src/tester.rs:165:28:
[quickcheck] TEST FAILED (runtime error). Arguments: ([0])
Error: "attempt to subtract with overflow"
I added a quick check test; can you determine why those errors are happening, esp the subtract with overflow?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From briefly scanning over your test output, it seems like rebuild
should fail for all these sequences (in the sense that they are unrecoverable). However, I will add proper error handling to have the function return an error rather than panic (I'll add error handling with result
and modify main.rs
accordingly).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the update on this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Lucy, I have added in the extensive error handling and patched out the bug I mentioned yesterday. AFAIK this should be ready for merge, but please feel free to pull and check yourself beforehand.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to clarify though, metadata seems to no longer store per_overlap, and main doesn't seem to implement the block function at all. Is this intended?
No description provided.