Skip to content

Commit 2169a66

Browse files
committed
Increase code coverage
Increase code coverage by adding "tests" for a few code paths that otherwise will not be exercised.
1 parent 0d64a32 commit 2169a66

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/data/v2/stream.rs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ pub enum Data<B = Bar, Q = Quote, T = Trade> {
375375
Trade(T),
376376
}
377377

378-
impl Data {
378+
impl<B, Q, T> Data<B, Q, T> {
379379
/// Check whether this object is of the `Bar` variant.
380380
#[inline]
381381
pub fn is_bar(&self) -> bool {
@@ -941,6 +941,20 @@ mod tests {
941941
const SUB_ERR_RESP: &str = r#"[{"T":"error","code":400,"msg":"invalid syntax"}]"#;
942942

943943

944+
/// Exercise the `Sip::source` method.
945+
#[test]
946+
fn sip_source() {
947+
assert_ne!(format!("{:?}", SIP::source()), "");
948+
}
949+
950+
/// Exercise the various `is_*` methods of the `Data` enum.
951+
#[test]
952+
fn data_classification() {
953+
assert!(Data::<(), Quote, Trade>::Bar(()).is_bar());
954+
assert!(Data::<Bar, (), Trade>::Quote(()).is_quote());
955+
assert!(Data::<Bar, Quote, ()>::Trade(()).is_trade());
956+
}
957+
944958
/// Test that the [`Symbols::is_empty`] method works as expected.
945959
#[test]
946960
fn symbols_is_empty() {

0 commit comments

Comments
 (0)