Merge pull request #342 from caitp/ciarrow_unittest

Fix ciarrow_unittest +style issues
Fix csgeneric_unittest

Wrapped lines in cigeneric_unittest.cpp to 80 columns
Make use of helper functions for error checks where possible
Expect rather than assert where possible
Safety checks to prevent buffer overflows/out of bounds access