Просмотр исходного кода

contract/consensus/tests/stake_unstake.rs: simplyfied assert check of erroneous_txs length

aggstam 3 лет назад
Родитель
Сommit
ed0adbc93b
1 измененных файлов с 8 добавлено и 8 удалено
  1. 8 8
      src/contract/consensus/tests/stake_unstake.rs

+ 8 - 8
src/contract/consensus/tests/stake_unstake.rs

@@ -97,14 +97,14 @@ async fn consensus_contract_stake_unstake() -> Result<()> {
     info!(target: "consensus", "[Faucet] ==========================");
     let erroneous_txs =
         th.faucet.state.read().await.verify_transactions(&[airdrop_tx.clone()], true).await?;
-    assert_eq!(erroneous_txs.len(), 0);
+    assert!(erroneous_txs.is_empty());
     th.faucet.merkle_tree.append(&MerkleNode::from(airdrop_params.outputs[0].coin.inner()));
     info!(target: "consensus", "[Alice] ==========================");
     info!(target: "consensus", "[Alice] Executing Alice airdrop tx");
     info!(target: "consensus", "[Alice] ==========================");
     let erroneous_txs =
         th.alice.state.read().await.verify_transactions(&[airdrop_tx.clone()], true).await?;
-    assert_eq!(erroneous_txs.len(), 0);
+    assert!(erroneous_txs.is_empty());
     th.alice.merkle_tree.append(&MerkleNode::from(airdrop_params.outputs[0].coin.inner()));
 
     assert!(th.faucet.merkle_tree.root(0).unwrap() == th.alice.merkle_tree.root(0).unwrap());
@@ -195,7 +195,7 @@ async fn consensus_contract_stake_unstake() -> Result<()> {
     let timer = Instant::now();
     let erroneous_txs =
         th.faucet.state.read().await.verify_transactions(&[alice_stake_tx.clone()], true).await?;
-    assert_eq!(erroneous_txs.len(), 0);
+    assert!(erroneous_txs.is_empty());
     th.faucet
         .consensus_merkle_tree
         .append(&MerkleNode::from(alice_consensus_stake_params.output.coin.inner()));
@@ -207,7 +207,7 @@ async fn consensus_contract_stake_unstake() -> Result<()> {
     let timer = Instant::now();
     let erroneous_txs =
         th.alice.state.read().await.verify_transactions(&[alice_stake_tx.clone()], true).await?;
-    assert_eq!(erroneous_txs.len(), 0);
+    assert!(erroneous_txs.is_empty());
     th.alice
         .consensus_merkle_tree
         .append(&MerkleNode::from(alice_consensus_stake_params.output.coin.inner()));
@@ -330,7 +330,7 @@ async fn consensus_contract_stake_unstake() -> Result<()> {
         .await
         .verify_transactions(&[alice_proposal_tx.clone()], true)
         .await?;
-    assert_eq!(erroneous_txs.len(), 0);
+    assert!(erroneous_txs.is_empty());
     th.faucet
         .consensus_merkle_tree
         .append(&MerkleNode::from(alice_consensus_stake_params.output.coin.inner()));
@@ -342,7 +342,7 @@ async fn consensus_contract_stake_unstake() -> Result<()> {
     let timer = Instant::now();
     let erroneous_txs =
         th.alice.state.read().await.verify_transactions(&[alice_proposal_tx.clone()], true).await?;
-    assert_eq!(erroneous_txs.len(), 0);
+    assert!(erroneous_txs.is_empty());
     th.alice
         .consensus_merkle_tree
         .append(&MerkleNode::from(alice_consensus_stake_params.output.coin.inner()));
@@ -445,7 +445,7 @@ async fn consensus_contract_stake_unstake() -> Result<()> {
     let timer = Instant::now();
     let erroneous_txs =
         th.faucet.state.read().await.verify_transactions(&[alice_unstake_tx.clone()], true).await?;
-    assert_eq!(erroneous_txs.len(), 0);
+    assert!(erroneous_txs.is_empty());
     th.faucet.merkle_tree.append(&MerkleNode::from(alice_money_unstake_params.output.coin.inner()));
     unstake_verify_times.push(timer.elapsed());
 
@@ -455,7 +455,7 @@ async fn consensus_contract_stake_unstake() -> Result<()> {
     let timer = Instant::now();
     let erroneous_txs =
         th.alice.state.read().await.verify_transactions(&[alice_unstake_tx.clone()], true).await?;
-    assert_eq!(erroneous_txs.len(), 0);
+    assert!(erroneous_txs.is_empty());
     th.alice.merkle_tree.append(&MerkleNode::from(alice_money_unstake_params.output.coin.inner()));
     unstake_verify_times.push(timer.elapsed());