Skip to content

Commit

Permalink
add unit tests for actual data
Browse files Browse the repository at this point in the history
  • Loading branch information
moodysalem committed Mar 4, 2024
1 parent 9d69e51 commit 941cc25
Showing 1 changed file with 67 additions and 0 deletions.
67 changes: 67 additions & 0 deletions src/airdrop_test.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -195,3 +195,70 @@ fn test_claim_two_claims() {
assert_eq!(token.balance_of(airdrop.contract_address), 1);
assert_eq!(token.balance_of(claim_b.claimee), 789);
}

#[test]
fn test_claims_from_generated_tree() {
let claim_0 = Claim {
id: 0,
claimee: contract_address_const::<
1257981684727298919953780547925609938727371268283996697135018561811391002099
>(),
amount: 845608158412629999616,
};

let claim_1 = Claim {
id: 1,
claimee: contract_address_const::<
2446484730111463702450186103350698828806903266085688038950964576824849476058
>(),
amount: 758639984742607224832,
};

let (_, token) = deploy_token('AIRDROP', 'AD', claim_0.amount.into() + claim_1.amount.into());

let root = 2413984000256568988735068618807996871735886303454043475744972321149068137869;
let airdrop = deploy(token.contract_address, root);

token.transfer(airdrop.contract_address, claim_0.amount.into() + claim_1.amount.into());

airdrop
.claim(
claim_1,
array![
2879705852068751339326970574743249357626496859246711485336045655175496222574,
2591818886036301641799899841447556295494184204908229358406473782788431853617,
3433559452610196359109559589502585411529094342760420711041457728474879804685,
119111708719532621104568211251857481136318454621898627733025381039107349350,
1550418626007763899979956501892881046988353701960212721885621375458028218469,
218302537176435686946721821062002958322614343556723420712784506426080342216,
1753580693918376168416443301945093568141375497403576624304615426611458701443,
284161108154264923299661757093898525322488115499630822539338320558723810310,
3378969471732886394431481313236934101872088301949153794471811360320074526103,
2691963575009292057768595613759919396863463394980592564921927341908988940473,
22944591007266013337629529054088070826740344136663051917181912077498206093,
2846046884061389749777735515205600989814522753032574962636562486677935396074
]
);

let log = pop_log::<Airdrop::Claimed>(airdrop.contract_address).unwrap();
assert_eq!(log.claim, claim_1);

airdrop
.claim(
claim_0,
array![
390013443931943946052075510188945600544108471539235465760564815348896073043,
2591818886036301641799899841447556295494184204908229358406473782788431853617,
3433559452610196359109559589502585411529094342760420711041457728474879804685,
119111708719532621104568211251857481136318454621898627733025381039107349350,
1550418626007763899979956501892881046988353701960212721885621375458028218469,
218302537176435686946721821062002958322614343556723420712784506426080342216,
1753580693918376168416443301945093568141375497403576624304615426611458701443,
284161108154264923299661757093898525322488115499630822539338320558723810310,
3378969471732886394431481313236934101872088301949153794471811360320074526103,
2691963575009292057768595613759919396863463394980592564921927341908988940473,
22944591007266013337629529054088070826740344136663051917181912077498206093,
2846046884061389749777735515205600989814522753032574962636562486677935396074
]
);
}

0 comments on commit 941cc25

Please sign in to comment.