Unit test for formatting functions