예제 #1
0
        public void TestLeaked()
        {
            var prev = RunSharpDebug.LeakingDetection;

            // exception in a finalizer may terminate runtime
            // we don't want this
            RunSharpDebug.LeakingDetection = LeakingDetectionMode.StoreAndContinue;
            try
            {
                RunSharpDebug.RetrieveLeaks();
                Assert.IsEmpty(RunSharpDebug.RetrieveLeaks());
                TestingFacade.RunTest(
                    ag =>
                {
                    Assert.IsEmpty(RunSharpDebug.RetrieveLeaks());
                    TypeGen DeclareArraysSample = ag.Class("DecalreArraysSample");
                    {
                        CodeGen g = DeclareArraysSample.Public.Static.Method(typeof(void), "Main");
                        {
                            var asStream = ag.ExpressionFactory.New(typeof(MemoryStream)).Cast(typeof(Stream));
                            asStream.GetType().GetHashCode();
                        }
                    }
                });

                GC.Collect();
                GC.WaitForPendingFinalizers();
                GC.Collect();
                Assert.IsNotEmpty(RunSharpDebug.RetrieveLeaks());
            }
            finally
            {
                RunSharpDebug.LeakingDetection = prev;
            }
        }
예제 #2
0
        public void TestGenTypeAttributeTest()
        {
            TestingFacade.GetTestsForGenerator(GenTypeAttributeTest, @">>> GEN TriAxis.RunSharp.Tests.A2_Attributes.GenTypeAttributeTest
=== RUN TriAxis.RunSharp.Tests.A2_Attributes.GenTypeAttributeTest
<<< END TriAxis.RunSharp.Tests.A2_Attributes.GenTypeAttributeTest

").RunAll();
        }
예제 #3
0
        public void TestGenIndexedProperty()
        {
            TestingFacade.GetTestsForGenerator(GenIndexedProperty, @">>> GEN TriAxis.RunSharp.Tests.09_IndexedProperties.GenIndexedProperty
=== RUN TriAxis.RunSharp.Tests.09_IndexedProperties.GenIndexedProperty
PeneloPe PiPer Picked a Peck of Pickled PePPers. How many Pickled PePPers did PeneloPe PiPer Pick?
<<< END TriAxis.RunSharp.Tests.09_IndexedProperties.GenIndexedProperty

").RunAll();
        }
예제 #4
0
        public void TestGenStruct1()
        {
            TestingFacade.GetTestsForGenerator(GenStruct1, @">>> GEN TriAxis.RunSharp.Tests.07_Structs.GenStruct1
=== RUN TriAxis.RunSharp.Tests.07_Structs.GenStruct1
The stored value is: 5
<<< END TriAxis.RunSharp.Tests.07_Structs.GenStruct1

").RunAll();
        }
예제 #5
0
        public void TestGenStructConversion()
        {
            TestingFacade.GetTestsForGenerator(GenStructConversion, @">>> GEN TriAxis.RunSharp.Tests.10_Conversions.GenStructConversion
=== RUN TriAxis.RunSharp.Tests.10_Conversions.GenStructConversion
10
Conversion not yet implemented
<<< END TriAxis.RunSharp.Tests.10_Conversions.GenStructConversion

").RunAll();
        }
예제 #6
0
        public void TestGenEvents1()
        {
            TestingFacade.GetTestsForGenerator(GenEvents1, @">>> GEN TriAxis.RunSharp.Tests.13_Events.GenEvents1
=== RUN TriAxis.RunSharp.Tests.13_Events.GenEvents1
This is called when the event fires.
This is called when the event fires.
<<< END TriAxis.RunSharp.Tests.13_Events.GenEvents1

").RunAll();
        }
예제 #7
0
        public void TestGenStructImpl()
        {
            TestingFacade.GetTestsForGenerator(GenStructImpl,
                                               @">>> GEN TriAxis.RunSharp.Tests.Bugs.X1864084_ValueTypeVirtual.GenStructImpl
=== RUN TriAxis.RunSharp.Tests.Bugs.X1864084_ValueTypeVirtual.GenStructImpl
Hash code of Test is -1
<<< END TriAxis.RunSharp.Tests.Bugs.X1864084_ValueTypeVirtual.GenStructImpl

").RunAll();
        }
예제 #8
0
        public void TestGenIsNull()
        {
            TestingFacade.GetTestsForGenerator(GenIsNull, @">>> GEN TriAxis.RunSharp.Tests.Bugs.X17_IsNull.GenIsNull
=== RUN TriAxis.RunSharp.Tests.Bugs.X17_IsNull.GenIsNull
a is not null
b is null
<<< END TriAxis.RunSharp.Tests.Bugs.X17_IsNull.GenIsNull

").RunAll();
        }
예제 #9
0
        public void TestGenHello1()
        {
            TestingFacade.GetTestsForGenerator(GenHello1,
                                               @">>> GEN TriAxis.RunSharp.Tests.01_HelloWorld.GenHello1
=== RUN TriAxis.RunSharp.Tests.01_HelloWorld.GenHello1
Hello, World!
<<< END TriAxis.RunSharp.Tests.01_HelloWorld.GenHello1

").RunAll();
        }
예제 #10
0
        public void TestGenStaticCtor()
        {
            TestingFacade.GetTestsForGenerator(GenStaticCtor, @">>> GEN TriAxis.RunSharp.Tests.Bugs.X14_StaticConstructor.GenStaticCtor
=== RUN TriAxis.RunSharp.Tests.Bugs.X14_StaticConstructor.GenStaticCtor
Hello from .cctor!
.cctor works now...
<<< END TriAxis.RunSharp.Tests.Bugs.X14_StaticConstructor.GenStaticCtor

").RunAll();
        }
예제 #11
0
        public void TestGenVersioning()
        {
            TestingFacade.GetTestsForGenerator(GenVersioning, @">>> GEN TriAxis.RunSharp.Tests.05_Versioning.GenVersioning
=== RUN TriAxis.RunSharp.Tests.05_Versioning.GenVersioning
MyDerived-Meth1
MyBase-Meth2
MyBase-Meth3
<<< END TriAxis.RunSharp.Tests.05_Versioning.GenVersioning

").RunAll();
        }
예제 #12
0
        public void TestGenArrays()
        {
            TestingFacade.GetTestsForGenerator(GenArrays, @">>> GEN TriAxis.RunSharp.Tests.03_Arrays.GenArrays
=== RUN TriAxis.RunSharp.Tests.03_Arrays.GenArrays
Length of row 2 is 5
Length of row 3 is 6
Length of row 4 is 7
<<< END TriAxis.RunSharp.Tests.03_Arrays.GenArrays

").RunAll();
        }
예제 #13
0
        public void TestGenOriginalTest()
        {
            TestingFacade.GetTestsForGenerator(
                GenOriginalTest,
                @">>> GEN TriAxis.RunSharp.Tests.Bugs.X1864084_ValueTypeVirtual.GenOriginalTest
=== RUN TriAxis.RunSharp.Tests.Bugs.X1864084_ValueTypeVirtual.GenOriginalTest
Hash code of 3 is 3
<<< END TriAxis.RunSharp.Tests.Bugs.X1864084_ValueTypeVirtual.GenOriginalTest

").RunAll();
        }
        public void TestGenComplex()
        {
            TestingFacade.GetTestsForGenerator(GenComplex, @">>> GEN TriAxis.RunSharp.Tests.11_OperatorOverloading.GenComplex
=== RUN TriAxis.RunSharp.Tests.11_OperatorOverloading.GenComplex
First complex number:  2 + 3i
Second complex number: 3 + 4i
The sum of the two numbers: 5 + 7i
<<< END TriAxis.RunSharp.Tests.11_OperatorOverloading.GenComplex

").RunAll();
        }
예제 #15
0
        public void TestGenPerson()
        {
            TestingFacade.GetTestsForGenerator(GenPerson, @">>> GEN TriAxis.RunSharp.Tests.04_Properties.GenPerson
=== RUN TriAxis.RunSharp.Tests.04_Properties.GenPerson
Simple Properties
Person details - Name = N/A, Age = 0
Person details - Name = Joe, Age = 99
Person details - Name = Joe, Age = 100
<<< END TriAxis.RunSharp.Tests.04_Properties.GenPerson

").RunAll();
        }
예제 #16
0
        public void TestGenShapeTest()
        {
            TestingFacade.GetTestsForGenerator(GenShapeTest, @">>> GEN TriAxis.RunSharp.Tests.04_Properties.GenShapeTest
=== RUN TriAxis.RunSharp.Tests.04_Properties.GenShapeTest
Shapes Collection
Square #1 Area = 25.00
Circle #1 Area = 28.27
Rectangle #1 Area = 20.00
<<< END TriAxis.RunSharp.Tests.04_Properties.GenShapeTest

").RunAll();
        }
        public void TestGenExplicit2()
        {
            TestingFacade.GetTestsForGenerator(GenExplicit2, @">>> GEN TriAxis.RunSharp.Tests.14_ExplicitImplementation.GenExplicit2
=== RUN TriAxis.RunSharp.Tests.14_ExplicitImplementation.GenExplicit2
Length(in): 30
Width (in): 20
Length(cm): 76.2
Width (cm): 50.8
<<< END TriAxis.RunSharp.Tests.14_ExplicitImplementation.GenExplicit2

").RunAll();
        }
예제 #18
0
        public void TestGenBookstore()
        {
            TestingFacade.GetTestsForGenerator(GenBookstore, @">>> GEN TriAxis.RunSharp.Tests.12_Delegates.GenBookstore
=== RUN TriAxis.RunSharp.Tests.12_Delegates.GenBookstore
Paperback Book Titles:
   The C Programming Language
   The Unicode Standard 2.0
   Dogbert's Clues for the Clueless
Average Paperback Book Price: $23.97
<<< END TriAxis.RunSharp.Tests.12_Delegates.GenBookstore

").RunAll();
        }
        public void TestGenDbBool()
        {
            TestingFacade.GetTestsForGenerator(GenDbBool, @">>> GEN TriAxis.RunSharp.Tests.11_OperatorOverloading.GenDbBool
=== RUN TriAxis.RunSharp.Tests.11_OperatorOverloading.GenDbBool
!DBBool.True = DBBool.False
!DBBool.Null = DBBool.Null
DBBool.True & DBBool.Null = DBBool.Null
DBBool.True | DBBool.Null = DBBool.True
b is not definitely true
<<< END TriAxis.RunSharp.Tests.11_OperatorOverloading.GenDbBool

").RunAll();
        }
예제 #20
0
        public void TestGenHello3()
        {
            TestingFacade.GetTestsForGenerator(GenHello3, @">>> GEN TriAxis.RunSharp.Tests.01_HelloWorld.GenHello3
=== RUN TriAxis.RunSharp.Tests.01_HelloWorld.GenHello3
Hello, World!
You entered the following 4 command line arguments:
arg1
arg2
arg3
arg4
<<< END TriAxis.RunSharp.Tests.01_HelloWorld.GenHello3

").RunAll();
        }
예제 #21
0
        public void TestGenTokens2()
        {
            TestingFacade.GetTestsForGenerator(GenTokens2, @">>> GEN TriAxis.RunSharp.Tests.06_CollectionClasses.GenTokens2
=== RUN TriAxis.RunSharp.Tests.06_CollectionClasses.GenTokens2
This
is
a
well
done
program.
<<< END TriAxis.RunSharp.Tests.06_CollectionClasses.GenTokens2

").RunAll();
        }
예제 #22
0
 public void TestNotLeaked()
 {
     TestingFacade.RunTest(
         ag =>
     {
         TypeGen DeclareArraysSample = ag.Class("DecalreArraysSample");
         {
             CodeGen g = DeclareArraysSample.Public.Static.Method(typeof(void), "Main");
             {
                 var asStream = ag.ExpressionFactory.New(typeof(MemoryStream)).Cast(typeof(Stream)).SetNotLeaked();
                 asStream.GetType().GetHashCode();
             }
         }
     });
 }
예제 #23
0
 public void TestLeaked()
 {
     UnhandledExceptionCheck = ex => Assert.That(ex.Count, Is.EqualTo(2));
     TestingFacade.RunTest(
         ag =>
     {
         TypeGen DeclareArraysSample = ag.Class("DecalreArraysSample");
         {
             CodeGen g = DeclareArraysSample.Public.Static.Method(typeof(void), "Main");
             {
                 var asStream = ag.ExpressionFactory.New(typeof(MemoryStream)).Cast(typeof(Stream));
                 asStream.GetType().GetHashCode();
             }
         }
     });
 }
예제 #24
0
        public void TestGenIndexer()
        {
            foreach (var t in TestingFacade.GetTestsForGenerator(
                         GenIndexer,
                         @">>> GEN TriAxis.RunSharp.Tests.08_Indexers.GenIndexer
=== RUN TriAxis.RunSharp.Tests.08_Indexers.GenIndexer
<<< END TriAxis.RunSharp.Tests.08_Indexers.GenIndexer

"))
            {
                File.WriteAllText(@"indexertest.txt", "123456789");
                t();
                string c = File.ReadAllText(@"indexertest.txt");
                Assert.That(c, Is.EqualTo("987654321"));
            }
        }
예제 #25
0
        public void TestGenCompose()
        {
            TestingFacade.GetTestsForGenerator(GenCompose, @">>> GEN TriAxis.RunSharp.Tests.12_Delegates.GenCompose
=== RUN TriAxis.RunSharp.Tests.12_Delegates.GenCompose
Invoking delegate a:
  Hello, A!
Invoking delegate b:
  Goodbye, B!
Invoking delegate c:
  Hello, C!
  Goodbye, C!
Invoking delegate d:
  Goodbye, D!
<<< END TriAxis.RunSharp.Tests.12_Delegates.GenCompose

").RunAll();
        }
예제 #26
0
        public void TestGenBreakContinue()
        {
            TestingFacade.GetTestsForGenerator(GenBreakContinue, @">>> GEN TriAxis.RunSharp.Tests.A1_BreakContinue.GenBreakContinue
=== RUN TriAxis.RunSharp.Tests.A1_BreakContinue.GenBreakContinue
Break test:
1
2
3
4
Continue test:
1
2
3
8
9
10
<<< END TriAxis.RunSharp.Tests.A1_BreakContinue.GenBreakContinue

").RunAll();
        }
예제 #27
0
        public void TestGenCmdLine2()
        {
            TestingFacade.GetTestsForGenerator(GenCmdLine2, @">>> GEN TriAxis.RunSharp.Tests.02_CommandLine.GenCmdLine2
=== RUN TriAxis.RunSharp.Tests.02_CommandLine.GenCmdLine2
0
Number of command line 3 parameters = 4
arg1
arg2
arg3
arg4
Object
5
Number of command line parameters = 4
arg1
arg2
arg3
arg4
<<< END TriAxis.RunSharp.Tests.02_CommandLine.GenCmdLine2

").RunAll();
        }
예제 #28
0
 public void ExecuteIncrementNullable()
 {
     TestingFacade.RunMethodTest(ExecuteIncrementNullable);
 }
예제 #29
0
 public void TestGenStructNotImpl()
 {
     TestingFacade.GetTestsForGenerator(GetStructNotImpl, null).RunAll();
 }
예제 #30
0
 public void ExecuteConditionalInt()
 {
     TestingFacade.RunMethodTest(ExecuteConditionalInt);
 }