Browse Source

Added a new test project for Unicode strings.

Signed-off-by: Dimitar Dobrev <dpldobrev@yahoo.com>
pull/60/head
Dimitar Dobrev 12 years ago
parent
commit
422b0769ba
  1. 2
      tests/Basic/Basic.Tests.cs
  2. 2
      tests/Basic/Basic.h
  3. 15
      tests/UTF16/UTF16.Tests.cs
  4. 1
      tests/UTF16/UTF16.cpp
  5. 33
      tests/UTF16/UTF16.cs
  6. 13
      tests/UTF16/UTF16.h
  7. 2
      tests/UTF16/premake4.lua

2
tests/Basic/Basic.Tests.cs

@ -105,7 +105,7 @@ public class BasicTests @@ -105,7 +105,7 @@ public class BasicTests
}
[Test]
public void TestUnicode()
public void TestANSI()
{
Foo foo = new Foo();
Assert.That(foo.GetANSI(), Is.EqualTo("ANSI"));

2
tests/Basic/Basic.h

@ -12,8 +12,6 @@ public: @@ -12,8 +12,6 @@ public:
int A;
float B;
const char* Unicode;
const char* GetANSI();
};

15
tests/UTF16/UTF16.Tests.cs

@ -0,0 +1,15 @@ @@ -0,0 +1,15 @@
using NUnit.Framework;
using UTF16;
[TestFixture]
public class UTF16Tests
{
[Test]
public void TestFoo()
{
var foo = new Foo();
const string georgia = "საქართველო";
foo.Unicode = georgia;
Assert.That(foo.Unicode, Is.EqualTo(georgia));
}
}

1
tests/UTF16/UTF16.cpp

@ -0,0 +1 @@ @@ -0,0 +1 @@
#include "UTF16.h"

33
tests/UTF16/UTF16.cs

@ -0,0 +1,33 @@ @@ -0,0 +1,33 @@
using System.Text;
using CppSharp.AST;
using CppSharp.Generators;
using CppSharp.Utils;
namespace CppSharp.Tests
{
public class UTF16Tests : LibraryTest
{
public UTF16Tests(LanguageGeneratorKind kind)
: base("UTF16", kind)
{
}
public override void SetupPasses(Driver driver)
{
driver.Options.Encoding = Encoding.Unicode;
}
public override void Preprocess(Driver driver, Library lib)
{
}
static class Program
{
public static void Main(string[] args)
{
ConsoleDriver.Run(new UTF16Tests(LanguageGeneratorKind.CSharp));
}
}
}
}

13
tests/UTF16/UTF16.h

@ -0,0 +1,13 @@ @@ -0,0 +1,13 @@
#if defined(_MSC_VER)
#define DLL_API __declspec(dllexport)
#else
#define DLL_API
#endif
class DLL_API Foo
{
public:
const char* Unicode;
};
DLL_API int FooCallFoo(Foo* foo);

2
tests/UTF16/premake4.lua

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