Skip to content

Commit

Permalink
Shorten function names
Browse files Browse the repository at this point in the history
Signed-off-by: Denis Varlakov <[email protected]>
  • Loading branch information
survived committed Nov 26, 2024
1 parent 429560d commit 89ae001
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions examples/random-generation-protocol/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,8 @@ mod tests {
|i, party, rng| protocol_of_random_generation(party, i, n, rng),
)
.await
.expect_success()
.expect_same();
.expect_ok()
.expect_eq();

std::println!("Output randomness: {}", hex::encode(randomness));
}
Expand All @@ -204,8 +204,8 @@ mod tests {
})
.run()
.unwrap()
.expect_success()
.expect_same();
.expect_ok()
.expect_eq();
}

// Emulate the protocol using the state machine interface
Expand Down
8 changes: 4 additions & 4 deletions round-based/src/simulation/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@
//! )
//! .await
//! // unwrap `Result`s
//! .expect_success()
//! .expect_ok()
//! // check that all parties produced the same response
//! .expect_same();
//! .expect_eq();
//!
//! println!("Output randomness: {}", hex::encode(output));
//! # }
Expand All @@ -71,7 +71,7 @@ where
/// Panics if at least one of the parties returned `Err(_)`. In this case,
/// a verbose error message will shown specifying which of the parties returned
/// an error.
pub fn expect_success(self) -> SimResult<T> {
pub fn expect_ok(self) -> SimResult<T> {
let mut oks = alloc::vec::Vec::with_capacity(self.0.len());
let mut errs = alloc::vec::Vec::with_capacity(self.0.len());

Expand Down Expand Up @@ -113,7 +113,7 @@ where
/// panics with a verbose error message.
///
/// Panics if simulation contained zero parties.
pub fn expect_same(mut self) -> T {
pub fn expect_eq(mut self) -> T {
let Some(first) = self.0.first() else {
panic!("simulation contained zero parties");
};
Expand Down
8 changes: 4 additions & 4 deletions round-based/src/simulation/sim_async.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,9 @@ impl NextMessageId {
/// )
/// .await
/// // unwrap `Result`s
/// .expect_success()
/// .expect_ok()
/// // check that all parties produced the same response
/// .expect_same();
/// .expect_eq();
///
/// println!("Output randomness: {}", hex::encode(output));
/// # }
Expand Down Expand Up @@ -275,9 +275,9 @@ where
/// )
/// .await
/// // unwrap `Result`s
/// .expect_success()
/// .expect_ok()
/// // check that all parties produced the same response
/// .expect_same();
/// .expect_eq();
///
/// println!("Output randomness: {}", hex::encode(output));
/// # }
Expand Down

0 comments on commit 89ae001

Please sign in to comment.