Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [unit-tests]

The tag has no usage guidance.

1
vote
1answer
16 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
12 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
32 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
20 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/...
1
vote
1answer
42 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
25 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
22 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 ...
5
votes
0answers
126 views

How to add a unit test for a new contract

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
59 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
2answers
98 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 ...
6
votes
1answer
191 views

Unit testing custom contracts

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 ...