Added randomized tests, and moved tests to separate file