Add unit tests for fitting functions