SiaFoundation / core

Core packages for the Sia project
MIT License
51 stars 7 forks source link

100% test coverage in consensus package #130

Open lukechampine opened 8 months ago

lukechampine commented 8 months ago

Even 100% coverage doesn't guarantee your code is bug-free, but it's certainly a great first step. Let's try to reach 100% coverage in consensus, testing every single edge case. :)

Any increase in test coverage, even 1%, qualifies for our Hacktoberfest event, so don't be shy!

rajkumarGosavi commented 8 months ago

Hi @lukechampine i have raised a minor PR to increase coverage for update.go and validate.go, please review.

lukechampine commented 8 months ago

Here's a listing of the remaining uncovered code, with my suggestions on how to write a test for them:

I know this seems like a lot, but many of them just need a trivial test case, and many others have substantial overlap (e.g. two good tests for v1 and v2 contracts would add a ton of coverage).

For absolute beginners/newcomers, I recommend starting with validateHeader, ValidateOrphan, or MaxFutureTimestamp.