Skip to content
This repository has been archived by the owner on Nov 1, 2023. It is now read-only.

Commit

Permalink
Format
Browse files Browse the repository at this point in the history
  • Loading branch information
ranweiler committed Dec 22, 2022
1 parent 91bbe40 commit 5e65571
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 44 deletions.
2 changes: 1 addition & 1 deletion src/agent/coverage/src/binary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ impl Count {
self.0 > 0
}

pub fn add(self, other: Self) -> Self {
pub fn add(self, other: Self) -> Self {
Count(self.0.saturating_add(other.0))
}

Expand Down
101 changes: 58 additions & 43 deletions src/agent/coverage/src/binary/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,25 +44,34 @@ fn test_module_increment() -> Result<()> {

module.increment(Offset(2));

assert_eq!(module, module! {
1 => 1,
2 => 1,
});
assert_eq!(
module,
module! {
1 => 1,
2 => 1,
}
);

module.increment(Offset(2));

assert_eq!(module, module! {
1 => 1,
2 => 2,
});
assert_eq!(
module,
module! {
1 => 1,
2 => 2,
}
);

module.increment(Offset(3));

assert_eq!(module, module! {
1 => 1,
2 => 2,
3 => 1,
});
assert_eq!(
module,
module! {
1 => 1,
2 => 2,
3 => 1,
}
);

Ok(())
}
Expand Down Expand Up @@ -92,21 +101,24 @@ fn test_coverage_add() -> Result<()> {
},
});

assert_eq!(coverage, coverage! {
"main.exe" => {
1 => 2,
2 => 1,
3 => 1,
4 => 0,
5 => 1,
},
"old.dll" => {
1 => 0,
},
"new.dll" => {
1 => 1,
},
});
assert_eq!(
coverage,
coverage! {
"main.exe" => {
1 => 2,
2 => 1,
3 => 1,
4 => 0,
5 => 1,
},
"old.dll" => {
1 => 0,
},
"new.dll" => {
1 => 1,
},
}
);

Ok(())
}
Expand Down Expand Up @@ -136,21 +148,24 @@ fn test_coverage_merge() -> Result<()> {
},
});

assert_eq!(coverage, coverage! {
"main.exe" => {
1 => 1,
2 => 1,
3 => 1,
4 => 0,
5 => 1,
},
"old.dll" => {
1 => 0,
},
"new.dll" => {
1 => 1,
},
});
assert_eq!(
coverage,
coverage! {
"main.exe" => {
1 => 1,
2 => 1,
3 => 1,
4 => 0,
5 => 1,
},
"old.dll" => {
1 => 0,
},
"new.dll" => {
1 => 1,
},
}
);

Ok(())
}

0 comments on commit 5e65571

Please sign in to comment.