TruCol / Decentralised-Venture-Capital-Protocol

Decentralised SAAS Investment Protocol written in Solidity.
GNU Affero General Public License v3.0
3 stars 0 forks source link

Change hardcoded tests into fuzztests. #20

Open a-t-0 opened 2 months ago

a-t-0 commented 2 months ago

Where possible, change the tests from hardcoded tests, to fuzztests with random variables over ranges. For example see: https://book.getfoundry.sh/forge/fuzz-testing

a-t-0 commented 1 month ago
// Assume requirements on contract initialisation by project lead are valid.
    // vm.assume(projectLeadFracDenominator > 0);
    // vm.assume(firstCeiling > 0);
    // vm.assume(additionalWaitPeriod > 0);
    // vm.assume(raisePeriod > 0);
    // vm.assume(investmentTarget > 0);
    // vm.assume(firstCeiling < secondCeiling);
    // vm.assume(secondCeiling < thirdCeiling);
    // vm.assume(investmentTarget <= thirdCeiling);
    // vm.assume(projectLeadFracNumerator <= projectLeadFracDenominator);
    // vm.assume(firstMultiple > 1);
    // vm.assume(secondMultiple > 1);
    // vm.assume(thirdMultiple > 1);

    // Assume an investor tries to invest at least 1 wei.
    // vm.assume(firstInvestmentAmount > 0);

    // Store multiples in an array to assert they do not lead to an overflow when computing the investor return.
    // uint8[] memory multiples = new uint8[](3);
    // multiples[0] = firstMultiple;
    // multiples[1] = secondMultiple;
    // multiples[2] = thirdMultiple;
    // vm.assume(!_testHelper.sumOfNrsThrowsOverFlow({ numbers: multiples }));
    // vm.assume(
    // !_testHelper.yieldsOverflowMultiply({
    // a: firstMultiple + secondMultiple + thirdMultiple,
    // b: firstInvestmentAmount
    // })
    // );