Browse Source

Added a test for indexers ([] operators).

Signed-off-by: Dimitar Dobrev <dpldobrev@yahoo.com>
pull/61/head
Dimitar Dobrev 12 years ago
parent
commit
6cb37ef382
  1. 9
      tests/UTF16/UTF16.Tests.cs
  2. 13
      tests/UTF16/UTF16.cpp
  3. 4
      tests/UTF16/UTF16.h

9
tests/UTF16/UTF16.Tests.cs

@ -1,5 +1,6 @@ @@ -1,5 +1,6 @@
using NUnit.Framework;
using UTF16;
using System;
using NUnit.Framework;
using Foo = UTF16.Foo;
[TestFixture]
public class UTF16Tests
@ -11,5 +12,9 @@ public class UTF16Tests @@ -11,5 +12,9 @@ public class UTF16Tests
const string georgia = "საქართველო";
foo.Unicode = georgia;
Assert.That(foo.Unicode, Is.EqualTo(georgia));
// TODO: move this, it has nothing to do with Unicode, it's here only not to break the CLI branch
Assert.That(foo[0], Is.EqualTo(5));
Assert.That(foo.OperatorSubscript(0), Is.EqualTo(IntPtr.Zero));
}
}

13
tests/UTF16/UTF16.cpp

@ -1 +1,12 @@ @@ -1 +1,12 @@
#include "UTF16.h"
#include "UTF16.h"
// TODO: move this, it has nothing to do with Unicode, it's here only not to break the CLI branch
int Foo::operator[](int i) const
{
return 5;
}
char* Foo::operator[](int i)
{
return 0;
}

4
tests/UTF16/UTF16.h

@ -8,6 +8,10 @@ class DLL_API Foo @@ -8,6 +8,10 @@ class DLL_API Foo
{
public:
const char* Unicode;
// TODO: move this, it has nothing to do with Unicode, it's here only not to break the CLI branch
int operator[](int i) const;
char* operator[](int i);
};
DLL_API int FooCallFoo(Foo* foo);

Loading…
Cancel
Save