fn can_persist_globals_across_multiple_message_executions() {
    utils::canister_test(|test| {
        let (canister_id, _) = test.create_and_install_canister(CANISTER_WITH_GLOBAL, vec![]);
        let initial_val = test.query(canister_id, "read", vec![]).unwrap().bytes()[0];
        assert_eq!(0, initial_val);

        test.ingress(canister_id, "write", vec![]).unwrap();

        let val_after_first_ingress = test.query(canister_id, "read", vec![]).unwrap().bytes()[0];
        assert_eq!(initial_val + 1, val_after_first_ingress);

        test.ingress(canister_id, "write", vec![]).unwrap();

        let val_after_second_ingress = test.query(canister_id, "read", vec![]).unwrap().bytes()[0];
        assert_eq!(val_after_first_ingress + 1, val_after_second_ingress);
    })
}
/// Tests that we can persist globals across multiple message executions.
Tests that we can persist globals across multiple message executions.
Tests that we can persist globals across multiple message executions .
fn can_persist_globals_across_multiple_message_executions() {
    utils::canister_test(|test| {
        let (canister_id, _) = test.create_and_install_canister(CANISTER_WITH_GLOBAL, vec![]);
        let initial_val = test.query(canister_id, "read", vec![]).unwrap().bytes()[0];
        assert_eq!(0, initial_val);
        test.ingress(canister_id, "write", vec![]).unwrap();
        let val_after_first_ingress = test.query(canister_id, "read", vec![]).unwrap().bytes()[0];
        assert_eq!(initial_val + 1, val_after_first_ingress);
        test.ingress(canister_id, "write", vec![]).unwrap();
        let val_after_second_ingress = test.query(canister_id, "read", vec![]).unwrap().bytes()[0];
        assert_eq!(val_after_first_ingress + 1, val_after_second_ingress);
    })
}
fn can_persist_globals_across_multiple_message_executions ( ) { utils :: canister_test ( | test | { let ( canister_id , _ ) = test . create_and_install_canister ( CANISTER_WITH_GLOBAL , vec ! [ ] ) ; let initial_val = test . query ( canister_id , " " , vec ! [ ] ) . unwrap ( ) . bytes ( ) [ 0 ] ; assert_eq ! ( 0 initial_val ) ; test . ingress ( canister_id , " " , vec ! [ ] ) . unwrap ( ) ; let val_after_first_ingress = test . query ( canister_id , " " , vec ! [ ] ) . unwrap ( ) . bytes ( ) [ 0 ] ; assert_eq ! ( initial_val 1 val_after_first_ingress ) ; test . ingress ( canister_id , " " , vec ! [ ] ) . unwrap ( ) ; let val_after_second_ingress = test . query ( canister_id , " " , vec ! [ ] ) . unwrap ( ) . bytes ( ) [ 0 ] ; assert_eq ! ( val_after_first_ingress 1 val_after_second_ingress ) ; } ) }
Tests that we can persist globals across multiple message executions.
Tests that we can persist globals across multiple message executions .