public bool runTest() { int iCountErrors = 0; int iCountTestcases = 0; String strLoc="123_er"; Console.Out.Write( s_strClassMethod ); Console.Out.Write( ": " ); Console.Out.Write( s_strTFPath + s_strTFName ); Console.Out.Write( ": " ); Console.Out.Write( s_strDtTmVer ); Console.Out.WriteLine( " runTest started..." ); AIcmp oKey; Guid oValue; Int32 iPrevious; AIcmp[] aArr; Guid[] gArr; Hashtable hshtbl1; AIcmp acmp = new AIcmp(); try { Console.WriteLine(); do { aArr = new AIcmp[10]; gArr = new Guid[10]; hshtbl1 = new Hashtable(16); for(int i=0; i < 10; i++) { aArr[i] = new AIcmp(); gArr[i] = Guid.NewGuid(); hshtbl1.Add(gArr[i], aArr[i]); } Array.Sort(aArr, gArr, acmp); iPrevious = 0; for(int i=0; i < aArr.Length; i++) { oKey = aArr[i]; oValue = gArr[i]; ++iCountTestcases; if ( Convert.ToInt32(oKey.ToString()) < iPrevious ) { ++iCountErrors; Console.WriteLine( s_strTFAbbrev + "Err_634df_" + i + ", oKey.ToString()==" + oKey.ToString()); } iPrevious=Convert.ToInt32(oKey.ToString()); ++iCountTestcases; if ( oKey.Equals(hshtbl1[oValue]) != true ) { ++iCountErrors; Console.WriteLine( s_strTFAbbrev + "Err_364df_" + i + ", oKey.ToString()==" + oKey.ToString() + ", hshtbl1[oValue]==" + hshtbl1[oValue]); } } try { ++iCountTestcases; Array.Sort(gArr, i32Arr, null); ++iCountErrors; Console.WriteLine( s_strTFAbbrev + "Err_984fd!" ); } catch(ArgumentException) { } catch(Exception ex) { ++iCountErrors; Console.Error.WriteLine( "Error E_795gd! , Wrong Exception thrown == " + ex.ToString()); Console.WriteLine(ex.StackTrace); } strLoc = "loc_845fdg"; aArr = new AIcmp[10]; gArr = new Guid[9]; for(int i=0; i < 9; i++) { aArr[i] = new AIcmp(); gArr[i] = Guid.NewGuid(); } aArr[9]=new AIcmp(); strLoc = "loc_086fd"; try { ++iCountTestcases; Array.Sort(aArr, gArr, acmp ); ++iCountErrors; Console.WriteLine( s_strTFAbbrev + "Err_835xr!" ); } catch (ArgumentException) { } catch (Exception ex) { ++iCountErrors; Console.Error.WriteLine( "Error E_972qr! , Wrong Exception thrown == " + ex.ToString()); } aArr = new AIcmp[10]; for(int i=0; i < 10; i++) { aArr[i] = new AIcmp(); } Array.Sort(aArr, null, acmp); iPrevious = 0; ++iCountTestcases; for(int i=0; i < aArr.Length; i++) { oKey = aArr[i]; if ( Convert.ToInt32(oKey.ToString()) < iPrevious ) { ++iCountErrors; Console.WriteLine( s_strTFAbbrev + ", Err_573df_" + i + ", oKey.ToString()==" + oKey.ToString()); } iPrevious=Convert.ToInt32(oKey.ToString()); } try { ++iCountTestcases; Array.Sort(null, gArr, acmp); ++iCountErrors; Console.WriteLine( s_strTFAbbrev + "Err_835xr!" ); } catch (ArgumentException) { } catch (Exception ex) { ++iCountErrors; Console.Error.WriteLine( "Error E_972qr! , Wrong Exception thrown == " + ex.ToString()); } } while ( false ); } catch (Exception exc_general) { ++iCountErrors; Console.WriteLine( s_strTFAbbrev + "Error Err_8888yyy! strLoc=="+ strLoc +" ,exc_general=="+ exc_general ); } if ( iCountErrors == 0 ) { return true; } else { return false;} }
public bool runTest() { int iCountErrors = 0; int iCountTestcases = 0; String strLoc = "123_er"; Console.Out.Write(s_strClassMethod); Console.Out.Write(": "); Console.Out.Write(s_strTFPath + s_strTFName); Console.Out.Write(": "); Console.Out.Write(s_strDtTmVer); Console.Out.WriteLine(" runTest started..."); AIcmp oKey; Guid oValue; Int32 iPrevious; AIcmp[] aArr; Guid[] gArr; Hashtable hshtbl1; AIcmp acmp = new AIcmp(); try { Console.WriteLine(); do { aArr = new AIcmp[10]; gArr = new Guid[10]; hshtbl1 = new Hashtable(16); for (int i = 0; i < 10; i++) { aArr[i] = new AIcmp(); gArr[i] = Guid.NewGuid(); hshtbl1.Add(gArr[i], aArr[i]); } Array.Sort(aArr, gArr, acmp); iPrevious = 0; for (int i = 0; i < aArr.Length; i++) { oKey = aArr[i]; oValue = gArr[i]; ++iCountTestcases; if (Convert.ToInt32(oKey.ToString()) < iPrevious) { ++iCountErrors; Console.WriteLine(s_strTFAbbrev + "Err_634df_" + i + ", oKey.ToString()==" + oKey.ToString()); } iPrevious = Convert.ToInt32(oKey.ToString()); ++iCountTestcases; if (oKey.Equals(hshtbl1[oValue]) != true) { ++iCountErrors; Console.WriteLine(s_strTFAbbrev + "Err_364df_" + i + ", oKey.ToString()==" + oKey.ToString() + ", hshtbl1[oValue]==" + hshtbl1[oValue]); } } try { ++iCountTestcases; Array.Sort(gArr, i32Arr, null); ++iCountErrors; Console.WriteLine(s_strTFAbbrev + "Err_984fd!"); } catch (ArgumentException) { } catch (Exception ex) { ++iCountErrors; Console.Error.WriteLine("Error E_795gd! , Wrong Exception thrown == " + ex.ToString()); Console.WriteLine(ex.StackTrace); } strLoc = "loc_845fdg"; aArr = new AIcmp[10]; gArr = new Guid[9]; for (int i = 0; i < 9; i++) { aArr[i] = new AIcmp(); gArr[i] = Guid.NewGuid(); } aArr[9] = new AIcmp(); strLoc = "loc_086fd"; try { ++iCountTestcases; Array.Sort(aArr, gArr, acmp); ++iCountErrors; Console.WriteLine(s_strTFAbbrev + "Err_835xr!"); } catch (ArgumentException) { } catch (Exception ex) { ++iCountErrors; Console.Error.WriteLine("Error E_972qr! , Wrong Exception thrown == " + ex.ToString()); } aArr = new AIcmp[10]; for (int i = 0; i < 10; i++) { aArr[i] = new AIcmp(); } Array.Sort(aArr, null, acmp); iPrevious = 0; ++iCountTestcases; for (int i = 0; i < aArr.Length; i++) { oKey = aArr[i]; if (Convert.ToInt32(oKey.ToString()) < iPrevious) { ++iCountErrors; Console.WriteLine(s_strTFAbbrev + ", Err_573df_" + i + ", oKey.ToString()==" + oKey.ToString()); } iPrevious = Convert.ToInt32(oKey.ToString()); } try { ++iCountTestcases; Array.Sort(null, gArr, acmp); ++iCountErrors; Console.WriteLine(s_strTFAbbrev + "Err_835xr!"); } catch (ArgumentException) { } catch (Exception ex) { ++iCountErrors; Console.Error.WriteLine("Error E_972qr! , Wrong Exception thrown == " + ex.ToString()); } } while (false); } catch (Exception exc_general) { ++iCountErrors; Console.WriteLine(s_strTFAbbrev + "Error Err_8888yyy! strLoc==" + strLoc + " ,exc_general==" + exc_general); } if (iCountErrors == 0) { return(true); } else { return(false); } }