mirror of
https://github.com/arnaucube/poseidon-solidity-example.git
synced 2026-01-12 17:11:30 +01:00
add code
This commit is contained in:
17
test/Poseidon.t.sol
Normal file
17
test/Poseidon.t.sol
Normal file
@@ -0,0 +1,17 @@
|
||||
// SPDX-License-Identifier: UNLICENSED
|
||||
pragma solidity ^0.8.13;
|
||||
|
||||
import "forge-std/Test.sol";
|
||||
import {Poseidon, Poseidon2, Poseidon3} from "../src/Poseidon.sol";
|
||||
|
||||
contract PoseidonTest is Test {
|
||||
Poseidon2 poseidon2;
|
||||
|
||||
function setUp() public {
|
||||
poseidon2 = new Poseidon().poseidon2();
|
||||
}
|
||||
|
||||
function testPoseidon2() public {
|
||||
assertEq(poseidon2.poseidon([uint256(1), uint256(2)]), 7853200120776062878684798364095072458815029376092732009249414926327459813530);
|
||||
}
|
||||
}
|
||||
14
test/keccak256.t.sol
Normal file
14
test/keccak256.t.sol
Normal file
@@ -0,0 +1,14 @@
|
||||
// SPDX-License-Identifier: UNLICENSED
|
||||
pragma solidity ^0.8.13;
|
||||
|
||||
import "forge-std/Test.sol";
|
||||
import {Keccak256} from "../src/keccak256.sol";
|
||||
|
||||
contract Keccak256Test is Test {
|
||||
Keccak256 keccak256hash;
|
||||
|
||||
function testKeccak256() public {
|
||||
// assertEq(keccak256hash.hash("asdf"), 7853200120776062878684798364095072458815029376092732009249414926327459813530);
|
||||
keccak256(abi.encodePacked(uint256(1)));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user