Questions tagged [unit-tests]

The tag has no usage guidance.

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

EOSlime TypeError: Contract.actionname is not a function

This is my test file: const assert = require('assert'); const TOKEN_WASM_PATH = './contracts/group/group.wasm'; const TOKEN_ABI_PATH = './contracts/group/group.abi'; describe("EOSIO Group", ...
user avatar
  • 293
0 votes
1 answer
46 views

eoslime test not saving data in table

This is my first experience with eoslime as I want to do unit testing for smart contracts. Not much experienced with nodejs .I am following eoslime documentation: https://docs.eoslime.limechain.tech/...
user avatar
  • 293
0 votes
1 answer
29 views

How to access and manipulate tables when using native unit tests?

I am trying to write unit tests for functions in a smart contract that require access to tables within the smart contract. I tried to set this up using the hello_test.cpp code as a base and when I get ...
user avatar
0 votes
1 answer
113 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\":...
user avatar
  • 101
1 vote
1 answer
48 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 ...
user avatar
1 vote
1 answer
66 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* ...
user avatar
1 vote
1 answer
51 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 ...
user avatar
  • 125
1 vote
0 answers
22 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 ...
user avatar
  • 125
3 votes
1 answer
81 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 ...
user avatar
  • 125
1 vote
0 answers
40 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/...
user avatar
  • 125
2 votes
1 answer
112 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<...
user avatar
  • 125
1 vote
1 answer
129 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 ...
user avatar
  • 93
1 vote
1 answer
61 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 ...
user avatar
  • 21
8 votes
1 answer
455 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 ...
user avatar
2 votes
1 answer
86 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 ...
user avatar
4 votes
4 answers
517 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 ...
user avatar
1 vote
1 answer
222 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 ...
user avatar
7 votes
1 answer
431 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 ...
user avatar