/// Tests that an encode-decode roundtrip yields a result equal to the
/// original (and the queue size metrics of an organically constructed
/// `CanisterQueues` match those of a deserialized one).
Tests that an encode-decode roundtrip yields a result equal to the
original (and the queue size metrics of an organically constructed
`CanisterQueues` match those of a deserialized one).
Tests that an encode - decode roundtrip yields a result equal to the original ( and the queue size metrics of an organically constructed ` CanisterQueues ` match those of a deserialized one ) .
fn encode_roundtrip() {
    let mut queues = CanisterQueues::default();
    let this = canister_test_id(13);
    let other = canister_test_id(14);
    queues
        .push_input(
            QueueIndex::from(0),
            RequestBuilder::default().sender(this).build().into(),
            InputQueueType::RemoteSubnet,
        )
        .unwrap();
    queues
        .push_input(
            QueueIndex::from(0),
            RequestBuilder::default().sender(other).build().into(),
            InputQueueType::RemoteSubnet,
        )
        .unwrap();
    queues
        .pop_canister_input(InputQueueType::RemoteSubnet)
        .unwrap();
    queues.push_ingress(IngressBuilder::default().receiver(this).build());
    let encoded: pb_queues::CanisterQueues = (&queues).into();
    let decoded = encoded.try_into().unwrap();
    assert_eq!(queues, decoded);
}
fn encode_roundtrip ( ) { let mut queues = CanisterQueues :: default ( ) ; let this = canister_test_id ( 13 ) ; let other = canister_test_id ( 14 ) ; queues . push_input ( QueueIndex :: from ( 0 ) , RequestBuilder :: default ( ) . sender ( this ) . build ( ) . into ( ) , InputQueueType :: RemoteSubnet , ) . unwrap ( ) ; queues . push_input ( QueueIndex :: from ( 0 ) , RequestBuilder :: default ( ) . sender ( other ) . build ( ) . into ( ) , InputQueueType :: RemoteSubnet , ) . unwrap ( ) ; queues . pop_canister_input ( InputQueueType :: RemoteSubnet ) . unwrap ( ) ; queues . push_ingress ( IngressBuilder :: default ( ) . receiver ( this ) . build ( ) ) ; let encoded : pb_queues :: CanisterQueues = ( & queues ) . into ( ) ; let decoded = encoded . try_into ( ) . unwrap ( ) ; assert_eq ! ( queues decoded ) ; }
Tests that an encode-decode roundtrip yields a result equal to the
original (and the queue size metrics of an organically constructed
`CanisterQueues` match those of a deserialized one).
Tests that an encode - decode roundtrip yields a result equal to the original ( and the queue size metrics of an organically constructed ` CanisterQueues ` match those of a deserialized one ) .