0

Working on eosio native testing for unit testing and find an example that only for setting only one action data value:

   intrinsics::set_intrinsic<intrinsics::read_action_data>(
     [](void* m, uint32_t len) {
        check(len <= sizeof(eosio::name), "failed from read_action_data");
        *((eosio::name*)m) = "hello"_n;
        return len; 
     });

  intrinsics::set_intrinsic<intrinsics::action_data_size>(
         []() {
            return (uint32_t)sizeof(eosio::name);
         });

But i want to write test for more than action data value but unable to find any way to do so.

1

Setting a next action value need to set the value through increment of 1 in void pointer, i.e.

   intrinsics::set_intrinsic<intrinsics::read_action_data>(
     [](void* m, uint32_t len) {
        check(len <= sizeof(eosio::name), "failed from read_action_data");
        *((eosio::name*)m) = "action1"_n;
         m = (eosio::name*)m + 1;
         *((eosio::name*)m) = "action2"_n
        return len; 
     });

  intrinsics::set_intrinsic<intrinsics::action_data_size>(
         []() {
            return (uint32_t)sizeof(eosio::name)*2;
         });

and setting the length to all action data type's commutative length.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.