mirror of https://github.com/mono/CppSharp.git
8 changed files with 66 additions and 28 deletions
@ -0,0 +1,14 @@
@@ -0,0 +1,14 @@
|
||||
using NUnit.Framework; |
||||
using CLITemp; |
||||
|
||||
[TestFixture] |
||||
public class CLITests |
||||
{ |
||||
[Test] |
||||
public void TestTypes() |
||||
{ |
||||
// Attributed types
|
||||
var sum = new Types().AttributedSum(3, 4); |
||||
Assert.That(sum, Is.EqualTo(7)); |
||||
} |
||||
} |
@ -0,0 +1,6 @@
@@ -0,0 +1,6 @@
|
||||
#include "CLITemp.h" |
||||
|
||||
int Types::AttributedSum(int A, int B) |
||||
{ |
||||
return A + B; |
||||
} |
@ -0,0 +1,23 @@
@@ -0,0 +1,23 @@
|
||||
using CppSharp.AST; |
||||
using CppSharp.Generators; |
||||
using CppSharp.Utils; |
||||
|
||||
namespace CppSharp.Tests |
||||
{ |
||||
public class CLITemp : LibraryTest |
||||
{ |
||||
public CLITemp(GeneratorKind kind) |
||||
: base("CLITemp", kind) |
||||
{ |
||||
} |
||||
|
||||
public override void Preprocess(Driver driver, ASTContext lib) |
||||
{ |
||||
} |
||||
|
||||
public static void Main(string[] args) |
||||
{ |
||||
ConsoleDriver.Run(new CLITemp(GeneratorKind.CLI)); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,21 @@
@@ -0,0 +1,21 @@
|
||||
#if defined(_MSC_VER) |
||||
#define DLL_API __declspec(dllexport) |
||||
#else |
||||
#define DLL_API |
||||
#endif |
||||
|
||||
// Tests for C++ types
|
||||
struct DLL_API Types |
||||
{ |
||||
// AttributedType
|
||||
#ifdef __clang__ |
||||
#define ATTR __attribute__((stdcall)) |
||||
#else |
||||
#define ATTR |
||||
#endif |
||||
|
||||
// Note: This fails with C# currently due to mangling bugs.
|
||||
// Move it back once it's fixed upstream.
|
||||
typedef int AttributedFuncType(int, int) ATTR; |
||||
AttributedFuncType AttributedSum; |
||||
}; |
Loading…
Reference in new issue