Implemented preorder generator
Added tests for preorder generator