Exemplo n.º 1
0
    public static void Main(String[] args)
    {
        AppDomain currentDomain = AppDomain.CurrentDomain;

        currentDomain.UnhandledException += new UnhandledExceptionEventHandler(MyHandler);
        bool bResult            = false;
        Co8788StringBuilder cbA = new Co8788StringBuilder();

        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(s_strTFName + s_strTFPath);
            Console.Error.WriteLine(" ");
            Console.Error.WriteLine("FAiL!  " + s_strTFAbbrev);
            Console.Error.WriteLine(" ");
        }
        if (bResult)
        {
            Environment.ExitCode = 0;
        }
        else
        {
            Environment.ExitCode = 1;
        }
    }
	public static void Main(String[] args)
	{
		AppDomain currentDomain = AppDomain.CurrentDomain;
		currentDomain.UnhandledException += new UnhandledExceptionEventHandler(MyHandler);
		bool bResult = false;
	   Co8788StringBuilder cbA = new Co8788StringBuilder();
	   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(s_strTFName+ s_strTFPath);
	      Console.Error.WriteLine( " " );
	      Console.Error.WriteLine( "FAiL!  "+ s_strTFAbbrev);
	      Console.Error.WriteLine( " " );
	   }
	   if (bResult) Environment.ExitCode = 0; else Environment.ExitCode = 1;
	}
	public virtual bool runTest()
	{
		Console.Error.WriteLine(s_strTFPath + " " + s_strTFName + " , for " + s_strClassMethod );
		int iCountErrors = 0;
		int iCountTestcases = 0;
		String strLoc = "Loc_000oo";
		ThreadStart tdst1;				
		Thread[] thdPool1;
		ThreadStart tdst2;
		Thread[] thdPool2;
		Co8788StringBuilder[] targets;
		String instanceValue;
		try {
			strLoc = "Loc_001";
			iCountTestcases++;
			instanceInt_1 = new StringBuilder();
			thdPool1 = new Thread[numberOfThreads];
			for(int i=0; i<numberOfThreads; i++){
				tdst1 = new ThreadStart(this.WorkOnInstance);
				thdPool1[i] = new Thread(tdst1);
			}

			thdPool2 = new Thread[numberOfThreads];
			for(int i=0; i<numberOfThreads; i++){
				tdst2 = new ThreadStart(this.WorkOnInstance_2);
				thdPool2[i] = new Thread(tdst2);
			}

			for(int i=0; i<numberOfThreads; i++)
				thdPool2[i].Start();
			for(int i=0; i<numberOfThreads; i++)
				thdPool1[i].Start();
			for(int i=0; i<numberOfThreads; i++)
				thdPool1[i].Join();
			for(int i=0; i<numberOfThreads; i++)
				thdPool2[i].Join();

			instanceValue = instanceInt_1.ToString();
			strLoc = "Loc_002";
			iCountTestcases++;
			staticInt_1 = new StringBuilder();
			targets = new Co8788StringBuilder[numberOfThreads];
			for(int i=0; i<numberOfThreads; i++)
				targets[i] = new Co8788StringBuilder();
			thdPool1 = new Thread[numberOfThreads];
			for(int i=0; i<numberOfThreads; i++){
				tdst1 = new ThreadStart(targets[i].WorkOnStatic);
				thdPool1[i] = new Thread(tdst1);
			}
			thdPool2 = new Thread[numberOfThreads];
			for(int i=0; i<numberOfThreads; i++){
				tdst2 = new ThreadStart(targets[i].WorkOnStatic_2);
				thdPool2[i] = new Thread(tdst2);
			}
			for(int i=0; i<numberOfThreads; i++)
				thdPool2[i].Start();
			for(int i=0; i<numberOfThreads; i++)
				thdPool1[i].Start();
			for(int i=0; i<numberOfThreads; i++)
				thdPool1[i].Join();
			for(int i=0; i<numberOfThreads; i++)
				thdPool2[i].Join();
			instanceValue = staticInt_1.ToString();
		} catch (Exception exc_general ) {
		   ++iCountErrors;
		   Console.WriteLine(s_strTFAbbrev +" Error Err_8888yyy!  strLoc=="+ strLoc +", exc_general=="+exc_general);
		}
        if ( iCountErrors == 0 ){
           Console.Error.WriteLine( "paSs.   "+s_strTFPath +" "+s_strTFName+" ,iCountTestcases=="+iCountTestcases);
           return true;
        }
        else{
           Console.Error.WriteLine("FAiL!   "+s_strTFPath+" "+s_strTFName+" ,iCountErrors=="+iCountErrors );
           return false;
        }
    }
Exemplo n.º 4
0
    public virtual bool runTest()
    {
        Console.Error.WriteLine(s_strTFPath + " " + s_strTFName + " , for " + s_strClassMethod);
        int         iCountErrors    = 0;
        int         iCountTestcases = 0;
        String      strLoc          = "Loc_000oo";
        ThreadStart tdst1;

        Thread[]    thdPool1;
        ThreadStart tdst2;

        Thread[] thdPool2;
        Co8788StringBuilder[] targets;
        String instanceValue;

        try {
            strLoc = "Loc_001";
            iCountTestcases++;
            instanceInt_1 = new StringBuilder();
            thdPool1      = new Thread[numberOfThreads];
            for (int i = 0; i < numberOfThreads; i++)
            {
                tdst1       = new ThreadStart(this.WorkOnInstance);
                thdPool1[i] = new Thread(tdst1);
            }

            thdPool2 = new Thread[numberOfThreads];
            for (int i = 0; i < numberOfThreads; i++)
            {
                tdst2       = new ThreadStart(this.WorkOnInstance_2);
                thdPool2[i] = new Thread(tdst2);
            }

            for (int i = 0; i < numberOfThreads; i++)
            {
                thdPool2[i].Start();
            }
            for (int i = 0; i < numberOfThreads; i++)
            {
                thdPool1[i].Start();
            }
            for (int i = 0; i < numberOfThreads; i++)
            {
                thdPool1[i].Join();
            }
            for (int i = 0; i < numberOfThreads; i++)
            {
                thdPool2[i].Join();
            }

            instanceValue = instanceInt_1.ToString();
            strLoc        = "Loc_002";
            iCountTestcases++;
            staticInt_1 = new StringBuilder();
            targets     = new Co8788StringBuilder[numberOfThreads];
            for (int i = 0; i < numberOfThreads; i++)
            {
                targets[i] = new Co8788StringBuilder();
            }
            thdPool1 = new Thread[numberOfThreads];
            for (int i = 0; i < numberOfThreads; i++)
            {
                tdst1       = new ThreadStart(targets[i].WorkOnStatic);
                thdPool1[i] = new Thread(tdst1);
            }
            thdPool2 = new Thread[numberOfThreads];
            for (int i = 0; i < numberOfThreads; i++)
            {
                tdst2       = new ThreadStart(targets[i].WorkOnStatic_2);
                thdPool2[i] = new Thread(tdst2);
            }
            for (int i = 0; i < numberOfThreads; i++)
            {
                thdPool2[i].Start();
            }
            for (int i = 0; i < numberOfThreads; i++)
            {
                thdPool1[i].Start();
            }
            for (int i = 0; i < numberOfThreads; i++)
            {
                thdPool1[i].Join();
            }
            for (int i = 0; i < numberOfThreads; i++)
            {
                thdPool2[i].Join();
            }
            instanceValue = staticInt_1.ToString();
        } catch (Exception exc_general) {
            ++iCountErrors;
            Console.WriteLine(s_strTFAbbrev + " Error Err_8888yyy!  strLoc==" + strLoc + ", exc_general==" + exc_general);
        }
        if (iCountErrors == 0)
        {
            Console.Error.WriteLine("paSs.   " + s_strTFPath + " " + s_strTFName + " ,iCountTestcases==" + iCountTestcases);
            return(true);
        }
        else
        {
            Console.Error.WriteLine("FAiL!   " + s_strTFPath + " " + s_strTFName + " ,iCountErrors==" + iCountErrors);
            return(false);
        }
    }