public virtual bool runTest()
{
Console.WriteLine(s_strTFPath + " " + s_strTFName + " , for " + s_strClassMethod + " , Source ver: " + s_strDtTmVer);
int iCountErrors = 0;
int iCountTestcases = 0;
String strLoc = "Loc_000oo";
ListDictionary ld;
string [] values =
{
"",
" ",
"a",
"aA",
"text",
" SPaces",
"1",
"$%^#",
"2222222222222222222222222",
System.DateTime.Today.ToString(),
Int32.MaxValue.ToString()
};
string [] keys =
{
"zero",
"oNe",
" ",
"",
"aa",
"1",
System.DateTime.Today.ToString(),
"$%^#",
Int32.MaxValue.ToString(),
" spaces",
"2222222222222222222222222"
};
int cnt = 0;
try
{
Console.WriteLine("--- create dictionary ---");
strLoc = "Loc_001_oo";
iCountTestcases++;
ld = new ListDictionary();
cnt = ld.Count;
if ( cnt != 0)
{
iCountErrors++;
Console.WriteLine("Err_0001_, count is {0} instead of {1} after default ctor", ld.Count, 0);
}
Console.WriteLine("1. call Clear() on empty dictionary and check Count");
strLoc = "Loc_001oo";
iCountTestcases++;
ld.Clear();
cnt = ld.Count;
if ( cnt != 0)
{
iCountErrors++;
Console.WriteLine("Err_0001a, count is {0} instead of {1} after Clear()", ld.Count, 0);
}
iCountTestcases++;
cnt = ld.Keys.Count;
if ( cnt != 0)
{
iCountErrors++;
Console.WriteLine("Err_0001b, Keys.Count is {0} instead of {1} after Clear()", cnt, 0);
}
iCountTestcases++;
cnt = ld.Values.Count;
if ( cnt != 0)
{
iCountErrors++;
Console.WriteLine("Err_0001c, Values.Count is {0} instead of {1} after Clear()", cnt, 0);
}
Console.WriteLine("2. add simple strings and get Count");
strLoc = "Loc_002oo";
iCountTestcases++;
cnt = ld.Count;
for (int i = 0; i < values.Length; i++)
{
ld.Add(keys[i], values[i]);
}
if (ld.Count != values.Length)
{
iCountErrors++;
Console.WriteLine("Err_0002a, count is {0} instead of {1}", ld.Count, values.Length);
}
iCountTestcases++;
ld.Clear();
cnt = ld.Count;
if ( cnt != 0)
{
iCountErrors++;
Console.WriteLine("Err_0002b, count is {0} instead of {1} after Clear()", ld.Count, 0);
}
iCountTestcases++;
cnt = ld.Keys.Count;
if ( cnt != 0)
{
iCountErrors++;
Console.WriteLine("Err_0002c, Keys.Count is {0} instead of {1} after Clear()", cnt, 0);
}
iCountTestcases++;
cnt = ld.Values.Count;
if ( cnt != 0)
{
iCountErrors++;
Console.WriteLine("Err_0002d, Values.Count is {0} instead of {1} after Clear()", cnt, 0);
}
}
catch (Exception exc_general )
{
++iCountErrors;
Console.WriteLine (s_strTFAbbrev + " : Error Err_general! strLoc=="+ strLoc +", exc_general==\n"+exc_general.ToString());
}
if ( iCountErrors == 0 )
{
Console.WriteLine( "Pass. "+s_strTFPath +" "+s_strTFName+" ,iCountTestcases=="+iCountTestcases);
return true;
}
else
{
Console.WriteLine("Fail! "+s_strTFPath+" "+s_strTFName+" ,iCountErrors=="+iCountErrors+" , BugNums?: "+s_strActiveBugNums );
return false;
}
}
public static void Main(String[] args)