Browse Source

Changed attributed types test to be CLI-only for now since Clang currently fails with some mangling bugs.

pull/131/head
triton 12 years ago
parent
commit
6bf0ae980c
  1. 8
      tests/Basic/Basic.Tests.cs
  2. 6
      tests/Basic/Basic.cpp
  3. 14
      tests/Basic/Basic.h
  4. 14
      tests/CLITemp/CLITemp.Tests.cs
  5. 6
      tests/CLITemp/CLITemp.cpp
  6. 23
      tests/CLITemp/CLITemp.cs
  7. 21
      tests/CLITemp/CLITemp.h
  8. 2
      tests/CLITemp/premake4.lua

8
tests/Basic/Basic.Tests.cs

@ -141,13 +141,5 @@ public class BasicTests @@ -141,13 +141,5 @@ public class BasicTests
Assert.AreEqual(300, new Bar2.Nested());
Assert.AreEqual(500, new Bar2());
}
[Test]
public void TestTypes()
{
// Attributed types
var sum = Types.AttributedSum(3, 4);
Assert.That(sum, Is.EqualTo(7));
}
}

6
tests/Basic/Basic.cpp

@ -208,9 +208,3 @@ int test(basic& s) @@ -208,9 +208,3 @@ int test(basic& s)
{
return 5;
}
int Types::AttributedSum(int A, int B)
{
return A + B;
}

14
tests/Basic/Basic.h

@ -186,17 +186,3 @@ class DLL_API basic @@ -186,17 +186,3 @@ class DLL_API basic
DLL_API int test(basic& s);
// Tests for C++ types
struct DLL_API Types
{
// AttributedType
#ifdef __clang__
#define ATTR __attribute__((stdcall))
#else
#define ATTR
#endif
typedef int AttributedFuncType(int, int) ATTR;
static AttributedFuncType AttributedSum;
};

14
tests/CLITemp/CLITemp.Tests.cs

@ -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));
}
}

6
tests/CLITemp/CLITemp.cpp

@ -0,0 +1,6 @@ @@ -0,0 +1,6 @@
#include "CLITemp.h"
int Types::AttributedSum(int A, int B)
{
return A + B;
}

23
tests/CLITemp/CLITemp.cs

@ -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));
}
}
}

21
tests/CLITemp/CLITemp.h

@ -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;
};

2
tests/CLITemp/premake4.lua

@ -0,0 +1,2 @@ @@ -0,0 +1,2 @@
group "Tests/CLITemp"
SetupTestCLI("CLITemp")
Loading…
Cancel
Save