aquatic_ws_protocol: fix warning about JsonValue Arbitrary impl

Now it is clearer that only a single value is ever generated
This commit is contained in:
Joakim Frostegård 2020-08-13 01:05:20 +02:00
parent 77ac17dec4
commit cf0623e302

View file

@ -330,6 +330,10 @@ mod tests {
bytes bytes
} }
fn sdp_json_value() -> JsonValue {
JsonValue(::serde_json::json!({ "sdp": "test" }))
}
impl Arbitrary for InfoHash { impl Arbitrary for InfoHash {
fn arbitrary<G: quickcheck::Gen>(g: &mut G) -> Self { fn arbitrary<G: quickcheck::Gen>(g: &mut G) -> Self {
Self(arbitrary_20_bytes(g)) Self(arbitrary_20_bytes(g))
@ -348,12 +352,6 @@ mod tests {
} }
} }
impl Arbitrary for JsonValue {
fn arbitrary<G: quickcheck::Gen>(g: &mut G) -> Self {
Self(::serde_json::json!({ "sdp": "test" }))
}
}
impl Arbitrary for AnnounceEvent { impl Arbitrary for AnnounceEvent {
fn arbitrary<G: quickcheck::Gen>(g: &mut G) -> Self { fn arbitrary<G: quickcheck::Gen>(g: &mut G) -> Self {
match (bool::arbitrary(g), bool::arbitrary(g)){ match (bool::arbitrary(g), bool::arbitrary(g)){
@ -372,7 +370,7 @@ mod tests {
peer_id: Arbitrary::arbitrary(g), peer_id: Arbitrary::arbitrary(g),
info_hash: Arbitrary::arbitrary(g), info_hash: Arbitrary::arbitrary(g),
offer_id: Arbitrary::arbitrary(g), offer_id: Arbitrary::arbitrary(g),
offer: Arbitrary::arbitrary(g) offer: sdp_json_value()
} }
} }
} }
@ -384,7 +382,7 @@ mod tests {
peer_id: Arbitrary::arbitrary(g), peer_id: Arbitrary::arbitrary(g),
info_hash: Arbitrary::arbitrary(g), info_hash: Arbitrary::arbitrary(g),
offer_id: Arbitrary::arbitrary(g), offer_id: Arbitrary::arbitrary(g),
answer: Arbitrary::arbitrary(g) answer: sdp_json_value()
} }
} }
} }
@ -393,7 +391,7 @@ mod tests {
fn arbitrary<G: quickcheck::Gen>(g: &mut G) -> Self { fn arbitrary<G: quickcheck::Gen>(g: &mut G) -> Self {
Self { Self {
offer_id: Arbitrary::arbitrary(g), offer_id: Arbitrary::arbitrary(g),
offer: Arbitrary::arbitrary(g) offer: sdp_json_value()
} }
} }
} }
@ -412,7 +410,7 @@ mod tests {
offers = Some(Arbitrary::arbitrary(g)); offers = Some(Arbitrary::arbitrary(g));
}, },
Some(false) => { Some(false) => {
answer = Some(Arbitrary::arbitrary(g)); answer = Some(sdp_json_value());
to_peer_id = Some(Arbitrary::arbitrary(g)); to_peer_id = Some(Arbitrary::arbitrary(g));
offer_id = Some(Arbitrary::arbitrary(g)); offer_id = Some(Arbitrary::arbitrary(g));
}, },