git-consensus / contracts

Converts the informal ownership structure of an open-source git project to a formal DAO, with token distribution mechanisms for contributors.
GNU General Public License v3.0
13 stars 0 forks source link

Fix bugs and write tests #7

Closed DmitriyShepelev closed 2 years ago

DmitriyShepelev commented 2 years ago

Description

Test Coverage

 forge test
[⠒] Compiling...
[⠊] Compiling 1 files with 0.8.17
[⠒] Solc 0.8.17 finished in 778.44ms
Compiler run successful

Running 2 tests for contracts/test/GitConsensus.t.sol:GasBenchmark
[PASS] testGas_commit() (gas: 433200)
[PASS] testGas_release() (gas: 432232)
Test result: ok. 2 passed; 0 failed; finished in 852.57ms

Running 10 tests for contracts/test/Utils.t.sol:UtilsTest
[PASS] testOK_parseAddrGeneralCase() (gas: 23336)
[PASS] testOk_indexOfAddrNonexistentADDR_STRNonemptyMsg() (gas: 6515)
[PASS] testOk_indexOfAddressGeneralCase() (gas: 10596)
[PASS] testOk_indexOfAddressNonexistentADDR_STREmptyMsg() (gas: 257)
[PASS] testOk_indexOfAddressTrivialCase() (gas: 10303)
[PASS] testOk_substringEmptyString() (gas: 1168)
[PASS] testOk_substringEntireString() (gas: 11962)
[PASS] testOk_substringGeneralCase() (gas: 25086)
[PASS] testOk_substringOutOfBoundsNoOverflow() (gas: 7320)
[PASS] testOk_substringOutOfBoundsOverflow() (gas: 6263)
Test result: ok. 10 passed; 0 failed; finished in 2.07s

Running 17 tests for contracts/test/GitConsensus.t.sol:WhenCallingGitConsensus
[PASS] testOk_commitEmptyFailed(address) (runs: 256, μ: 61493, ~: 61493)
[PASS] testOk_commitEmptyMsgAddr(address) (runs: 256, μ: 348823, ~: 345190)
[PASS] testOk_commitEmptyMsgAddrMalformed(address) (runs: 256, μ: 93757, ~: 93757)
[PASS] testOk_commitFilledFailed(address) (runs: 256, μ: 952474, ~: 952474)
[PASS] testOk_commitFilledMsgAddr(address) (runs: 256, μ: 2136596, ~: 2132959)
[PASS] testOk_commitPartialFailed(address) (runs: 256, μ: 51803, ~: 51803)
[PASS] testOk_commitPartialMsgAddr(address) (runs: 256, μ: 335397, ~: 332130)
[PASS] testOk_commitTwoHashDiffMsgAddrNotMatch(address,address) (runs: 256, μ: 652630, ~: 645494)
[PASS] testOk_commitTwoHashDiffMsgAddrNotMatchWSender(address,address) (runs: 256, μ: 653228, ~: 646320)
[PASS] testOk_commitTwoHashDiffMsgStrNotMatch(address) (runs: 256, μ: 650000, ~: 643825)
[PASS] testOk_releaseEmptyFailed(address) (runs: 256, μ: 62171, ~: 62171)
[PASS] testOk_releaseEmptyMsgAddr(address) (runs: 256, μ: 347215, ~: 344089)
[PASS] testOk_releaseFilledFailed(address) (runs: 256, μ: 888248, ~: 888248)
[PASS] testOk_releaseFilledMsgAddr(address) (runs: 256, μ: 1941778, ~: 1938526)
[PASS] testOk_releasePartialFailed(address) (runs: 256, μ: 51862, ~: 51862)
[PASS] testOk_releasePartialMsgAddr(address) (runs: 256, μ: 334357, ~: 330907)
[PASS] testOk_releaseTwoHashDiffMsgStrNotMatch(address) (runs: 256, μ: 650260, ~: 643483)
Test result: ok. 17 passed; 0 failed; finished in 2.19s