Added matrix tests from the Ruby source, and fixed a few of the issues with the contracts that they discovered.

@bsoetaer 
No need to read all the unit test code - I just copied it right from the Ruby source, version 1.9.3p484, and modified it to not rely on the Matrix class.