mirror of
https://github.com/logos-blockchain/logos-execution-zone.git
synced 2026-05-17 05:29:32 +00:00
fix: ordering of items and allow large_enum_variant in test module
This commit is contained in:
parent
bc0583368d
commit
9fb55a75d6
@ -3469,22 +3469,12 @@ pub mod tests {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn state_serialization_roundtrip() {
|
|
||||||
let account_id_1 = AccountId::new([1; 32]);
|
|
||||||
let account_id_2 = AccountId::new([2; 32]);
|
|
||||||
let initial_data = [(account_id_1, 100_u128), (account_id_2, 151_u128)];
|
|
||||||
let state = V03State::new_with_genesis_accounts(&initial_data, &[]).with_test_programs();
|
|
||||||
let bytes = borsh::to_vec(&state).unwrap();
|
|
||||||
let state_from_bytes: V03State = borsh::from_slice(&bytes).unwrap();
|
|
||||||
assert_eq!(state, state_from_bytes);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ── Flash Swap integration tests ──────────────────────────────────────────
|
// ── Flash Swap integration tests ──────────────────────────────────────────
|
||||||
|
|
||||||
/// Mirror of the guest `FlashSwapInstruction` enum so we can serialise
|
/// Mirror of the guest `FlashSwapInstruction` enum so we can serialise
|
||||||
/// instructions on the host side.
|
/// instructions on the host side.
|
||||||
#[derive(serde::Serialize, serde::Deserialize)]
|
#[derive(serde::Serialize, serde::Deserialize)]
|
||||||
|
#[allow(clippy::large_enum_variant)]
|
||||||
enum FlashSwapInstruction {
|
enum FlashSwapInstruction {
|
||||||
Initiate {
|
Initiate {
|
||||||
token_program_id: ProgramId,
|
token_program_id: ProgramId,
|
||||||
@ -3531,6 +3521,17 @@ pub mod tests {
|
|||||||
PublicTransaction::new(message, witness_set)
|
PublicTransaction::new(message, witness_set)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn state_serialization_roundtrip() {
|
||||||
|
let account_id_1 = AccountId::new([1; 32]);
|
||||||
|
let account_id_2 = AccountId::new([2; 32]);
|
||||||
|
let initial_data = [(account_id_1, 100_u128), (account_id_2, 151_u128)];
|
||||||
|
let state = V03State::new_with_genesis_accounts(&initial_data, &[]).with_test_programs();
|
||||||
|
let bytes = borsh::to_vec(&state).unwrap();
|
||||||
|
let state_from_bytes: V03State = borsh::from_slice(&bytes).unwrap();
|
||||||
|
assert_eq!(state, state_from_bytes);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn flash_swap_successful() {
|
fn flash_swap_successful() {
|
||||||
let initiator = Program::flash_swap_initiator();
|
let initiator = Program::flash_swap_initiator();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user