Skip to content
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

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open

Blocker #36

wants to merge 13 commits into from

Conversation

seb-hyland
Copy link
Contributor

No description provided.

@lhao03 lhao03 self-requested a review August 19, 2024 18:32
Comment on lines 89 to 99
#[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
}
}

Copy link
Member

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?

Copy link
Contributor Author

@seb-hyland seb-hyland Aug 19, 2024

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).

Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Contributor Author

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants