diff options
author | katsiaryna_bialiatka <katsiaryna_bialiatka@epam.com> | 2017-12-22 19:15:31 +0300 |
---|---|---|
committer | Joel Martinez <joelmartinez@gmail.com> | 2018-01-12 01:11:42 +0300 |
commit | 6533035ec31f38543532568bc499aba2a98e1788 (patch) | |
tree | c9e7e3bdefd3299bfbf28dd5bd6b5bcc43fd988f /mdoc/mdoc.Test/CppWinRtMembersTests.cs | |
parent | 8ff2931c4e40e1c3687e8efa6fb4e8078b3a3c4b (diff) |
[mdoc] Support for C++ signatures
Closes #132
Diffstat (limited to 'mdoc/mdoc.Test/CppWinRtMembersTests.cs')
-rw-r--r-- | mdoc/mdoc.Test/CppWinRtMembersTests.cs | 134 |
1 files changed, 134 insertions, 0 deletions
diff --git a/mdoc/mdoc.Test/CppWinRtMembersTests.cs b/mdoc/mdoc.Test/CppWinRtMembersTests.cs new file mode 100644 index 00000000..c5acfd26 --- /dev/null +++ b/mdoc/mdoc.Test/CppWinRtMembersTests.cs @@ -0,0 +1,134 @@ +using Mono.Documentation.Updater.CppFormatters; +using Mono_DocTest; +using NUnit.Framework; +using Cpp = Mono_DocTest_Generic; + +namespace mdoc.Test +{ + [TestFixture] + public class CppWinRtMembersTests: BasicFormatterTests<CppWinRtFullMemberFormatter> + { + private static readonly CppWinRtFullMemberFormatter CppWinRtFullMemberFormatter = new CppWinRtFullMemberFormatter(); + protected override CppWinRtFullMemberFormatter formatter => CppWinRtFullMemberFormatter; + + private 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", + @"winrt::Windows::Foundation::Collections::IVector<double> ComputeResult(double input);"); + } + + [Test] + [Category("Method")] + public void Method_GetPrimesOrdered() + { + TestMethodSignature(CppCxTestLibName, "UwpTestWinRtComponentCpp.Class1", "GetPrimesOrdered", + @"winrt::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", + @"winrt::Windows::Foundation::IAsyncActionWithProgress<double> GetPrimesUnordered(int first, int last);"); + } + + [Test] + [Category("Method")] + public void Method_DefaultParameters() + { + TestMethodSignature(CSharpTestLib, "Mono.DocTest.Widget", "Default", + @"void Default(int a = 1, int b = 2);"); + } + + [Test] + [Category("Method")] + public void Method_RefType() + { + TestMethodSignature(CppCxTestLibName, "Namespace222.App", "SetWindow1", + @"void SetWindow1(winrt::Windows::UI::Core::CoreWindow const & window);"); + } + + [Test] + [Category("Method")] + public void Method_WinRtTypeInterfaceImplementation() + { + TestMethodSignature(CppCxTestLibName, "Namespace222.App", "SetWindow", + @"void SetWindow(winrt::Windows::UI::Core::CoreWindow const & window);"); + } + + [Test] + [Category("Fields")] + public void FieldSignature_ConstLong() => + TestFieldSignature(typeof(Cpp.GenericBase<>), + "const long ConstLong;", + nameof(Cpp.GenericBase<int>.ConstLong)); + + [Test] + [Category("Fields")] + public void FieldSignature_ConstChar() => + TestFieldSignature(typeof(Cpp.GenericBase<>), + "const char ConstChar;", + nameof(Cpp.GenericBase<int>.ConstChar)); + + + + #region NoSupport + [Test] + [Category("NoSupport")] + public void NoSupport_Property() + { + TestPropertySignature(CppCxTestLibName, "Namespace2.Class3", "LongProperty", null); + } + + [Test] + [Category("NoSupport")] + public void NoSupport_Event() + { + TestEventSignature(CppCxTestLibName, "UwpTestWinRtComponentCpp.Class1", "primeFoundEvent", null); + } + + [Test] + [Category("NoSupport")] + public void NoSupport_ExtensionMethod() + { + TestMethodSignature(typeof(Cpp.Extensions), null, nameof(Cpp.Extensions.Bar)); + } + + [Test] + [Category("NoSupport")] + public void NoSupport_SystemTypes() + { + TestMethodSignature(typeof(Cpp.Extensions), null, nameof(Cpp.Extensions.Bar)); + } + + + [Test] + [Category("NoSupport")] + public void MethodSignature_ParamsKeyword_M6() + { + TestMethodSignature(typeof(Widget), null, "M6"); + } + + [Test] + [Category("NoSupport")] + public void NoSupport_StandardType() + { + TestMethodSignature(typeof(UseLists), null, nameof(UseLists.Process)); + } + + [Test] + [Category("Fields")] + public void NoSupport_Decimal() => + TestFieldSignature(typeof(Cpp.GenericBase<>), + null, + nameof(Cpp.GenericBase<int>.ConstDecimal)); +#endregion + } +} |