Converted tests from sprintf() to xsnprintf().