fix bug on sourced percentage, add test

Because of a integer division error, with one sourced line out of two,
the sourcing percentage was zero instead of 0.5. Added a test to check
this case.