September 23, 2007

Test String Padding Functions

private static void TestPadding()
{
int ix = 0;
string result = string.Empty;
result = ix.ToString("X");
result = result.PadLeft(8, '0');
System.Diagnostics.Debug.Assert(result.Length == 8);
ix = 1;
result = ix.ToString("X");
result = result.PadLeft(8, '0');
System.Diagnostics.Debug.Assert(result.Length == 8);
ix = 9999;
result = ix.ToString("X");
result = result.PadLeft(8, '0');
System.Diagnostics.Debug.Assert(result.Length == 8);
ix = 99999999;
result = ix.ToString("X");
result = result.PadLeft(8, '0');
System.Diagnostics.Debug.Assert(result.Length == 8);
ix = int.MaxValue;
result = ix.ToString("X");
result = result.PadLeft(8, '0');
System.Diagnostics.Debug.Assert(result.Length == 8);
ix = int.MinValue;
result = ix.ToString("X");
result = result.PadLeft(8, '0');
System.Diagnostics.Debug.Assert(result.Length == 8);
}

No comments: