主要著重在Foundry test的部分
包含 testCustomAllowlist, testCustomAllowlistMultiple, testLimitCheckUnitsm testBasicAllowlistFuzz, testProcessClaimFuzz
補充: Fuzzing test 過去也有一篇鐵人賽文章 - 模糊測試從入門到放棄
HypercertMinterTest - testClaimSingleFraction, testClaimTenFractions,testClaimHundredFractions, testClaimTenFractionsDisallowAll, testClaimTenFractionsFromCreatorOnly
HypercertMinterPausableTest - testPause
用來確保 HypercertMinter 的暫停功能正常工作。當合約被暫停時,某些功能應該被阻止執行,而當暫停被解除後,這些功能應該可以正常執行。
HypercertBatchMintingTest - testFailBatchMintWrongData, testBatchMintTwoAllowlists, testBatchMintFourAllowlists, testBatchMintAllowlistsFuzz, testBatchMintFourAllowlistsDisallowAll, testBatchMintFourAllowlistsFromCreatorOnly
確保 minter 的批量鑄幣功能從不同的允許列表中正常工作。每個測試函數都會模擬不同的情境,例如從兩個、四個或多個允許列表中批量鑄幣,以及在不同的轉移限制下批量鑄幣。
HypercertMinterTransferTest - testTransferAllowAll, testTransferDisallowAll, testTransferFromCreatorOnly, testTransferAllowancesAllowAll, testTransferAllowancesDisallowAll, testTransferAllowancesFromCreatorOnly
確認不同transferRestriction對應不同的transfer testing
SemiFungible1155DefaultTest - testSplitValue, testSplitValueLarge, testMergeValue, testMergeValueFuzz
測試半可替代代幣(Semi-Fungible Tokens, SFTs)的基本功能。
SemiFungible1155UnitsTest - testUnitsSingleFraction, testUnitsMultipleFractions
SemiFungible1155AllowanceTest - testTransferAllowance, testSplitAllowance, testMergeAllowance, testBurnAllowance, testToggleAllowance
SemiFungible1155MintingTest -
UNHAPPY FLOWS: testMintZeroValue, testMintWithZeroInArray, testOverflowItemIndex, testOverflowTypes
HAPPY MINTING: testMintValueSingle, testFuzzMintValueSingle, testMintValueArray
SemiFungible1155BurnTest - testBurnFraction, testCannotBurnClaim
SemiFungible1155TransferTest -
UNHAPPY PATHS: testFailTransferTypeIDToken, testFailTransferNonExistingFractionToken, testTransferNonExistingTokenWithValue, testTransferNonExistingFungibleTokenTokenNoValue
FULL TOKENS: testTransferFullToken, testFuzzTransferFullToken
FRACTIONS: testTransferFraction, testFuzzTransferFraction
於測試位移操作的功能
確保性能的功能正常工作。每個測試函數都會模擬不同的情境,例如鑄造單一分數的代幣、鑄造多個分數的代幣、以及批量鑄造代幣。這些測試函數可以幫助開發者確保合約的功能在不同的情境下都能正常工作。