Skip to content

Commit

Permalink
adding more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Viacheslav Zhygulin authored and Viacheslav Zhygulin committed Jun 20, 2024
1 parent 1bcf1b4 commit d811ae5
Showing 1 changed file with 143 additions and 0 deletions.
143 changes: 143 additions & 0 deletions test/BTCDepositAddressDeriver.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,149 @@ contract BTCDepositAddressDeriverTest is Test {
);
}

function testParseBTCTaprootAddress3() public {
vm.expectRevert();
(uint256 x, uint256 y) = deriver.parseBTCTaprootAddress(
"tb",
"tc1p0xlxvlhemja6c4dqv22uapctqupfhlxm9h8z3k2e72q4k9hcz7vq5zuyut"
);
}

function testParseBTCTaprootAddress4() public {
vm.expectRevert();
(uint256 x, uint256 y) = deriver.parseBTCTaprootAddress(
"bc",
"bc1p0xlxvlhemja6c4dqv22uapctqupfhlxm9h8z3k2e72q4k9hcz7vqh2y7hd"
);
}

function testParseBTCTaprootAddress5() public {
vm.expectRevert();
(uint256 x, uint256 y) = deriver.parseBTCTaprootAddress(
"bc",
"BC1S0XLXVLHEMJA6C4DQV22UAPCTQUPFHLXM9H8Z3K2E72Q4K9HCZ7VQ54WELL"
);
}

function testParseBTCTaprootAddress6() public {
vm.expectRevert();
(uint256 x, uint256 y) = deriver.parseBTCTaprootAddress(
"tb",
"tb1q0xlxvlhemja6c4dqv22uapctqupfhlxm9h8z3k2e72q4k9hcz7vq24jc47"
);
}

function testParseBTCTaprootAddress7() public {
vm.expectRevert();
(uint256 x, uint256 y) = deriver.parseBTCTaprootAddress(
"bc",
"bc1p38j9r5y49hruaue7wxjce0updqjuyyx0kh56v8s25huc6995vvpql3jow4"
);
}

function testParseBTCTaprootAddress8() public {
vm.expectRevert();
(uint256 x, uint256 y) = deriver.parseBTCTaprootAddress(
"bc",
"BC130XLXVLHEMJA6C4DQV22UAPCTQUPFHLXM9H8Z3K2E72Q4K9HCZ7VQ7ZWS8R"
);
}

function testParseBTCTaprootAddress9() public {
vm.expectRevert();
(uint256 x, uint256 y) = deriver.parseBTCTaprootAddress(
"bc",
"bc1pw5dgrnzv"
);
}

function testParseBTCTaprootAddress10() public {
vm.expectRevert();
(uint256 x, uint256 y) = deriver.parseBTCTaprootAddress(
"bc",
"bc1p0xlxvlhemja6c4dqv22uapctqupfhlxm9h8z3k2e72q4k9hcz7v8n0nx0muaewav253zgeav"
);
}

function testParseBTCTaprootAddress11() public {
vm.expectRevert();
(uint256 x, uint256 y) = deriver.parseBTCTaprootAddress(
"tb",
"tb1p0xlxvlhemja6c4dqv22uapctqupfhlxm9h8z3k2e72q4k9hcz7vq47Zagq"
);
}

function testParseBTCTaprootAddress12() public {
vm.expectRevert();
(uint256 x, uint256 y) = deriver.parseBTCTaprootAddress(
"bc",
"bc1p0xlxvlhemja6c4dqv22uapctqupfhlxm9h8z3k2e72q4k9hcz7v07qwwzcrf"
);
}

function testParseBTCTaprootAddress13() public {
vm.expectRevert();
(uint256 x, uint256 y) = deriver.parseBTCTaprootAddress(
"tb",
"tb1p0xlxvlhemja6c4dqv22uapctqupfhlxm9h8z3k2e72q4k9hcz7vpggkg4j"
);
}

function testParseBTCTaprootAddress14() public {
vm.expectRevert();
(uint256 x, uint256 y) = deriver.parseBTCTaprootAddress(
"bc",
"bc1gmk9yu"
);
}

function testParseBTCTaprootAddress15() public {
(uint256 x, uint256 y) = deriver.parseBTCTaprootAddress(
"bc",
"bc1p0xlxvlhemja6c4dqv22uapctqupfhlxm9h8z3k2e72q4k9hcz7vqzk5jj0"
);
assertEq(
x,
0x79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798
);
assertEq(
y,
0x483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8
);
}

function testParseBTCTaprootAddress16() public {
(uint256 x, uint256 y) = deriver.parseBTCTaprootAddress(
"tb",
"tb1pqqqqp399et2xygdj5xreqhjjvcmzhxw4aywxecjdzew6hylgvsesf3hn0c"
);
assertEq(
x,
0xC4A5CAD46221B2A187905E5266362B99D5E91C6CE24D165DAB93E86433
);
assertEq(
y,
0xE938F4061E36DEF24C05DDCFD738363AAFF7BBC09267C7079451A0F169500766
);
}

function testParseBTCTaprootAddress17() public {
(uint256 x, uint256 y) = deriver.parseBTCTaprootAddress(
"bc",
"bc1pldma57nkrdrvtx7elspzgfa23qcxglzzunxxmqkwq8pnwpa4sd6s3406mu"
);
assertEq(
x,
0xFB77DA7A761B46C59BD9FC022427AA8830647C42E4CC6D82CE01C33707B58375
);
assertEq(
y,
0x68251ED41C7645E4AE49F68B0F4A207E4327501CB0B4BB7E3F5D86EF815794C6
);
//console.log("pubkey:", x, y);
}


function testSetSeed() public {
assertEq(deriver.wasSeedSet(), false);
assertEq(deriver.btcAddr1(), "");
Expand Down

0 comments on commit d811ae5

Please sign in to comment.