Browse Source

A little more test reorganization. They all pass now.. HOORAY!

pull/1/head
Alex Corrado 14 years ago
parent
commit
3ad3fd8923
  1. 0
      tests/ByValTests.cs
  2. 52
      tests/CppInstancePtrTests.cs
  3. 7
      tests/Makefile.am
  4. 2
      tests/Native/ByValTests.cpp
  5. 0
      tests/Native/ByValTests.h
  6. 4
      tests/README
  7. 7
      tests/Tests.csproj

0
tests/AbiTests.cs → tests/ByValTests.cs

52
tests/CppInstancePtrTests.cs

@ -1,52 +0,0 @@ @@ -1,52 +0,0 @@
//
// CppInstancePtrTests.cs: Test cases to exercise the CppInstancePtr
//
// Author:
// Alexander Corrado (alexander.corrado@gmail.com)
//
// Copyright (C) 2010 Alexander Corrado
//
using System;
using System.Runtime.InteropServices;
using NUnit.Framework;
using Mono.VisualC.Interop;
using Tests.Support;
namespace Tests {
[TestFixture]
public class CppInstancePtrTests {
static CppInstancePtr uninitialized;
[Test]
[ExpectedException (typeof (ObjectDisposedException))]
public void TestUninitialized ()
{
Assert.IsFalse (uninitialized.IsManagedAlloc, "#A1");
Assert.AreEqual (IntPtr.Zero, uninitialized.Native, "#A2");
}
[Test]
public void TestForManagedObject ()
{
CppInstancePtr cppip = CppInstancePtr.ForManagedObject<EmptyTestInterface,CppMockObject> (CppMockObject.Instance);
Assert.AreNotEqual (IntPtr.Zero, cppip.Native, "#A1");
Assert.IsTrue (cppip.IsManagedAlloc, "#A2");
cppip.Dispose ();
}
[Test]
[ExpectedException (typeof (ObjectDisposedException))]
public void TestDisposed ()
{
CppInstancePtr cppip = CppInstancePtr.ForManagedObject<EmptyTestInterface,CppMockObject> (CppMockObject.Instance);
cppip.Dispose ();
// should throw
Assert.Fail ();
}
}
}

7
tests/Makefile.am

@ -7,15 +7,14 @@ INTEROP_DLL = \ @@ -7,15 +7,14 @@ INTEROP_DLL = \
TEST_DLL = $(BUILD_DIR)/Test.dll
HDR = \
Native/AbiTests.h
Native/ByValTests.h
NATIVE = \
Native/NUnit.cpp \
Native/AbiTests.cpp
Native/ByValTests.cpp
MANAGED = \
AbiTests.cs \
CppInstancePtrTests.cs \
ByValTests.cs \
Support/CppMockObject.cs \
Support/CppNUnitAsserts.cs

2
tests/Native/AbiTests.cpp → tests/Native/ByValTests.cpp

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
#include "AbiTests.h"
#include "ByValTests.h"
ClassWithCopyCtor::ClassWithCopyCtor(const ClassWithCopyCtor& f) {
x = f.x;

0
tests/Native/AbiTests.h → tests/Native/ByValTests.h

4
tests/README

@ -1,3 +1 @@ @@ -1,3 +1 @@
This directory contains tests for the cpp binding. It should probably be merged with
src/Tests. To run them, type 'make run'.
This directory contains tests for the cpp binding. To run them, type 'make run'.

7
tests/Tests.csproj

@ -52,8 +52,7 @@ @@ -52,8 +52,7 @@
<ItemGroup>
<Compile Include="Support\CppMockObject.cs" />
<Compile Include="Support\CppNUnitAsserts.cs" />
<Compile Include="CppInstancePtrTests.cs" />
<Compile Include="AbiTests.cs" />
<Compile Include="ByValTests.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
@ -70,8 +69,8 @@ @@ -70,8 +69,8 @@
<ItemGroup>
<None Include="Native\NUnit.cpp" />
<None Include="Native\NUnit.h" />
<None Include="Native\AbiTests.cpp" />
<None Include="Native\AbiTests.h" />
<None Include="Native\ByValTests.cpp" />
<None Include="Native\ByValTests.h" />
</ItemGroup>
<ProjectExtensions>
<MonoDevelop>

Loading…
Cancel
Save