Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/api-doc-tools.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Chen <59190910+JeffInChrist@users.noreply.github.com>2021-04-30 22:23:09 +0300
committerGitHub <noreply@github.com>2021-04-30 22:23:09 +0300
commitb9158aa6bc4e958bbd243a0d4fbf109788c90e87 (patch)
tree800fca43c6d78a9915f398feadc74434466a82e1 /mdoc/mdoc.Test
parentd3ce3cadd68a78fbb11efe02afb9c160e07391e4 (diff)
Adding the projection of Numerics types in C++/WinRT, C++/CX and fixed an issue of the cppType logic (#550)
https://dev.azure.com/ceapex/Engineering/_workitems/edit/100023
Diffstat (limited to 'mdoc/mdoc.Test')
-rw-r--r--mdoc/mdoc.Test/CppCxFormatterMembersTests.cs20
-rw-r--r--mdoc/mdoc.Test/CppCxFormatterTypesTests.cs66
-rw-r--r--mdoc/mdoc.Test/CppFullFormatterTests.cs26
-rw-r--r--mdoc/mdoc.Test/CppWinRtFormatterTests.cs66
-rw-r--r--mdoc/mdoc.Test/CppWinRtMembersTests.cs4
5 files changed, 164 insertions, 18 deletions
diff --git a/mdoc/mdoc.Test/CppCxFormatterMembersTests.cs b/mdoc/mdoc.Test/CppCxFormatterMembersTests.cs
index 10b0378f..d9fe24cd 100644
--- a/mdoc/mdoc.Test/CppCxFormatterMembersTests.cs
+++ b/mdoc/mdoc.Test/CppCxFormatterMembersTests.cs
@@ -43,30 +43,22 @@ namespace mdoc.Test
Windows::Foundation::IAsyncActionWithProgress<double> ^ GetPrimesUnordered(int first, int last);");
}
- //[Test]
- //[Category("Method")]
- //public void Method_CreateNewGuid()
- //{
- // TestMethodSignature(CppCxTestLibName, "UwpTestWinRtComponentCpp.Class1", "CreateNewGuid",
- // @"public: Platform::Guid ^ CreateNewGuid();");
- //}
-
[Test]
- public void CreateNewGuid()
+ [Category("Method")]
+ public void Method_CreateNewGuid()
{
var member = GetMethod(typeof(GuidClass), m => m.Name == "CreateNewGuid");
var sig = formatter.GetDeclaration(member);
- Assert.AreEqual(@"public:
- static Platform::Guid CreateNewGuid();", sig);
+ Assert.AreEqual("public:\n static Platform::Guid CreateNewGuid();", sig);
}
[Test]
- public void ObjectIndentical()
+ [Category("Method")]
+ public void Method_ObjectIndentical()
{
var member = GetMethod(typeof(GuidClass), m => m.Name == "ObjectIndentical");
var sig = formatter.GetDeclaration(member);
- Assert.AreEqual(@"public:
- bool ObjectIndentical(Platform::Guid objGuid1, Platform::Guid objGuid2);", sig);
+ Assert.AreEqual("public:\n bool ObjectIndentical(Platform::Guid objGuid1, Platform::Guid objGuid2);", sig);
}
[Test]
diff --git a/mdoc/mdoc.Test/CppCxFormatterTypesTests.cs b/mdoc/mdoc.Test/CppCxFormatterTypesTests.cs
index d8bf6909..2bbd8390 100644
--- a/mdoc/mdoc.Test/CppCxFormatterTypesTests.cs
+++ b/mdoc/mdoc.Test/CppCxFormatterTypesTests.cs
@@ -13,6 +13,7 @@ namespace mdoc.Test
{
protected override CppCxMemberFormatter formatter => new CppCxMemberFormatter();
+ private string _cppWinRtTestLibName = "../../../../external/Windows/Windows.Foundation.UniversalApiContract.winmd";
private string _cppCxTestLibName = "../../../../external/Test/UwpTestWinRtComponentCpp.winmd";
protected override TypeDefinition GetType(Type type)
@@ -85,9 +86,74 @@ namespace mdoc.Test
TestTypeSignature(_cppCxTestLibName, "Namespace2.Class4", "public value class Class4");
}
+ [Test]
+ [Category("Type")]
+ public void TypeSignature_NumericsMatrix3x2()
+ {
+ TestTypeSignature(_cppWinRtTestLibName, "Windows.Foundation.Numerics.Matrix3x2", "public value class float3x2");
+ }
+
+ [Test]
+ [Category("Type")]
+ public void TypeSignature_NumericsMatrix4x4()
+ {
+ TestTypeSignature(_cppWinRtTestLibName, "Windows.Foundation.Numerics.Matrix4x4", "public value class float4x4");
+ }
+
+ [Test]
+ [Category("Type")]
+ public void TypeSignature_NumericsQuaternion()
+ {
+ TestTypeSignature(_cppWinRtTestLibName, "Windows.Foundation.Numerics.Quaternion", "public value class quaternion");
+ }
+
+ [Test]
+ [Category("Type")]
+ public void TypeSignature_NumericsVector2()
+ {
+ TestTypeSignature(_cppWinRtTestLibName, "Windows.Foundation.Numerics.Vector2", "public value class float2");
+ }
+
+ [Test]
+ [Category("Type")]
+ public void TypeSignature_NumericsVector3()
+ {
+ TestTypeSignature(_cppWinRtTestLibName, "Windows.Foundation.Numerics.Vector3", "public value class float3");
+ }
+
+ [Test]
+ [Category("Type")]
+ public void TypeSignature_NumericsVector4()
+ {
+ TestTypeSignature(_cppWinRtTestLibName, "Windows.Foundation.Numerics.Vector4", "public value class float4");
+ }
+
+ [Test]
+ [Category("Type")]
+ public void TypeSignature_ValueGuid()
+ {
+ TestTypeSignature(typeof(Guid),
+ "public value class Platform::Guid : IComparable, IComparable<Platform::Guid>, IEquatable<Platform::Guid>, IFormattable");
+ }
+
+ [Test]
+ [Category("Type")]
+ public void TypeSignature_ValueSingle()
+ {
+ TestTypeSignature(typeof(Single),
+ "public value class float : IComparable, IComparable<float>, IConvertible, IEquatable<float>, IFormattable");
+ }
+
#region NoSupport
[Test]
+ [Category("Type")]
+ public void TypeSignature_NumericsPlane()
+ {
+ TestTypeSignature(_cppWinRtTestLibName, "Windows.Foundation.Numerics.Plane", null);
+ }
+
+ [Test]
[Category("NoSupport")]
public void NoSupport_GenericDelegate()
{
diff --git a/mdoc/mdoc.Test/CppFullFormatterTests.cs b/mdoc/mdoc.Test/CppFullFormatterTests.cs
index 9cd417d8..1ad39d43 100644
--- a/mdoc/mdoc.Test/CppFullFormatterTests.cs
+++ b/mdoc/mdoc.Test/CppFullFormatterTests.cs
@@ -240,7 +240,6 @@ generic <typename T>
typeof(MyList1<,>), @"public:
virtual System::Collections::Generic::IEnumerator<A> ^ GetEnumerator() = System::Collections::Generic::IEnumerable<A>::GetEnumerator;",
nameof(MyList1<int, int>.GetEnumerator));
-
}
[Test]
@@ -250,7 +249,6 @@ generic <typename T>
static Mono_DocTest::Widget ^ operator +(Mono_DocTest::Widget ^ x1, Mono_DocTest::Widget ^ x2);",
"op_Addition");
-
[Test]
[Category("Methods")]
[Category("NoSupport")]
@@ -266,6 +264,30 @@ generic <typename T>
}
[Test]
+ [Category("Type")]
+ public void TypeSignature_Widget()
+ {
+ TestTypeSignature(CSharpTestLib,
+ "Mono.DocTest.DocValueType", "public value class Mono::DocTest::DocValueType : Mono::DocTest::IProcess");
+ }
+
+ [Test]
+ [Category("Type")]
+ public void TypeSignature_Single()
+ {
+ TestTypeSignature(typeof(Single),
+ "public value class float : IComparable, IComparable<float>, IConvertible, IEquatable<float>, IFormattable");
+ }
+
+ [Test]
+ [Category("Type")]
+ public void TypeSignature_Int32()
+ {
+ TestTypeSignature(typeof(Int32),
+ "public value class int : IComparable, IComparable<int>, IConvertible, IEquatable<int>, IFormattable");
+ }
+
+ [Test]
[Category("Methods")]
public void MethodSignature_opExplicit() =>
TestMethodSignature(typeof(Widget), @"public:
diff --git a/mdoc/mdoc.Test/CppWinRtFormatterTests.cs b/mdoc/mdoc.Test/CppWinRtFormatterTests.cs
index c17ebec9..65e6a614 100644
--- a/mdoc/mdoc.Test/CppWinRtFormatterTests.cs
+++ b/mdoc/mdoc.Test/CppWinRtFormatterTests.cs
@@ -13,6 +13,7 @@ namespace mdoc.Test
private static readonly CppWinRtMemberFormatter CppWinRtMemberFormatter = new CppWinRtMemberFormatter();
protected override CppWinRtMemberFormatter formatter => CppWinRtMemberFormatter;
+ private string _cppWinRtTestLibName = "../../../../external/Windows/Windows.Foundation.UniversalApiContract.winmd";
private string _cppCxTestLibName = "../../../../external/Test/UwpTestWinRtComponentCpp.winmd";
private const string CSharpTestLib = "../../../../external/Test/CSharpExample.dll";
@@ -55,6 +56,55 @@ namespace mdoc.Test
[Test]
[Category("Type")]
+ public void TypeSignature_NumericsMatrix3x2()
+ {
+ TestTypeSignature(_cppWinRtTestLibName, "Windows.Foundation.Numerics.Matrix3x2", "struct float3x2");
+ }
+
+ [Test]
+ [Category("Type")]
+ public void TypeSignature_NumericsMatrix4x4()
+ {
+ TestTypeSignature(_cppWinRtTestLibName, "Windows.Foundation.Numerics.Matrix4x4", "struct float4x4");
+ }
+
+ [Test]
+ [Category("Type")]
+ public void TypeSignature_NumericsPlane()
+ {
+ TestTypeSignature(_cppWinRtTestLibName, "Windows.Foundation.Numerics.Plane", "struct plane");
+ }
+
+ [Test]
+ [Category("Type")]
+ public void TypeSignature_NumericsQuaternion()
+ {
+ TestTypeSignature(_cppWinRtTestLibName, "Windows.Foundation.Numerics.Quaternion", "struct quaternion");
+ }
+
+ [Test]
+ [Category("Type")]
+ public void TypeSignature_NumericsVector2()
+ {
+ TestTypeSignature(_cppWinRtTestLibName, "Windows.Foundation.Numerics.Vector2", "struct float2");
+ }
+
+ [Test]
+ [Category("Type")]
+ public void TypeSignature_NumericsVector3()
+ {
+ TestTypeSignature(_cppWinRtTestLibName, "Windows.Foundation.Numerics.Vector3", "struct float3");
+ }
+
+ [Test]
+ [Category("Type")]
+ public void TypeSignature_NumericsVector4()
+ {
+ TestTypeSignature(_cppWinRtTestLibName, "Windows.Foundation.Numerics.Vector4", "struct float4");
+ }
+
+ [Test]
+ [Category("Type")]
public void TypeSignature_GenericInterface()
{
TestTypeSignature(typeof(IFoo<>), @"template <typename T>
@@ -87,6 +137,22 @@ class Widget : Mono_DocTest::IProcess");
}
[Test]
+ [Category("Type")]
+ public void TypeSignature_ValueGuid()
+ {
+ TestTypeSignature(typeof(Guid),
+ "struct winrt::guid : IComparable, IComparable<winrt::guid>, IEquatable<winrt::guid>, IFormattable");
+ }
+
+ [Test]
+ [Category("Type")]
+ public void TypeSignature_ValueSingle()
+ {
+ TestTypeSignature(typeof(Single),
+ "struct float : IComparable, IComparable<float>, IConvertible, IEquatable<float>, IFormattable");
+ }
+
+ [Test]
[Category("NoSupport")]
public void NoSupport_Delegate()
{
diff --git a/mdoc/mdoc.Test/CppWinRtMembersTests.cs b/mdoc/mdoc.Test/CppWinRtMembersTests.cs
index 3a33e69a..918efc32 100644
--- a/mdoc/mdoc.Test/CppWinRtMembersTests.cs
+++ b/mdoc/mdoc.Test/CppWinRtMembersTests.cs
@@ -41,7 +41,7 @@ namespace mdoc.Test
}
[Test]
- public void CreateNewGuid()
+ public void Method_CreateNewGuid()
{
var member = GetMethod(typeof(GuidClass), m => m.Name == "CreateNewGuid");
var sig = formatter.GetDeclaration(member);
@@ -49,7 +49,7 @@ namespace mdoc.Test
}
[Test]
- public void ObjectIndentical()
+ public void Method_ObjectIndentical()
{
var member = GetMethod(typeof(GuidClass), m => m.Name == "ObjectIndentical");
var sig = formatter.GetDeclaration(member);