mirror of
https://github.com/SSCLI/sscli_20021101
synced 2026-06-08 12:28:57 +00:00
9fa3874800
Moved the original file to the archive subfolder.
105 lines
3.6 KiB
C#
105 lines
3.6 KiB
C#
// ==++==
|
|
//
|
|
//
|
|
// Copyright (c) 2002 Microsoft Corporation. All rights reserved.
|
|
//
|
|
// The use and distribution terms for this software are contained in the file
|
|
// named license.txt, which can be found in the root of this distribution.
|
|
// By using this software in any fashion, you are agreeing to be bound by the
|
|
// terms of this license.
|
|
//
|
|
// You must not remove this notice, or any other, from this software.
|
|
//
|
|
//
|
|
// ==--==
|
|
using System;
|
|
using System.Threading;
|
|
using System.IO;
|
|
using System.Collections;
|
|
public class Co3955ToArray
|
|
{
|
|
public static String s_strActiveBugNums = "";
|
|
public static String s_strDtTmVer = "";
|
|
public static String s_strClassMethod = "Stack.ToArray()";
|
|
public static String s_strTFName = "Co3955ToArray.cs";
|
|
public static String s_strTFAbbrev = s_strTFName.Substring(0, 6);
|
|
public static String s_strTFPath = Environment.CurrentDirectory;
|
|
public 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";
|
|
Stack stk1;
|
|
Object[] oArr;
|
|
Int32 iNumberOfElements;
|
|
String strValue;
|
|
try
|
|
{
|
|
do
|
|
{
|
|
stk1 = new Stack();
|
|
oArr = stk1.ToArray();
|
|
iCountTestcases++;
|
|
if(oArr.Length!=0)
|
|
{
|
|
iCountErrors++;
|
|
Console.WriteLine("Err_752dsg! Expected value not returned, " + oArr.Length);
|
|
}
|
|
iNumberOfElements = 10;
|
|
for(int i=0; i<iNumberOfElements; i++)
|
|
stk1.Push(i);
|
|
oArr = stk1.ToArray();
|
|
Array.Sort(oArr);
|
|
iCountTestcases++;
|
|
for(int i=0; i<oArr.Length;i++)
|
|
{
|
|
strValue = "Value_" + i;
|
|
if((Int32)oArr[i] != i)
|
|
{
|
|
iCountErrors++;
|
|
Console.WriteLine("Err_7423fg! Expected value not returned, " + (Int32)oArr[i]);
|
|
}
|
|
}
|
|
} while (false);
|
|
}
|
|
catch (Exception exc_general )
|
|
{
|
|
++iCountErrors;
|
|
Console.WriteLine (s_strTFAbbrev + " : Error Err_8888yyy! 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)
|
|
{
|
|
bool bResult = false;
|
|
Co3955ToArray cbA = new Co3955ToArray();
|
|
try
|
|
{
|
|
bResult = cbA.runTest();
|
|
}
|
|
catch (Exception exc_main)
|
|
{
|
|
bResult = false;
|
|
Console.WriteLine(s_strTFAbbrev + " : FAiL! Error Err_9999zzz! Uncaught Exception in main(), exc_main=="+exc_main);
|
|
}
|
|
if (!bResult)
|
|
{
|
|
Console.WriteLine ("Path: "+s_strTFName + s_strTFPath);
|
|
Console.WriteLine( " " );
|
|
Console.WriteLine( "FAiL! "+ s_strTFAbbrev);
|
|
Console.WriteLine( " " );
|
|
}
|
|
if (bResult) Environment.ExitCode=0; else Environment.ExitCode=1;
|
|
}
|
|
}
|