dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dotgnu-pnet-commits] CVS: pnet/csunit NUnitEmulation.cs,NONE,1.1 Makefi


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnet/csunit NUnitEmulation.cs,NONE,1.1 Makefile.am,1.1,1.2 Makefile.in,1.1,1.2 TestCase.cs,1.1,1.2
Date: Tue, 19 Nov 2002 23:43:33 -0500

Update of /cvsroot/dotgnu-pnet/pnet/csunit
In directory subversions:/tmp/cvs-serv22548/csunit

Modified Files:
        Makefile.am Makefile.in TestCase.cs 
Added Files:
        NUnitEmulation.cs 
Log Message:


Emulate some of the NUnit test API within csunit so that is is easier to
integrate foreign NUnit tests into pnetlib.


--- NEW FILE ---
/*
 * NUnitEmulation.cs - Emulate enough of the NUnit test interface to
 *                     be able to run tests from the Mono class library.
 *
 * Copyright (C) 2002  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace NUnit.Framework
{

using System;

public class TestResult : CSUnit.TestResult
{
        // Constructors.
        public TestResult() : base() {}

}; // class TestResult

public interface ITest : CSUnit.Test
{
}; // interface ITest

public abstract class TestCase : CSUnit.TestCase, ITest
{

        // Constructors.
        public TestCase() : this(String.Empty) {}
        public TestCase(String name) : base(name) {}

        // Create an NUnit-style result object.
        public override CSUnit.TestResult CreateResult()
                        {
                                return new TestResult();
                        }

        // Set up for the test.
        protected virtual void SetUp() {}
        protected override void Setup()
                        {
                                SetUp();
                        }

        // Tear down after the test.
        protected virtual void TearDown() {}
        protected override void Cleanup()
                        {
                                TearDown();
                        }

        // Convert this object into a string.
        public override String ToString()
                        {
                                return Name;
                        }

}; // class TestCase

public class TestSuite : CSUnit.TestSuite
{
        // Constructors.
        public TestSuite() : base(String.Empty) {}
        public TestSuite(String name) : base(name) {}
        public TestSuite(Type type, bool suppressWarnings)
                        : base(type.Name, type) {}
        public TestSuite(Type type) : base(type.Name, type) {}

        // Add a test to this suite.
        public void AddTest(ITest test)
                        {
                                base.AddTest(test);
                        }

        // Add another test suite to this one.
        public void AddTestSuite(Type type)
                        {
                                AddTest(new TestSuite(type));
                        }

}; // class TestSuite

}; // namespace NUnit.Framework

Index: Makefile.am
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/csunit/Makefile.am,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** Makefile.am 22 Jul 2002 11:44:51 -0000      1.1
--- Makefile.am 20 Nov 2002 04:43:31 -0000      1.2
***************
*** 11,15 ****
                       $(srcdir)/TestStop.cs \
                       $(srcdir)/TestSuite.cs \
!                      $(srcdir)/TestWriterResult.cs
  
  csunit_CSSRC = $(srcdir)/TestMain.cs \
--- 11,16 ----
                       $(srcdir)/TestStop.cs \
                       $(srcdir)/TestSuite.cs \
!                      $(srcdir)/TestWriterResult.cs \
!                      $(srcdir)/NUnitEmulation.cs
  
  csunit_CSSRC = $(srcdir)/TestMain.cs \

Index: Makefile.in
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/csunit/Makefile.in,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** Makefile.in 22 Jul 2002 11:44:51 -0000      1.1
--- Makefile.in 20 Nov 2002 04:43:31 -0000      1.2
***************
*** 86,90 ****
  noinst_DATA = cstest.dll csunit.exe
  
! cstest_CSSRC = $(srcdir)/Test.cs                     $(srcdir)/TestArray.cs   
               $(srcdir)/TestAssertFailed.cs                   
$(srcdir)/TestCase.cs                   $(srcdir)/TestException.cs              
        $(srcdir)/TestFailure.cs                        $(srcdir)/TestResult.cs 
                $(srcdir)/TestStop.cs                   $(srcdir)/TestSuite.cs  
                $(srcdir)/TestWriterResult.cs
  
  
--- 86,90 ----
  noinst_DATA = cstest.dll csunit.exe
  
! cstest_CSSRC = $(srcdir)/Test.cs                     $(srcdir)/TestArray.cs   
               $(srcdir)/TestAssertFailed.cs                   
$(srcdir)/TestCase.cs                   $(srcdir)/TestException.cs              
        $(srcdir)/TestFailure.cs                        $(srcdir)/TestResult.cs 
                $(srcdir)/TestStop.cs                   $(srcdir)/TestSuite.cs  
                $(srcdir)/TestWriterResult.cs                   
$(srcdir)/NUnitEmulation.cs
  
  

Index: TestCase.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/csunit/TestCase.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** TestCase.cs 22 Jul 2002 11:44:51 -0000      1.1
--- TestCase.cs 20 Nov 2002 04:43:31 -0000      1.2
***************
*** 2,6 ****
   * TestCase.cs - Implementation of the "CSUnit.TestCase" class.
   *
!  * Copyright (C) 2001  Southern Storm Software, Pty Ltd.
   *
   * This program is free software; you can redistribute it and/or modify
--- 2,6 ----
   * TestCase.cs - Implementation of the "CSUnit.TestCase" class.
   *
!  * Copyright (C) 2001, 2002  Southern Storm Software, Pty Ltd.
   *
   * This program is free software; you can redistribute it and/or modify
***************
*** 214,217 ****
--- 214,222 ----
                                AssertEquals(null, expected, actual, delta);
                        }
+       public static void AssertEquals(float expected, float actual,
+                                                                   float delta)
+                       {
+                               AssertEquals(null, expected, actual, delta);
+                       }
        public static void AssertEquals(String expected, String actual)
                        {
***************
*** 223,227 ****
        public static void AssertEquals(Object expected, Object actual)
                        {
!                               if(!expected.Equals(actual))
                                {
                                        EqFail(null, expected, actual);
--- 228,240 ----
        public static void AssertEquals(Object expected, Object actual)
                        {
!                               if(expected == null && actual == null)
!                               {
!                                       return;
!                               }
!                               else if(expected != null && 
expected.Equals(actual))
!                               {
!                                       return;
!                               }
!                               else
                                {
                                        EqFail(null, expected, actual);
***************
*** 252,255 ****
--- 265,276 ----
                                }
                        }
+       public static void AssertEquals(String msg, float expected,
+                                                                       float 
actual, float delta)
+                       {
+                               if(Math.Abs(expected - actual) > delta)
+                               {
+                                       EqFail(msg, expected, actual);
+                               }
+                       }
        public static void AssertEquals(String msg, String expected, String 
actual)
                        {
***************
*** 261,265 ****
        public static void AssertEquals(String msg, Object expected, Object 
actual)
                        {
!                               if(!expected.Equals(actual))
                                {
                                        EqFail(msg, expected, actual);
--- 282,294 ----
        public static void AssertEquals(String msg, Object expected, Object 
actual)
                        {
!                               if(expected == null && actual == null)
!                               {
!                                       return;
!                               }
!                               else if(expected != null && 
expected.Equals(actual))
!                               {
!                                       return;
!                               }
!                               else
                                {
                                        EqFail(msg, expected, actual);





reply via email to

[Prev in Thread] Current Thread [Next in Thread]