Add factorial example with tests