satoru
satoru copied to clipboard
test: Improve tests of `adl_utils` library.
Description
Implement and improve tests of adl_utils
library.
File: test/adl/adl_utils.cairo
.
Acceptance criteria
- Unit tests (nominal and failure) are implemented and passing.
Can I try working on this?
Of course
Hello @sparqet i need some clarifications. I can't seem to figure out why this test fails and what it expects.
// Setup
let (caller_address, role_store, data_store, event_emitter, oracle) = setup_oracle_and_store();
// TODO
// For testing "get_enabled_market", "get_market_prices" and "is_pnl_factor_exceeded_direct" should be implmented
let market = 'market'.try_into().unwrap();
let is_long = true;
let block_value = 1234_u64;
adl_utils::set_latest_adl_block(data_store, market, is_long, block_value);
let block_numbers = array![10_u64, 11_u64];
adl_utils::update_adl_state(
data_store, event_emitter, oracle, market, is_long, block_numbers.span()
);
teardown(data_store.contract_address);
}```
Here's the error code ```[FAIL] tests::adl::test_adl_utils::given_normal_conditions_when_update_adl_state_then_works
Failure data:
original value: [679294546788681927074128974206947708677311959581332250879971221889508708], converted to a string: [block_no_smaller_than_required]
Tests: 0 passed, 1 failed, 0 skipped
Failures:
Sorry for the delay in starting the task, I had some emergencies to attend to. I'll await your response. Thanks
Hello @faytey ! Sorry for my late reply, this last month has been very busy for me.
This test fails because you've set the latest_adl_block
of the specific market at 1234, and when you call update_adl_state
, you give an array of u64 with lower values than the block number you've set before for the same market
yes, i figured it and corrected it, which has been merged already, would you want me to work on another issue