mirror of
https://github.com/lens-protocol/core.git
synced 2026-01-07 21:34:03 -05:00
misc: SVG generators became scripts instead of tests
Co-authored-by: Victor Naumik <vicnaum@gmail.com>
This commit is contained in:
1
.github/workflows/ci.yml
vendored
1
.github/workflows/ci.yml
vendored
@@ -31,6 +31,5 @@ jobs:
|
||||
- name: Run Tests
|
||||
run: |
|
||||
cp .env.example .env
|
||||
bash initSvgDirs.sh
|
||||
source .env
|
||||
FOUNDRY_PROFILE=citest forge test -vvv
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.8.13;
|
||||
|
||||
import 'forge-std/Test.sol';
|
||||
import 'forge-std/Script.sol';
|
||||
|
||||
import {FollowSVG} from 'contracts/libraries/svgs/Follow/FollowSVG.sol';
|
||||
|
||||
@@ -11,7 +11,7 @@ contract FollowNFT {
|
||||
}
|
||||
}
|
||||
|
||||
contract FollowSVGTest is Test {
|
||||
contract FollowSVGGen is Script {
|
||||
FollowNFT followNFT;
|
||||
string constant dir = 'svgs/';
|
||||
|
||||
@@ -19,7 +19,7 @@ contract FollowSVGTest is Test {
|
||||
followNFT = new FollowNFT();
|
||||
}
|
||||
|
||||
function testTest() public {
|
||||
function run() external {
|
||||
vm.writeFile(string.concat(dir, 'follows/follow_1_gold.svg'), followNFT.tryWithTokenId(1));
|
||||
vm.writeFile(string.concat(dir, 'follows/follow_11_normal.svg'), followNFT.tryWithTokenId(11));
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.8.13;
|
||||
|
||||
import 'forge-std/Test.sol';
|
||||
import 'forge-std/Script.sol';
|
||||
|
||||
import {HandleSVG} from 'contracts/libraries/svgs/Handle/HandleSVG.sol';
|
||||
|
||||
@@ -11,7 +11,7 @@ contract HandleNFT {
|
||||
}
|
||||
}
|
||||
|
||||
contract HandleSVGTest is Test {
|
||||
contract HandleSVGGen is Script {
|
||||
HandleNFT handleNFT;
|
||||
string constant dir = 'svgs/';
|
||||
|
||||
@@ -66,4 +66,9 @@ contract HandleSVGTest is Test {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function run() external {
|
||||
testHandles();
|
||||
testWWW();
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.8.13;
|
||||
|
||||
import 'forge-std/Test.sol';
|
||||
import 'forge-std/Script.sol';
|
||||
import {Skin, Background, Helpers} from 'contracts/libraries/svgs/Profile/Helpers.sol';
|
||||
import {Face} from 'contracts/libraries/svgs/Profile/Face.sol';
|
||||
import {Legs} from 'contracts/libraries/svgs/Profile/Legs.sol';
|
||||
@@ -23,7 +23,7 @@ contract ProfileNFT {
|
||||
}
|
||||
}
|
||||
|
||||
contract ProfileSVGTest is Test {
|
||||
contract ProfileSVGGen is Script {
|
||||
ProfileNFT profileNFT;
|
||||
string constant dir = 'svgs/';
|
||||
|
||||
@@ -189,15 +189,7 @@ contract ProfileSVGTest is Test {
|
||||
|
||||
function testGoldProfiles1() public {
|
||||
uint256 i;
|
||||
for (i = 1; i < 500; i++) {
|
||||
string memory result = profileNFT.tryProfile(i);
|
||||
vm.writeFile(string.concat(dir, 'profiles_gold/profile_', vm.toString(i), '.svg'), result);
|
||||
}
|
||||
}
|
||||
|
||||
function testGoldProfiles2() public {
|
||||
uint256 i;
|
||||
for (i = 500; i <= 1000; i++) {
|
||||
for (i = 1; i < 10; i++) {
|
||||
string memory result = profileNFT.tryProfile(i);
|
||||
vm.writeFile(string.concat(dir, 'profiles_gold/profile_', vm.toString(i), '.svg'), result);
|
||||
}
|
||||
@@ -221,14 +213,14 @@ contract ProfileSVGTest is Test {
|
||||
string memory result = profileNFT.tryProfile(i);
|
||||
vm.writeFile(string.concat(dir, 'profiles/profile_', vm.toString(i), '.svg'), result);
|
||||
|
||||
for (i = 35000; i < 35500; i++) {
|
||||
for (i = 35000; i < 35010; i++) {
|
||||
result = profileNFT.tryProfile(i);
|
||||
vm.writeFile(string.concat(dir, 'profiles/profile_', vm.toString(i), '.svg'), result);
|
||||
}
|
||||
}
|
||||
|
||||
function testFuzzProfiles() public {
|
||||
for (uint256 i = 1; i < 1000; i++) {
|
||||
for (uint256 i = 1; i < 10; i++) {
|
||||
uint256 profileId = uint256(keccak256(abi.encode(i))) % 10000000;
|
||||
string memory result = profileNFT.tryProfile(profileId);
|
||||
vm.writeFile(string.concat(dir, 'profiles_fuzz/profile_', vm.toString(profileId), '.svg'), result);
|
||||
@@ -244,4 +236,18 @@ contract ProfileSVGTest is Test {
|
||||
function setColor(uint256 newByte, Helpers.ComponentBytes componentByte) internal pure returns (uint256) {
|
||||
return newByte << ((31 - uint8(componentByte)) * 8);
|
||||
}
|
||||
|
||||
function run() external {
|
||||
testBackgrounds();
|
||||
testSkins();
|
||||
testLegs();
|
||||
testShoes();
|
||||
testFaces();
|
||||
testHandsAndBody();
|
||||
testLogoWithBody();
|
||||
testHeadwear();
|
||||
testGoldProfiles1();
|
||||
testProfiles();
|
||||
testFuzzProfiles();
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,10 @@ mkdir headwear
|
||||
mkdir profiles_gold
|
||||
mkdir profiles
|
||||
mkdir profiles_fuzz
|
||||
|
||||
mkdir follows
|
||||
mkdir handles
|
||||
cd ..
|
||||
|
||||
forge script script/svg/FollowSVGGen.s.sol:FollowSVGGen
|
||||
forge script script/svg/HandleSVGGen.s.sol:HandleSVGGen
|
||||
forge script script/svg/ProfileSVGGen.s.sol:ProfileSVGGen
|
||||
Reference in New Issue
Block a user