nervosnetwork / ckb-light-client

CKB light client reference implementation
MIT License
14 stars 16 forks source link

refactor: split large functions into several and add unit tests #49

Closed yangby-cryptape closed 2 years ago

yangby-cryptape commented 2 years ago

Issue

There are lots of duplicate code between send_block_proof.rs and send_block_samples.rs.

Merge these code into several functions and add unit tests for them.

codecov-commenter commented 2 years ago

Codecov Report

Merging #49 (79aa87a) into develop (7a7a293) will increase coverage by 3.70%. The diff coverage is 19.19%.

@@             Coverage Diff             @@
##           develop      #49      +/-   ##
===========================================
+ Coverage    23.13%   26.84%   +3.70%     
===========================================
  Files           22       22              
  Lines         3328     3338      +10     
  Branches       463      462       -1     
===========================================
+ Hits           770      896     +126     
+ Misses        2473     2353     -120     
- Partials        85       89       +4     
Flag Coverage Δ
unittests 26.84% <19.19%> (+3.70%) :arrow_up:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...tocols/light_client/components/send_block_proof.rs 0.00% <0.00%> (ø)
src/protocols/light_client/mod.rs 0.00% <0.00%> (ø)
...cols/light_client/components/send_block_samples.rs 43.41% <19.88%> (+15.04%) :arrow_up:
src/main.rs 16.66% <100.00%> (ø)
src/protocols/light_client/sampling.rs 98.30% <100.00%> (+88.13%) :arrow_up:
src/protocols/status.rs 17.07% <0.00%> (+17.07%) :arrow_up:

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.