Add unit tests for calc function