Skip to content

Commit

Permalink
Switch to cargo-tarpaulin for coverage (#2)
Browse files Browse the repository at this point in the history
* Switch to cargo-tarpaulin for coverage

* Only run tarpaulin on stable

* Add a coveralls.io badge to README.md
  • Loading branch information
ryanq committed Dec 30, 2018
1 parent 82fc1e1 commit 71b8278
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 33 deletions.
29 changes: 14 additions & 15 deletions .travis.yml
Expand Up @@ -10,34 +10,33 @@ if: type = push AND branch = master OR type = pull_request AND branch = master
addons:
apt:
packages:
- libcurl4-openssl-dev
- libelf-dev
- libdw-dev
- binutils-dev
- cmake
sources:
- kalakris-cmake
- libssl-dev

rust:
- nightly
- beta
- stable
- 1.31.0 # bump as minimum supported Rust version changes
- beta
- nightly

before_script:
- export PATH=$HOME/.cargo/bin:$PATH
- cargo install cargo-update || true
- cargo install cargo-travis || true
- cargo install-update -a
- export PATH=$HOME/.cargo/bin:$PATH # for cargo subcommands

script:
- cargo build
- cargo test
# - cargo bench
- cargo doc

after_success:
- cargo coveralls
before_cache: |
if [[ "$TRAVIS_RUST_VERSION" == "stable" ]]; then
rustup toolchain install nightly
RUSTFLAGS="--cfg procmacro2_semver_exempt" cargo +nightly install cargo-tarpaulin || true
fi
after_success: |
if [[ "$TRAVIS_RUST_VERSION" == "stable" ]]; then
cargo +nightly tarpaulin --ciserver travis-ci --coveralls $TRAVIS_JOB_ID
fi
matrix:
allow_failures:
Expand Down
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -3,6 +3,7 @@
Types for manipulating numeric primitives at the bit level.

[![Build Status](https://travis-ci.org/ryanq/quark.svg?branch=master)](https://travis-ci.org/ryanq/quark)
[![Coverage Status](https://coveralls.io/repos/github/ryanq/quark/badge.svg?branch=master)](https://coveralls.io/github/ryanq/quark?branch=master)
[![Docs.rs](https://docs.rs/quark/badge.svg)](https://docs.rs/quark)

The `quark` crate provides traits for accessing parts of numeric primitives and adds new types
Expand Down
36 changes: 18 additions & 18 deletions src/bit_index.rs
Expand Up @@ -147,35 +147,35 @@ mod test {
.that( &byte.bits(4..) )
.is_equal_to( 5 );

asserting("bits(Range) includes the start bit")
asserting!("bits(Range) includes the start bit")
.that( &byte.bits(4..8) )
.is_equal_to( 5 );
asserting("bits(Range) excludes the end bit")
asserting!("bits(Range) excludes the end bit")
.that( &byte.bits(0..4) )
.is_equal_to( 10 );

asserting("bits(RangeInclusive) includes the start bit")
asserting!("bits(RangeInclusive) includes the start bit")
.that( &byte.bits(4..=7) )
.is_equal_to( 5 );
asserting("bits(RangeInclusive) includes the end bit")
asserting!("bits(RangeInclusive) includes the end bit")
.that( &byte.bits(0..=4) )
.is_equal_to( 26 );

asserting("bits(RangeEU) excludes the start bit")
asserting!("bits(RangeEU) excludes the start bit")
.that( &byte.bits(RangeEU(4)) )
.is_equal_to( 2 );

asserting("bits(RangeEE) excludes the start bit")
asserting!("bits(RangeEE) excludes the start bit")
.that( &byte.bits(RangeEE(4, 8)) )
.is_equal_to( 2 );
asserting("bits(RangeEE) excludes the end bit")
asserting!("bits(RangeEE) excludes the end bit")
.that( &byte.bits(RangeEE(0, 4)) )
.is_equal_to( 5 );

asserting("bits(RangeEI) excludes the start bit")
asserting!("bits(RangeEI) excludes the start bit")
.that( &byte.bits(RangeEI(4, 7)) )
.is_equal_to( 2 );
asserting("bits(RangeEI) includes the end bit")
asserting!("bits(RangeEI) includes the end bit")
.that( &byte.bits(RangeEI(0, 4)) )
.is_equal_to( 13 );
}
Expand Down Expand Up @@ -270,35 +270,35 @@ mod test {
.that( &byte.bits(4..) )
.is_equal_to( -6 );

asserting("bits(Range) includes the start bit")
asserting!("bits(Range) includes the start bit")
.that( &byte.bits(4..8) )
.is_equal_to( 10 );
asserting("bits(Range) excludes the end bit")
asserting!("bits(Range) excludes the end bit")
.that( &byte.bits(0..5) )
.is_equal_to( 6 );

asserting("bits(RangeInclusive) includes the start bit")
asserting!("bits(RangeInclusive) includes the start bit")
.that( &byte.bits(4..=7) )
.is_equal_to( 10 );
asserting("bits(RangeInclusive) includes the end bit")
asserting!("bits(RangeInclusive) includes the end bit")
.that( &byte.bits(0..=5) )
.is_equal_to( 38 );

asserting("bits(RangeEU) excludes the start bit")
asserting!("bits(RangeEU) excludes the start bit")
.that( &byte.bits(RangeEU(4)) )
.is_equal_to( -3 );

asserting("bits(RangeEE) excludes the start bit")
asserting!("bits(RangeEE) excludes the start bit")
.that( &byte.bits(RangeEE(4, 8)) )
.is_equal_to( 5 );
asserting("bits(RangeEE) excludes the end bit")
asserting!("bits(RangeEE) excludes the end bit")
.that( &byte.bits(RangeEE(0, 2)) )
.is_equal_to( 1 );

asserting("bits(RangeEI) excludes the start bit")
asserting!("bits(RangeEI) excludes the start bit")
.that( &byte.bits(RangeEI(2, 4)) )
.is_equal_to( 0 );
asserting("bits(RangeEI) includes the end bit")
asserting!("bits(RangeEI) includes the end bit")
.that( &byte.bits(RangeEI(2, 5)) )
.is_equal_to( 4 );
}
Expand Down

0 comments on commit 71b8278

Please sign in to comment.