Skip to content

Instantly share code, notes, and snippets.

View dubzn's full-sized avatar
😼

Santiago Galván (Dub) dubzn

😼
View GitHub Profile
@dubzn
dubzn / v3-core-tests.txt
Last active September 1, 2023 17:52
Run core-v3 tests
Install Hardhat and run all tests:
npm add --save-dev hardhat
yarn install // Delete yarn.lock if an error occurs
yarn run test
For specific file:
yarn test ./test/SwapMath.spec.ts
sources:
- https://docs.uniswap.org/contracts/v3/guides/local-environment
// Test to evaluate rounding behavior and zeros
#[test]
fn test_division_round_with_negative_result() {
// -10/ 3 = 0
let a = IntegerTrait::<i256>::new(10, true);
let b = IntegerTrait::<i256>::new(3, false);
let (q, r) = a.div_rem(b);
assert(q.mag == 3 && r.mag == 1, '-10 / 3 = (-3, -1)'); // should be (-3, 1)?
assert(q.sign == true && r.sign == true, '(neg, neg)');