Wrote the test class for calcIndex()