Added test for reduce function