Tests.ManglingTests.TestCompression C# (CSharp) Method

TestCompression() private method

private TestCompression ( ) : void
return void
        public void TestCompression()
        {
            float f1 = 0.0f, f2 = 0.0f;
            int i1 = 0, i2 = 0;
            double d1 = 0.0d, d2 = 0.0d;
            Compression.Test1 (null, "foo", null, "bar");

            var r1 = Compression.Test2(null, ref f1, ref i1, null, ref f2, ref i2, ref d1, ref d2, 5);
            Assert.AreEqual (5, r1, "#2");

            // Disable the following 2 tests because they do not work
            // Test3 and Test4 use delegate in their parameters which is not supported
            // by the mangle name generator hence cannot read these functions in the c++ library.
            /*
            var comp = new Compression();

            comp.number = 25;
            var ran = false;

               comp.Test4 ((c, i, s) =>
                                   {
                                       ran = true;
                                       Assert.IsNotNull(c, "Compression.Test3.c1");
                                       Assert.AreEqual(comp, c, "Compression.Test3.c2");
                                       Assert.AreEqual (25, c.number, "Compression.Test3.c3");
                                       Assert.AreEqual (3, i, "Compression.Test3.i");
                                       Assert.AreEqual ("bar", s, "Compression.Test3.i");
                                   }, 3, "bar");

            Compression.Test3 ((c, i, s) =>
                                   {
                                       ran = true;
                                       Assert.IsNotNull(c, "Compression.Test3.c1");
                                       Assert.AreEqual(comp, c, "Compression.Test3.c2");
                                       Assert.AreEqual (25, c.number, "Compression.Test3.c3");
                                       Assert.AreEqual (3, i, "Compression.Test3.i");
                                       Assert.AreEqual ("bar", s, "Compression.Test3.i");
                                   }, comp, 3, "bar");

            Assert.IsTrue(ran);

            */
        }

Usage Example

Esempio n. 1
0
        static void Main(string[] args)
        {
            var fieldTest = new FieldTests();
            fieldTest.TestReadCppObject();

            var inheritTest = new InheritanceTests();
            inheritTest.TestManagedOverride1();
            inheritTest.TestManagedOverride2();

            inheritTest.TestMultipleBases();
            inheritTest.TestMultipleVirtualBases();
            inheritTest.TestNonVirtualCallOnVirtualBaseClass();
            inheritTest.TestRoundtripManagedOverride();
            inheritTest.TestVirtualCall();
            inheritTest.TestVirtualCallOnBaseClass();
            inheritTest.TestVirtualCallOnVirtualBaseClass();

            var marshalingTest = new MarshalingTests();
            marshalingTest.TestByRefReturn();
            marshalingTest.TestClassArg();
            marshalingTest.TestClassArgByval();

            marshalingTest.TestClassArgByvalNull();

            marshalingTest.TestClassArgNull();
            marshalingTest.TestClassReturn();
            marshalingTest.TestPrimitiveReturn();

            var templateTest = new TemplateTests();
            templateTest.TestDoubleTemplate();
            templateTest.TestFloatTemplate();
            templateTest.TestIntTemplate();
            templateTest.TestShortTemplate();

            var tests = new ManglingTests();
            tests.TestCompression();
            tests.TestNamespace();
            tests.TestNamespace2();
            tests.TestNamespace3();
            tests.TestNamespace4();
            tests.TestNamespaced2();
        }