File: CppCxFormatterMembersTests.cs

package info (click to toggle)
mono 6.12.0.199%2Bdfsg-6
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 1,296,836 kB
  • sloc: cs: 11,181,803; xml: 2,850,076; ansic: 699,709; cpp: 123,344; perl: 59,361; javascript: 30,841; asm: 21,853; makefile: 20,405; sh: 15,009; python: 4,839; pascal: 925; sql: 859; sed: 16; php: 1
file content (157 lines) | stat: -rw-r--r-- 5,722 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
using Mono.Documentation.Updater.Formatters.CppFormatters;
using Mono_DocTest;
using NUnit.Framework;
using Cpp = Mono_DocTest_Generic;

namespace mdoc.Test
{
    [TestFixture]
    [Category("CppCx")]
    public class CppCxFormatterMembersTests : BasicFormatterTests<CppCxFullMemberFormatter>
    {
        protected override CppCxFullMemberFormatter formatter { get; } = new CppCxFullMemberFormatter();

        private const string CppCxTestLibName = "../../../../external/Test/UwpTestWinRtComponentCpp.winmd";
        private const string CSharpTestLib = "../../../../external/Test/CSharpExample.dll";

        [Test]
        [Category("Method")]
        public void Method_ComputeResult()
        {
            TestMethodSignature(CppCxTestLibName, "UwpTestWinRtComponentCpp.Class1", "ComputeResult",
                @"public:
 Windows::Foundation::Collections::IVector<double> ^ ComputeResult(double input);");
        }

        [Test]
        [Category("Method")]
        public void Method_GetPrimesOrdered()
        {
            TestMethodSignature(CppCxTestLibName, "UwpTestWinRtComponentCpp.Class1", "GetPrimesOrdered",
                @"public:
 Windows::Foundation::IAsyncOperationWithProgress<Windows::Foundation::Collections::IVector<int> ^, double> ^ GetPrimesOrdered(int first, int last);");

        }

        [Test]
        [Category("Method")]
        public void Method_GetPrimesUnordered()
        {
            TestMethodSignature(CppCxTestLibName, "UwpTestWinRtComponentCpp.Class1", "GetPrimesUnordered",
                @"public:
 Windows::Foundation::IAsyncActionWithProgress<double> ^ GetPrimesUnordered(int first, int last);");
        }

        [Test]
        [Category("Method")]
        public void Method_WinRtTypeInterfaceImplementation()
        {
            TestMethodSignature(CppCxTestLibName, "Namespace222.App", "SetWindow",
                @"public:
 virtual void SetWindow(Windows::UI::Core::CoreWindow ^ window) = Windows::ApplicationModel::Core::IFrameworkView::SetWindow;");
        }

        [Test]
        [Category("Field")]
        public void Field_CustomAttributeFundamentalType()
        {
           TestFieldSignature(CppCxTestLibName, "UwpTestWinRtComponentCpp.CustomAttribute1", "Field1", "public: bool Field1;");
        }


        [Test]
        [Category("Field")]
        public void Field_CustomAttributуSpecificType()
        {
            TestFieldSignature(CppCxTestLibName, "UwpTestWinRtComponentCpp.CustomAttribute1", "Field2", "public: Windows::Foundation::HResult Field2;");
        }

        [Test]
        [Category("Field")]
        public void Field_EnumField()
        {
            TestFieldSignature(CppCxTestLibName, "UwpTestWinRtComponentCpp.Color1", "Red", "Red");
        }

        [Test]
        [Category("Field")]
        public void Field_ValueType_String()
        {
            TestFieldSignature(CppCxTestLibName, "Namespace2.Class4", "StringField", "public: Platform::String ^ StringField;");
        }

        [Test]
        [Category("Event")]
        public void Event_Class1_primeFoundEvent()
        {
            TestEventSignature(CppCxTestLibName, "UwpTestWinRtComponentCpp.Class1", "primeFoundEvent", @"public:
 event UwpTestWinRtComponentCpp::PrimeFoundHandler ^ primeFoundEvent;");
        }

        [Test]
        [Category("Properties")]
        public void Property_FundamentalType()
        {
            TestPropertySignature(CppCxTestLibName, "Namespace2.Class3", "LongProperty", @"public:
 property long long LongProperty { long long get(); void set(long long value); };");
        }

        [Test]
        [Category("Properties")]
        public void Property_EII_implementation_correctDelimeter()
        {
            TestPropertySignature(CSharpTestLib, "Mono.DocTest.Generic.MyList`2", "System.Collections.Generic.ICollection<A>.IsReadOnly", @"property bool System::Collections::Generic::ICollection<A>::IsReadOnly { bool get(); };");
        }

        [Test]
        [Category("Properties")]
        public void Property_ArrayOfTypeProperty()
        {
            TestPropertySignature(CppCxTestLibName, "Namespace2.Class3", "ArrayOfTypeProperty", @"public:
 property Platform::Array <Platform::Type ^> ^ ArrayOfTypeProperty { Platform::Array <Platform::Type ^> ^ get(); void set(Platform::Array <Platform::Type ^> ^ value); };");
        }

        [Test]
        [Category("Properties")]
        public void Property_ArrayOfTypePropertyProtected()
        {
            TestPropertySignature(CppCxTestLibName, "Namespace2.Class3", "ArrayOfTypePropertyProtected", @"protected:
 property Platform::Array <Platform::Type ^> ^ ArrayOfTypePropertyProtected { Platform::Array <Platform::Type ^> ^ get(); void set(Platform::Array <Platform::Type ^> ^ value); };");
        }

        [Test]
        [Category("NoSupport")]
        public void NoSupport_ParamsKeyword_M6()
        {
            TestMethodSignature(typeof(Widget), null, "M6");
        }

        [Test]
        [Category("NoSupport")]
        public void NoSupport_DefaultParameters()
        {
            TestMethodSignature(CSharpTestLib, "Mono.DocTest.Widget", "Default", null);
        }
        
        [TearDown]
        public void TearDown()
        {
            moduleCash.Clear();
        }
        [Test]
        [Category("NoSupport")]
        public void NoSupport_Exception_NestedClassWithSameName()
        {
            TestTypeSignature(CSharpTestLib, "Mono.DocTest.Widget/NestedClass", null);
        }

        [Test]
        [Category("NoSupport")]
        public void NoSupport_GenericMethodInUwp()
        {
            TestMethodSignature(typeof(Cpp.GenericBase<>), null, "BaseMethod2");
        }
    }

}