Skip to content

Commit

Permalink
Rule 6
Browse files Browse the repository at this point in the history
  • Loading branch information
CarlKCarlK committed Jun 20, 2023
1 parent 9a8aaed commit 444b9b6
Show file tree
Hide file tree
Showing 6 changed files with 1,354 additions and 33 deletions.
81 changes: 67 additions & 14 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion Cargo.toml
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ thiserror = "1.0"
getrandom = { version = "0.2", optional = true, features = ["js"] } getrandom = { version = "0.2", optional = true, features = ["js"] }
rand = "0.8.4" rand = "0.8.4"


[dev-dependencies] [target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies]
tests_common = { path = "tests_common" } tests_common = { path = "tests_common" }
syntactic-for = "0.1.1" syntactic-for = "0.1.1"
criterion = { version = "0.4", features = ["html_reports"] } criterion = { version = "0.4", features = ["html_reports"] }
Expand All @@ -45,6 +45,10 @@ range-collections = "0.4.0"
range-set = "0.0.9" range-set = "0.0.9"
glob = "0.3.0" glob = "0.3.0"


[target.'cfg(target_arch = "wasm32")'.dev-dependencies]
wasm-bindgen-test = "0.3.37"
syntactic-for = "0.1.1"



# Declare a benchmark called ""bench" without the standard benchmarking harness. # Declare a benchmark called ""bench" without the standard benchmarking harness.
[[bench]] [[bench]]
Expand Down
50 changes: 33 additions & 17 deletions examples/missing.rs
Original file line number Original file line Diff line number Diff line change
@@ -1,21 +1,37 @@
use glob::glob; #[cfg(not(target_arch = "wasm32"))]
use range_set_blaze::prelude::*; mod native {
use std::{ use glob::glob;
error::Error, use range_set_blaze::prelude::*;
fs::File, use std::{
io::{BufRead, BufReader}, error::Error,
}; fs::File,
io::{BufRead, BufReader},
};


fn main() -> Result<(), Box<dyn Error>> { pub(crate) fn inner() -> Result<(), Box<dyn Error>> {
let mut all_exps = RangeSetBlaze::from_iter([0..=99_999_999]); let mut all_exps = RangeSetBlaze::from_iter([0..=99_999_999]);


for path in glob("examples/cluster_file.*.tsv")? { for path in glob("examples/cluster_file.*.tsv")? {
let exp_nums: RangeSetBlaze<_> = BufReader::new(File::open(path?)?) let exp_nums: RangeSetBlaze<_> = BufReader::new(File::open(path?)?)
.lines() .lines()
.filter_map(|line| line.ok()?.split_once('\t')?.0.parse::<u32>().ok()) .filter_map(|line| line.ok()?.split_once('\t')?.0.parse::<u32>().ok())
.collect(); .collect();
all_exps = all_exps - exp_nums; all_exps = all_exps - exp_nums;
}
println!("{all_exps}");
Ok(())
} }
println!("{all_exps}"); }
Ok(())
#[cfg(target_arch = "wasm32")]
mod wasm {
// Code here will only be compiled when the target architecture is WASM.
pub fn inner() {}
}

fn main() {
#[cfg(not(target_arch = "wasm32"))]
native::inner().unwrap();
#[cfg(target_arch = "wasm32")]
wasm::inner();
} }
1 change: 1 addition & 0 deletions src/tests.rs
Original file line number Original file line Diff line number Diff line change
@@ -1,4 +1,5 @@
#![cfg(test)] #![cfg(test)]
#![cfg(not(target_arch = "wasm32"))]


use super::*; use super::*;
use itertools::Itertools; use itertools::Itertools;
Expand Down
3 changes: 2 additions & 1 deletion tests/integration_test.rs
Original file line number Original file line Diff line number Diff line change
@@ -1,4 +1,5 @@
#![cfg(test)] #![cfg(test)]
#![cfg(not(target_arch = "wasm32"))]


use criterion::{BatchSize, BenchmarkId, Criterion}; use criterion::{BatchSize, BenchmarkId, Criterion};
use itertools::Itertools; use itertools::Itertools;
Expand All @@ -14,7 +15,7 @@ use std::{collections::BTreeSet, ops::BitOr};
use syntactic_for::syntactic_for; use syntactic_for::syntactic_for;
use tests_common::{k_sets, width_to_range, How, MemorylessIter, MemorylessRange}; use tests_common::{k_sets, width_to_range, How, MemorylessIter, MemorylessRange};


type I32SafeLen = <i32 as range_set_blaze::Integer>::SafeLen; type I32SafeLen = <i32 as range_set_blaze::Integer>::SafeLen;


#[test] #[test]
fn insert_255u8() { fn insert_255u8() {
Expand Down

0 comments on commit 444b9b6

Please sign in to comment.