Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions smite-ir/src/mutators/operation_param.rs
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@ mod tests {

let mut empty: Vec<u8> = vec![];
shuffle_subrange(&mut empty, &mut rng);
assert!(empty.is_empty());
assert_eq!(empty, b"");

let mut single = vec![0xFF];
shuffle_subrange(&mut single, &mut rng);
Expand Down Expand Up @@ -664,7 +664,7 @@ mod tests {
let mut rng = SmallRng::seed_from_u64(0);
let mut empty: Vec<u8> = vec![];
fill_repeated(&mut empty, &mut rng);
assert!(empty.is_empty());
assert_eq!(empty, b"");
}

#[test]
Expand Down
4 changes: 2 additions & 2 deletions smite-ir/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2791,7 +2791,7 @@ fn dead_code_returns_false_on_empty_program() {
instructions: vec![],
};
assert!(!DeadCodeEliminator.minimize(&mut program));
assert!(program.instructions.is_empty());
assert_eq!(program.instructions, []);
}

/// Build a program with a dead load appended after the generated program.
Expand Down Expand Up @@ -3020,7 +3020,7 @@ fn cse_returns_false_on_empty_program() {
instructions: vec![],
};
assert!(!CommonSubexpressionEliminator.minimize(&mut program));
assert!(program.instructions.is_empty());
assert_eq!(program.instructions, []);
}

#[test]
Expand Down
18 changes: 9 additions & 9 deletions smite-scenarios/src/executor/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ fn execute_build_channel_announcement() {
assert_eq!(ca.node_id_2, pk(&node_sk_2_bytes));
assert_eq!(ca.bitcoin_key_1, pk(&bitcoin_sk_1_bytes));
assert_eq!(ca.bitcoin_key_2, pk(&bitcoin_sk_2_bytes));
assert!(ca.extra.is_empty());
assert_eq!(ca.extra, b"");
assert!(ca.verify());
}

Expand Down Expand Up @@ -112,7 +112,7 @@ fn execute_build_node_announcement() {
assert_eq!(na.rgb_color, rgb_color);
assert_eq!(na.alias, alias);
assert_eq!(na.addresses, addresses_bytes);
assert!(na.extra.is_empty());
assert_eq!(na.extra, b"");
assert!(na.verify());
}

Expand Down Expand Up @@ -168,7 +168,7 @@ fn execute_build_channel_update() {
assert_eq!(cu.fee_base_msat, 1_000);
assert_eq!(cu.fee_proportional_millionths, 100);
assert_eq!(cu.htlc_maximum_msat, 99_000_000);
assert!(cu.extra.is_empty());
assert_eq!(cu.extra, b"");

let secp = Secp256k1::new();
let expected_node_id =
Expand Down Expand Up @@ -638,7 +638,7 @@ fn execute_mine_blocks_invokes_cli() {

// Verify that mine_blocks was called with the correct number
assert_eq!(fx.bitcoin().mine_blocks_calls, vec![6]);
assert!(fx.bitcoin().mined_private_mempool.is_empty());
assert_eq!(fx.bitcoin().mined_private_mempool, Vec::<String>::new());
assert_eq!(fx.rpc().chain_syncs, 1);
}

Expand Down Expand Up @@ -713,7 +713,7 @@ fn execute_lookup_short_channel_id_unconfirmed_returns_sentinel() {

// The mock was queried but returned None (zero confirmations), so the
// executor took the sentinel path without panicking.
assert!(fx.bitcoin().mine_blocks_calls.is_empty());
assert_eq!(fx.bitcoin().mine_blocks_calls, Vec::<u8>::new());
assert_eq!(fx.bitcoin().block_position_lookups.len(), 1);

let ca: ChannelAnnouncement = fx.sent(0);
Expand All @@ -740,7 +740,7 @@ fn execute_broadcast_dedupes_rejected_tx_in_private_mempool() {
);

let rejected_hex = bitcoin::consensus::encode::serialize_hex(&fx.bitcoin().broadcast_calls[0]);
assert!(fx.private_mempool().is_empty());
assert_eq!(fx.private_mempool(), []);
assert_eq!(fx.bitcoin().mined_private_mempool, vec![rejected_hex]);
}

Expand Down Expand Up @@ -1116,7 +1116,7 @@ fn execute_send_shutdown_empty_scriptpubkey() {
assert_eq!(fx.sent_len(), 1);
let sd: Shutdown = fx.sent(0);
assert_eq!(sd.channel_id, channel_id);
assert!(sd.scriptpubkey.is_empty());
assert_eq!(sd.scriptpubkey, b"");
}

#[test]
Expand Down Expand Up @@ -1172,7 +1172,7 @@ fn execute_recv_channel_ready_below_minimum_depth_is_noop() {
// does not yet owe us a `channel_ready`, so `RecvChannelReady` must be a
// no-op.
fx.run(&recv_channel_ready_program(5));
assert!(fx.bitcoin().mined_private_mempool.is_empty());
assert_eq!(fx.bitcoin().mined_private_mempool, Vec::<String>::new());

// The target's next per-commitment point is still unknown and the queued
// `channel_ready` remains untouched.
Expand All @@ -1193,7 +1193,7 @@ fn execute_recv_channel_ready_at_minimum_depth_records_point() {
// At the negotiated `minimum_depth` confirmations the target owes us a
// `channel_ready`, which `RecvChannelReady` receives and records.
fx.run(&recv_channel_ready_program(6));
assert!(fx.bitcoin().mined_private_mempool.is_empty());
assert_eq!(fx.bitcoin().mined_private_mempool, Vec::<String>::new());

// The `channel_ready` was consumed and the target's next per-commitment
// point is now recorded.
Expand Down
2 changes: 1 addition & 1 deletion smite/src/bolt/attribution_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,6 @@ mod tests {
let mut cursor: &[u8] = &buf;
let decoded = AttributionData::read(&mut cursor).unwrap();
assert_eq!(decoded, original);
assert!(cursor.is_empty());
assert_eq!(cursor, b"");
}
}
8 changes: 4 additions & 4 deletions smite/src/bolt/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ mod tests {
#[test]
fn empty_init() {
let init = Init::empty();
assert!(init.globalfeatures.is_empty());
assert!(init.features.is_empty());
assert_eq!(init.globalfeatures, b"");
assert_eq!(init.features, b"");
assert!(init.tlvs.networks.is_none());
assert!(init.tlvs.remote_addr.is_none());
}
Expand Down Expand Up @@ -247,8 +247,8 @@ mod tests {
fn decode_empty() {
let data = [0x00, 0x00, 0x00, 0x00];
let init = Init::decode(&data).unwrap();
assert!(init.globalfeatures.is_empty());
assert!(init.features.is_empty());
assert_eq!(init.globalfeatures, b"");
assert_eq!(init.features, b"");
assert!(init.tlvs.networks.is_none());
assert!(init.tlvs.remote_addr.is_none());
}
Expand Down
4 changes: 2 additions & 2 deletions smite/src/bolt/ping.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ mod tests {
fn new_creates_empty_padding() {
let ping = Ping::new(4);
assert_eq!(ping.num_pong_bytes, 4);
assert!(ping.ignored.is_empty());
assert_eq!(ping.ignored, b"");
}

#[test]
Expand Down Expand Up @@ -99,7 +99,7 @@ mod tests {
let data = [0x00, 0x04, 0x00, 0x00];
let ping = Ping::decode(&data).unwrap();
assert_eq!(ping.num_pong_bytes, 4);
assert!(ping.ignored.is_empty());
assert_eq!(ping.ignored, b"");
}

#[test]
Expand Down
2 changes: 1 addition & 1 deletion smite/src/bolt/pong.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ mod tests {
fn decode_empty() {
let data = [0x00, 0x00];
let pong = Pong::decode(&data).unwrap();
assert!(pong.ignored.is_empty());
assert_eq!(pong.ignored, b"");
}

#[test]
Expand Down
2 changes: 1 addition & 1 deletion smite/src/bolt/shutdown.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ mod tests {
let encoded = original.encode();
let decoded = Shutdown::decode(&encoded).unwrap();
assert_eq!(original, decoded);
assert!(decoded.scriptpubkey.is_empty());
assert_eq!(decoded.scriptpubkey, b"");
}

#[test]
Expand Down
34 changes: 17 additions & 17 deletions smite/src/bolt/wire.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ mod tests {
assert_eq!(u8::read(&mut data).unwrap(), 0);
assert_eq!(data, &[0xff]);
assert_eq!(u8::read(&mut data).unwrap(), 255);
assert!(data.is_empty());
assert_eq!(data, b"");
}

#[test]
Expand Down Expand Up @@ -336,7 +336,7 @@ mod tests {
assert_eq!(u16::read(&mut data).unwrap(), 0);
assert_eq!(data, &[0x00, 0x01]);
assert_eq!(u16::read(&mut data).unwrap(), 1);
assert!(data.is_empty());
assert_eq!(data, b"");
}

#[test]
Expand Down Expand Up @@ -377,7 +377,7 @@ mod tests {
assert_eq!(u32::read(&mut data).unwrap(), 0);
assert_eq!(data, &[0x00, 0x00, 0x00, 0x01]);
assert_eq!(u32::read(&mut data).unwrap(), 1);
assert!(data.is_empty());
assert_eq!(data, b"");
}

#[test]
Expand Down Expand Up @@ -421,7 +421,7 @@ mod tests {
assert_eq!(u64::read(&mut data).unwrap(), 0);
assert_eq!(data.len(), 8);
assert_eq!(u64::read(&mut data).unwrap(), 1);
assert!(data.is_empty());
assert_eq!(data, b"");
}

#[test]
Expand Down Expand Up @@ -466,7 +466,7 @@ mod tests {
assert_eq!(i64::read(&mut data).unwrap(), 0);
assert_eq!(data.len(), 8);
assert_eq!(i64::read(&mut data).unwrap(), 1);
assert!(data.is_empty());
assert_eq!(data, b"");

// Negative (-1 = 0xffffffffffffffff in two's complement)
let mut data: &[u8] = &[0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff];
Expand Down Expand Up @@ -574,7 +574,7 @@ mod tests {
let mut cursor: &[u8] = &buf;
let decoded = <[u8; 5]>::read(&mut cursor).unwrap();
assert_eq!(decoded, original);
assert!(cursor.is_empty());
assert_eq!(cursor, b"");
}

#[test]
Expand Down Expand Up @@ -620,7 +620,7 @@ mod tests {
let mut cursor: &[u8] = &buf;
let decoded = PublicKey::read(&mut cursor).unwrap();
assert_eq!(decoded, pk);
assert!(cursor.is_empty());
assert_eq!(cursor, b"");
}

#[test]
Expand All @@ -633,7 +633,7 @@ mod tests {
let mut cursor: &[u8] = &buf;
let decoded = ChannelId::read(&mut cursor).unwrap();
assert_eq!(decoded, original);
assert!(cursor.is_empty());
assert_eq!(cursor, b"");
}

#[test]
Expand Down Expand Up @@ -666,7 +666,7 @@ mod tests {
let mut cursor: &[u8] = &buf;
let decoded = ShortChannelId::read(&mut cursor).unwrap();
assert_eq!(decoded, scid);
assert!(cursor.is_empty());
assert_eq!(cursor, b"");
}

#[test]
Expand Down Expand Up @@ -694,15 +694,15 @@ mod tests {
let mut data: &[u8] = &[0x00, 0x00];
let result = Vec::<u8>::read(&mut data).unwrap();
assert_eq!(result, Vec::<u8>::new());
assert!(data.is_empty());
assert_eq!(data, b"");
}

#[test]
fn vec_u8_read_valid() {
let mut data: &[u8] = &[0x00, 0x03, 0xaa, 0xbb, 0xcc];
let result = Vec::<u8>::read(&mut data).unwrap();
assert_eq!(result, vec![0xaa, 0xbb, 0xcc]);
assert!(data.is_empty());
assert_eq!(data, b"");
}

#[test]
Expand Down Expand Up @@ -746,7 +746,7 @@ mod tests {
let mut cursor: &[u8] = &buf;
let decoded = Vec::<u8>::read(&mut cursor).unwrap();
assert_eq!(decoded, original);
assert!(cursor.is_empty());
assert_eq!(cursor, b"");
}

#[test]
Expand Down Expand Up @@ -784,7 +784,7 @@ mod tests {
let bs = BigSize::read(&mut cursor).expect("valid bigsize");
assert_eq!(bs.value(), *expected, "decoding {bytes:02x?}");
assert_eq!(bs.len(), bytes.len());
assert!(cursor.is_empty());
assert_eq!(cursor, b"");
}
}

Expand Down Expand Up @@ -837,7 +837,7 @@ mod tests {
let decoded = BigSize::read(&mut cursor).expect("valid bigsize");
assert_eq!(value, decoded.value());
assert_eq!(bs.len(), encoded.len());
assert!(cursor.is_empty());
assert_eq!(cursor, b"");
}
}

Expand Down Expand Up @@ -958,7 +958,7 @@ mod tests {
let mut cursor: &[u8] = &buf;
let decoded = Txid::read(&mut cursor).unwrap();
assert_eq!(decoded, txid);
assert!(cursor.is_empty());
assert_eq!(cursor, b"");
}

#[test]
Expand Down Expand Up @@ -1007,7 +1007,7 @@ mod tests {
let mut cursor: &[u8] = &buf;
let decoded = Signature::read(&mut cursor).unwrap();
assert_eq!(decoded, sig);
assert!(cursor.is_empty());
assert_eq!(cursor, b"");
}

#[test]
Expand Down Expand Up @@ -1042,7 +1042,7 @@ mod tests {
let mut cursor: &[u8] = &buf;
let decoded = sha256::Hash::read(&mut cursor).unwrap();
assert_eq!(decoded, hash);
assert!(cursor.is_empty());
assert_eq!(cursor, b"");
}

#[test]
Expand Down
2 changes: 1 addition & 1 deletion smitebot/src/commands/start.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1038,7 +1038,7 @@ sharedir = "{}"
fn ir_mutator_envs_empty_for_non_ir_scenario() {
let dir = tempfile::tempdir().unwrap();
let config = sample_config(dir.path());
assert!(ir_mutator_envs(&config).is_empty());
assert_eq!(ir_mutator_envs(&config), []);
}

fn sample_config(dir: &Path) -> CampaignConfig {
Expand Down
2 changes: 1 addition & 1 deletion smitebot/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ sharedir = "/tmp/smite-nyx"
let config = CampaignConfig::load(&path).unwrap();

assert!(config.afl_env.is_empty());
assert!(config.afl_flags.is_empty());
assert_eq!(config.afl_flags, Vec::<String>::new());
}

#[test]
Expand Down
Loading