Added unit test, found some issues and fixed it

Hi,

I've forked your repo and added some unit tests.
While doing so, some tests went red - so I've fixed the issues (except one).
Summary:
FIX: country name contains a '\r' on windows
FIX: wrong calculation of midpoints
FIX: lower IP ranges, leftmost and rightmost borders are correctly detected, as unit tests are green now

There is still one test red - but I'm not sure, how to fix it.

Any feedback is welcome.

Regards
Martin