Skip to content

Commit

Permalink
Merge branch 'dev' into feat/ws-relay
Browse files Browse the repository at this point in the history
  • Loading branch information
themighty1 authored Oct 18, 2024
2 parents 522b735 + 6f62968 commit 84f5446
Show file tree
Hide file tree
Showing 16 changed files with 1,393 additions and 285 deletions.
2 changes: 1 addition & 1 deletion spansy/src/http/types.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use utils::range::{RangeDifference, RangeSet, ToRangeSet};
use utils::range::{Difference, RangeSet, ToRangeSet};

use crate::{json::JsonValue, Span, Spanned};

Expand Down
2 changes: 1 addition & 1 deletion spansy/src/json/types.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::ops::{Index, Range};

use utils::range::{RangeDifference, RangeSet, ToRangeSet};
use utils::range::{Difference, RangeSet, ToRangeSet};

use crate::{Span, Spanned};

Expand Down
24 changes: 24 additions & 0 deletions utils/fuzz/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,18 @@ path = "fuzz_targets/range_diff_set.rs"
test = false
doc = false

[[bin]]
name = "range_intersection_set"
path = "fuzz_targets/range_intersection_set.rs"
test = false
doc = false

[[bin]]
name = "range_subset_set"
path = "fuzz_targets/range_subset_set.rs"
test = false
doc = false

[[bin]]
name = "set_union_range"
path = "fuzz_targets/set_union_range.rs"
Expand All @@ -58,6 +70,18 @@ path = "fuzz_targets/set_diff_set.rs"
test = false
doc = false

[[bin]]
name = "set_intersection_set"
path = "fuzz_targets/set_intersection_set.rs"
test = false
doc = false

[[bin]]
name = "set_subset_set"
path = "fuzz_targets/set_subset_set.rs"
test = false
doc = false

[[bin]]
name = "set_diff_range"
path = "fuzz_targets/set_diff_range.rs"
Expand Down
25 changes: 25 additions & 0 deletions utils/fuzz/fuzz_targets/range_intersection_set.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#![no_main]

use std::collections::HashSet;
use std::ops::Range;

use libfuzzer_sys::fuzz_target;

use tlsn_utils_fuzz::{assert_invariants, SmallSet};

use utils::range::*;

fuzz_target!(|r: (Range<u8>, SmallSet)| {
let s1 = r.0;
let s2: RangeSet<u8> = r.1.into();

let h1: HashSet<u8> = HashSet::from_iter(s1.clone());
let h2: HashSet<u8> = HashSet::from_iter(s2.iter());

let intersection = s1.intersection(&s2);
let h3: HashSet<u8> = HashSet::from_iter(intersection.iter());

assert_eq!(h3, h1.intersection(&h2).copied().collect::<HashSet<_>>());

assert_invariants(intersection);
});
20 changes: 20 additions & 0 deletions utils/fuzz/fuzz_targets/range_subset_set.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#![no_main]

use std::collections::HashSet;
use std::ops::Range;

use libfuzzer_sys::fuzz_target;

use tlsn_utils_fuzz::SmallSet;

use utils::range::*;

fuzz_target!(|r: (Range<u8>, SmallSet)| {
let s1 = r.0;
let s2: RangeSet<u8> = r.1.into();

let h1: HashSet<u8> = HashSet::from_iter(s1.clone());
let h2: HashSet<u8> = HashSet::from_iter(s2.iter());

assert_eq!(s1.is_subset(&s2), h1.is_subset(&h2));
});
24 changes: 24 additions & 0 deletions utils/fuzz/fuzz_targets/set_intersection_set.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#![no_main]

use std::collections::HashSet;

use libfuzzer_sys::fuzz_target;

use tlsn_utils_fuzz::{assert_invariants, SmallSet};

use utils::range::*;

fuzz_target!(|r: (SmallSet, SmallSet)| {
let s1: RangeSet<u8> = r.0.into();
let s2: RangeSet<u8> = r.1.into();

let h1: HashSet<u8> = HashSet::from_iter(s1.iter());
let h2: HashSet<u8> = HashSet::from_iter(s2.iter());

let intersection = s1.intersection(&s2);
let h3: HashSet<u8> = HashSet::from_iter(intersection.iter());

assert_eq!(h3, h1.intersection(&h2).copied().collect::<HashSet<_>>());

assert_invariants(intersection);
});
19 changes: 19 additions & 0 deletions utils/fuzz/fuzz_targets/set_subset_set.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#![no_main]

use std::collections::HashSet;

use libfuzzer_sys::fuzz_target;

use tlsn_utils_fuzz::SmallSet;

use utils::range::*;

fuzz_target!(|r: (SmallSet, SmallSet)| {
let s1: RangeSet<u8> = r.0.into();
let s2: RangeSet<u8> = r.1.into();

let h1: HashSet<u8> = HashSet::from_iter(s1.iter());
let h2: HashSet<u8> = HashSet::from_iter(s2.iter());

assert_eq!(s1.is_subset(&s2), h1.is_subset(&h2));
});
Loading

0 comments on commit 84f5446

Please sign in to comment.