Added Unit test and updated method sum()

I made a unit test for number above 1000. I also updated the method sum
so that it does not allow an input of numbers larger than 1000.