Created
May 4, 2014 17:14
-
-
Save tritao/65b76f409f5ba580f282 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 643e7935a806b2fc59c3908ebb49f61972ab0ba0 Mon Sep 17 00:00:00 2001 | |
From: triton <ripzonetriton@gmail.com> | |
Date: Sun, 4 May 2014 18:13:54 +0100 | |
Subject: [PATCH 2/2] Added stdcall delegate tests. | |
--- | |
tests/Basic/Basic.Tests.cs | 5 ++++- | |
tests/Basic/Basic.h | 3 +++ | |
tests/Tests.h | 2 ++ | |
3 files changed, 9 insertions(+), 1 deletion(-) | |
diff --git a/tests/Basic/Basic.Tests.cs b/tests/Basic/Basic.Tests.cs | |
index fe3a5d6..ea182d2 100644 | |
--- a/tests/Basic/Basic.Tests.cs | |
+++ b/tests/Basic/Basic.Tests.cs | |
@@ -175,7 +175,10 @@ public class BasicTests : GeneratorTestFixture | |
{ | |
var delegates = new TestDelegates(); | |
var doubleSum = delegates.A(2) + delegates.B(2); | |
- Assert.AreEqual(8, doubleSum); | |
+ Assert.AreEqual(8, doubleSum); | |
+ | |
+ var stdcall = delegates.StdCall(i => i); | |
+ Assert.AreEqual(1, stdcall); | |
} | |
[Test] | |
diff --git a/tests/Basic/Basic.h b/tests/Basic/Basic.h | |
index 4336dca..28a6ef8 100644 | |
--- a/tests/Basic/Basic.h | |
+++ b/tests/Basic/Basic.h | |
@@ -242,6 +242,7 @@ DLL_API int operator==(const Foo2& a, const Foo2& b) | |
// Tests delegates | |
typedef int (*DelegateInGlobalNamespace)(int); | |
+typedef int (STDCALL *DelegateStdCall)(int); | |
struct DLL_API TestDelegates | |
{ | |
@@ -252,6 +253,8 @@ struct DLL_API TestDelegates | |
static int Double(int N) { return N * 2; } | |
int Triple(int N) { return N * 3; } | |
+ int StdCall(DelegateStdCall del) { return del(1); } | |
+ | |
DelegateInClass A; | |
DelegateInGlobalNamespace B; | |
// As long as we can't marshal them make sure they're ignored | |
diff --git a/tests/Tests.h b/tests/Tests.h | |
index 28a11b7..d609c72 100644 | |
--- a/tests/Tests.h | |
+++ b/tests/Tests.h | |
@@ -2,8 +2,10 @@ | |
#if defined(_MSC_VER) | |
#define DLL_API __declspec(dllexport) | |
+#define STDCALL __stdcall | |
#else | |
#define DLL_API __attribute__ ((visibility ("default"))) | |
+#define STDCALL __attribute__((stdcall)) | |
#endif | |
#define CS_OUT | |
\ No newline at end of file | |
-- | |
1.8.3.msysgit.0 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment