Skip to content

Commit

Permalink
Add solmate, lo uso para testear el renderer de url con fuzzing
Browse files Browse the repository at this point in the history
  • Loading branch information
eugenioclrc committed Aug 6, 2023
1 parent 9b6e7c7 commit 2522483
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@
[submodule "lib/foundry-huff"]
path = lib/foundry-huff
url = https://github.com/huff-language/foundry-huff
[submodule "lib/solmate"]
path = lib/solmate
url = https://github.com/transmissions11/solmate
1 change: 1 addition & 0 deletions lib/solmate
Submodule solmate added at bfc9c2
10 changes: 10 additions & 0 deletions test/Huffplug.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {compile, create} from "huff-runner/Deploy.sol";
import {IERC721} from "forge-std/interfaces/IERC721.sol";
import {TokenRenderer} from "src/TokenRenderer.sol";

import {LibString} from "solmate/utils/LibString.sol";
using { compile } for Vm;
using { create } for bytes;

Expand All @@ -31,6 +32,15 @@ contract CounterTest is Test {
assertEq(renderer.tokenURI(3), "https://huffplug.com/3.json");
}

function testRendererFuzz(uint256 id) public {
if (id == 0 || id > 1024) {
vm.expectRevert();
huffplug.tokenURI(id);
} else {
string memory expected = string.concat("https://huffplug.com/",LibString.toString(id),".json");
assertEq(huffplug.tokenURI(id), expected);
}
}
function testMint() public {
huffplug.mint(address(0x01), 3);
assertEq(huffplug.ownerOf(3), address(0x01));
Expand Down

0 comments on commit 2522483

Please sign in to comment.