mirror of https://github.com/mono/CppSharp.git
6 changed files with 86 additions and 0 deletions
@ -0,0 +1,20 @@
@@ -0,0 +1,20 @@
|
||||
using System.Collections.Generic; |
||||
using System.Linq; |
||||
using NUnit.Framework; |
||||
|
||||
[TestFixture] |
||||
public class STLTests |
||||
{ |
||||
[Test] |
||||
public void TestVectors() |
||||
{ |
||||
var vectors = new STL.TestVectors(); |
||||
|
||||
var sum = vectors.SumIntVector(new List<int> { 1, 2, 3 }); |
||||
Assert.AreEqual(sum, 6); |
||||
|
||||
var list = vectors.GetIntVector(); |
||||
Assert.True(list.SequenceEqual(new List<int> { 2, 3, 4 })); |
||||
} |
||||
} |
||||
|
@ -0,0 +1,20 @@
@@ -0,0 +1,20 @@
|
||||
#include "STL.h" |
||||
|
||||
std::vector<int> TestVectors::GetIntVector() |
||||
{ |
||||
std::vector<int> vec; |
||||
vec.push_back(2); |
||||
vec.push_back(3); |
||||
vec.push_back(4); |
||||
|
||||
return vec; |
||||
} |
||||
|
||||
int TestVectors::SumIntVector(std::vector<int>& vec) |
||||
{ |
||||
int sum = 0; |
||||
for (unsigned I = 0, E = vec.size(); I != E; ++I) |
||||
sum += vec[I]; |
||||
|
||||
return sum; |
||||
} |
@ -0,0 +1,23 @@
@@ -0,0 +1,23 @@
|
||||
using CppSharp.AST; |
||||
using CppSharp.Generators; |
||||
using CppSharp.Utils; |
||||
|
||||
namespace CppSharp.Tests |
||||
{ |
||||
public class STL : LibraryTest |
||||
{ |
||||
public STL(GeneratorKind kind) |
||||
: base("STL", kind) |
||||
{ |
||||
} |
||||
|
||||
public override void Preprocess(Driver driver, ASTContext lib) |
||||
{ |
||||
} |
||||
|
||||
public static void Main(string[] args) |
||||
{ |
||||
ConsoleDriver.Run(new STL(GeneratorKind.CLI)); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,15 @@
@@ -0,0 +1,15 @@
|
||||
#if defined(_MSC_VER) |
||||
#define DLL_API __declspec(dllexport) |
||||
#else |
||||
#define DLL_API |
||||
#endif |
||||
|
||||
#include <vector> |
||||
|
||||
struct DLL_API TestVectors |
||||
{ |
||||
std::vector<int> GetIntVector(); |
||||
int SumIntVector(std::vector<int>& vec); |
||||
|
||||
std::vector<int> IntVector; |
||||
}; |
Loading…
Reference in new issue