Skip to content

Commit 5a3efb5

Browse files
authored
enable branch checking (#47)
* enable branch checking * trying something * add another flag * revert * fix branching code cov * now it ACs * fix clippy warning --------- Co-authored-by: Luke Videckis <lukevideckis@gmail.com>
1 parent 846775e commit 5a3efb5

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on: [push, workflow_dispatch]
44

55
env:
66
CARGO_TERM_COLOR: always
7-
RUSTFLAGS: -D warnings -C instrument-coverage -C link-dead-code
7+
RUSTFLAGS: -D warnings -C instrument-coverage -C link-dead-code -Z coverage-options=branch
88
RUSTDOCFLAGS: -D warnings -D missing_docs
99

1010
jobs:

.github/workflows/code_cov.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
2-
# RUSTFLAGS="-C instrument-coverage -C link-dead-code" oj-verify run --tle 20 --jobs 4 examples/data_structures/rmq.rs
2+
# RUSTFLAGS="-C instrument-coverage -C link-dead-code -Z coverage-options=branch" oj-verify run --tle 20 --jobs 4 examples/data_structures/rmq.rs
33

44
set -eo pipefail
55

@@ -8,6 +8,6 @@ cov_flags=(-Xdemangler=rustfilt --ignore-filename-regex='/.cargo/registry' --ins
88

99
cargo profdata -- merge -sparse default_*.profraw -o ptc_rust.profdata
1010
# shellcheck disable=SC2068 # double quotes cause command to fail, not sure why
11-
cargo cov -- show ${cov_flags[@]} --use-color
11+
cargo cov -- show ${cov_flags[@]} --use-color --show-branches=count
1212
# shellcheck disable=SC2068
1313
cargo cov -- export ${cov_flags[@]} --summary-only | python .github/workflows/check_code_cov.py

examples/numbers/primes_is_prime.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ use programming_team_code_rust::numbers::primes::Primes;
66
fn main() {
77
let primes = Primes::new(100_000_001);
88

9+
for i in 0..=1 {
10+
assert!(!primes.is_prime(i));
11+
}
12+
913
input! {
1014
n: usize,
1115
}

0 commit comments

Comments
 (0)