Added tests and benchmarks to factorial