Questions tagged [unit-tests]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
9 views

eoslime: Provided keys, permissions, and delays do not satisfy declared authorizations

When Trying to run my test with eoslime test and calling eoslime.Contract.deploy(...., ....) I get Error: the string "{\"code\":500,\"message\":\"Internal Service Error\",\"error\":{\"code\":...
0
votes
1answer
28 views

How to match object value from fc::variant which is std::pair type in contract unit test via Boost test?

This is example of object singletone table which i trying to test: { "rows": [{ "account": "ins", "first_approve": { "first": "apk", "second": 1 ...
0
votes
0answers
15 views

Tools for development at the current stage of EOS

I am a developer coming here from Ethereum. Joining your Telegram chats and following the discussions in it, in my view, you have a lot of experience and helps the new devs. You are actually my dream ...
0
votes
0answers
120 views

eosio.contract unit_test error “critical check validate()” when added new global table and bps change

i get the an error from the eosio.contract unit_test as follow: /eosio/1.8/include/eosio/testing/tester.hpp(364): fatal error: in "eosio_system_tests/vote_producers_in_and_out": critical check ...
0
votes
1answer
29 views

What is the usage of intrinsic read_action_data to set more than one action data?

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* ...
1
vote
1answer
46 views

Relation chain_config fields and tx_cpu_usage

In chain_config.hpp I need a new field "alfa_opt". struct chain_config { ... uint32_t max_block_cpu_usage; ///< the maxiumum billable cpu usage (in microseconds) for a block ...
1
vote
0answers
18 views

Magic numbers within voting test

eosio.system_tests.cpp BOOST_FIXTURE_TEST_CASE( vote_producers_in_and_out, eosio_system_tester ) try { ... // give a chance for everyone to produce blocks { produce_blocks(23 * 12 + 20); ... What ...
3
votes
1answer
62 views

Meaning of stake2votes function

eosio_system_tester.hpp: double stake2votes( asset stake ) { auto now = control->pending_block_time().time_since_epoch().count() / 1000000; return stake.get_amount() * pow(2, int64_t((now ...
1
vote
0answers
33 views

Config paramter default_max_block_cpu_usage and unit tests

We have problem with built-in unit-tests when we increase min_activated_stake (producer_pay.cpp): const int64_t min_activated_stake = 300'000'000'0000; And unit tests agrio_system_tests/...
2
votes
1answer
102 views

Initialization of system account within unit tests

I check system account resources just after test initialization start. And i see that ram_usage is already 62206 bytes. Where is this bytes come from? eosio_system_tester.hpp ... template<...
1
vote
1answer
100 views

Time dependent EOS unit test

My contract has time dependent actions, which I want to test. How can I mock the clock in the smart contract such that I can set it to any time I want? An example of one action that is time ...
1
vote
1answer
47 views

Unittests. cross_15_percent_threshold() failure;

I execute unit tests. For example, that one: ./build/unittests/unit_test -t eosio_system_tests/fail_without_auth And receive failure: assertion failure with message: cannot undelegate bandwidth ...
8
votes
1answer
394 views

How to add a unit test for a new contract [duplicate]

I am currently on eosio v1.1 but will be upgrading to v1.2 shortly. I am trying to create a new unit test for my contract. The existing unittest work when I run the following: cd eos/build/unittest ...
2
votes
1answer
80 views

EOSFactory Testnet Error

I've just installed eosfactory and a fresh copy of EOS on my WSL ubuntu 18.04 and I'm failing all of the initial unit tests indicating there might be a problem with my install. The tests fail at the ...
4
votes
4answers
384 views

Testing Contracts

There used to be a directory wasm_tests in the eos/tests directory which contained several c++ files that unit tested contracts. https://github.com/EOSIO/eos/tree/dawn-v3.0.0/tests/wasm_tests . This ...
1
vote
1answer
189 views

Is it possible to compile a smart contract using g++ or clang?

I want to write and execute some unit tests on a smart contract outside of nodeos, but to do that I need to be able to compile the code the normal C++ way, using g++ or clang, so that I get object or ...
7
votes
1answer
401 views

Unit testing custom contracts [duplicate]

What is the best way to write contracts in a TDD style? The eos source repo has unit tests which seem to be focused around testing the platform but my question is focused at the next level up (based ...