Added tests for math module.

Though not all tests pass yet.
Those which fail are marked as TODO.