Skip to content

Commit

Permalink
Added hashset to the same tests that hashmap has
Browse files Browse the repository at this point in the history
  • Loading branch information
VictorKoenders committed Mar 3, 2022
1 parent 6494363 commit bbba17c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
3 changes: 2 additions & 1 deletion fuzz/fuzz_targets/roundtrip.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#![no_main]
use libfuzzer_sys::fuzz_target;

use std::collections::{BTreeMap, BTreeSet, HashMap, VecDeque};
use std::collections::{BTreeMap, BTreeSet, HashMap, HashSet, VecDeque};
use std::ffi::CString;
use std::net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr, SocketAddrV4, SocketAddrV6};
use std::num::{NonZeroI128, NonZeroI32, NonZeroU128, NonZeroU32};
Expand All @@ -14,6 +14,7 @@ use std::time::{Duration, SystemTime};
enum AllTypes {
BTreeMap(BTreeMap<u8, u8>),
HashMap(HashMap<u8, u8>),
HashSet(HashSet<u8>),
BTreeSet(BTreeSet<u8>),
VecDeque(VecDeque<AllTypes>),
Vec(Vec<AllTypes>),
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
//!
//! |Name |Default?|Supported types for Encode/Decode|Enabled methods |Other|
//! |------|--------|-----------------------------------------|-----------------------------------------------------------------|-----|
//! |std | Yes |`HashMap`|`decode_from_std_read` and `encode_into_std_write`|
//! |std | Yes |`HashMap` and `HashSet`|`decode_from_std_read` and `encode_into_std_write`|
//! |alloc | Yes |All common containers in alloc, like `Vec`, `String`, `Box`|`encode_to_vec`|
//! |atomic| Yes |All `Atomic*` integer types, e.g. `AtomicUsize`, and `AtomicBool`||
//! |derive| Yes |||Enables the `BorrowDecode`, `Decode` and `Encode` derive macros|
Expand Down
1 change: 1 addition & 0 deletions tests/alloc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ fn test_container_limits() {
#[cfg(feature = "std")]
{
validate_fail::<std::collections::HashMap<i32, i32>>(slice);
validate_fail::<std::collections::HashSet<i32>>(slice);
}
}
}
5 changes: 5 additions & 0 deletions tests/std.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@ fn test_std_commons() {
map.insert("you".to_owned(), "doing?".to_owned());
the_same(map);

let mut set = std::collections::HashSet::new();
set.insert("Hello".to_string());
set.insert("World".to_string());
the_same(set);

// Borrowed values
let config = bincode::config::standard();
let mut buffer = [0u8; 1024];
Expand Down

0 comments on commit bbba17c

Please sign in to comment.