diff --git a/.gitmodules b/.gitmodules index 3146699..bc966a8 100644 --- a/.gitmodules +++ b/.gitmodules @@ -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 diff --git a/lib/solmate b/lib/solmate new file mode 160000 index 0000000..bfc9c25 --- /dev/null +++ b/lib/solmate @@ -0,0 +1 @@ +Subproject commit bfc9c25865a274a7827fea5abf6e4fb64fc64e6c diff --git a/test/Huffplug.t.sol b/test/Huffplug.t.sol index f110989..96f3361 100644 --- a/test/Huffplug.t.sol +++ b/test/Huffplug.t.sol @@ -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; @@ -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));