Skip to content

Commit

Permalink
use rstest cases
Browse files Browse the repository at this point in the history
  • Loading branch information
rnbguy committed Jan 26, 2024
1 parent 3510799 commit 3bd6494
Showing 1 changed file with 15 additions and 16 deletions.
31 changes: 15 additions & 16 deletions ibc-testkit/src/fixtures/clients/tendermint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,24 @@ pub fn dummy_ics07_header() -> Header {
mod tests {

use ibc::primitives::proto::Any;
use rstest::rstest;

use super::*;

fn try_tm_client_state_conversions(frozen_height: RawHeight) {
#[rstest]
// try conversions for when the client is not frozen
#[case::valid_client(0, 0)]
// try conversions for when the client is frozen
#[case::frozen_client(0, 1)]
fn tm_client_state_conversions_healthy(
#[case] revision_number: u64,
#[case] revision_height: u64,
) {
let frozen_height = RawHeight {
revision_number,
revision_height,
};

// check client state creation path from a proto type
let tm_client_state_from_raw = dummy_tm_client_state_from_raw(frozen_height);
assert!(tm_client_state_from_raw.is_ok());
Expand All @@ -191,21 +205,6 @@ mod tests {
);
}

#[test]
fn tm_client_state_conversions_healthy() {
// try conversions for when the client is not frozen
try_tm_client_state_conversions(RawHeight {
revision_number: 0,
revision_height: 0,
});

// try conversions for when the client is frozen
try_tm_client_state_conversions(RawHeight {
revision_number: 0,
revision_height: 1,
});
}

#[test]
fn tm_client_state_from_header_healthy() {
// check client state creation path from a tendermint header
Expand Down

0 comments on commit 3bd6494

Please sign in to comment.