From b1f64ed06dba2317f7c32fcbc57ade29dffd21a9 Mon Sep 17 00:00:00 2001 From: triton Date: Fri, 25 Oct 2013 03:32:40 +0100 Subject: [PATCH] Reworked Generator tests project. --- src/Generator.Tests/HeaderTestFixture.cs | 20 ++++---------------- src/Generator.Tests/Passes/TestPasses.cs | 5 ++--- src/Generator.Tests/QueryHelpers.cs | 3 +-- src/Generator.Tests/TestCLITypePrinter.cs | 2 +- 4 files changed, 8 insertions(+), 22 deletions(-) diff --git a/src/Generator.Tests/HeaderTestFixture.cs b/src/Generator.Tests/HeaderTestFixture.cs index f481f7eb..37c6f3a4 100644 --- a/src/Generator.Tests/HeaderTestFixture.cs +++ b/src/Generator.Tests/HeaderTestFixture.cs @@ -1,9 +1,9 @@ using System; using System.IO; -using CppSharp; using CppSharp.AST; +using CppSharp.Utils; -namespace Generator.Tests +namespace CppSharp.Generator.Tests { public class HeaderTestFixture { @@ -11,24 +11,12 @@ namespace Generator.Tests protected DriverOptions Options; protected ASTContext AstContext; - private const string TestsDirectory = @"..\..\..\tests\Native"; - - public HeaderTestFixture() - { - - } - protected void ParseLibrary(string file) - { - ParseLibrary(TestsDirectory, file); - } - - protected void ParseLibrary(string dir, string file) { Options = new DriverOptions(); - var path = Path.Combine(Directory.GetCurrentDirectory(), dir); - Options.IncludeDirs.Add(Path.GetFullPath(path)); + var testsPath = LibraryTest.GetTestsDirectory("Native"); + Options.IncludeDirs.Add(testsPath); Options.Headers.Add(file); Driver = new Driver(Options, new TextDiagnosticPrinter()); diff --git a/src/Generator.Tests/Passes/TestPasses.cs b/src/Generator.Tests/Passes/TestPasses.cs index 30ed9475..555607c7 100644 --- a/src/Generator.Tests/Passes/TestPasses.cs +++ b/src/Generator.Tests/Passes/TestPasses.cs @@ -1,8 +1,7 @@ -using CppSharp; -using CppSharp.Passes; +using CppSharp.Passes; using NUnit.Framework; -namespace Generator.Tests.Passes +namespace CppSharp.Generator.Tests.Passes { [TestFixture] public class TestPasses : HeaderTestFixture diff --git a/src/Generator.Tests/QueryHelpers.cs b/src/Generator.Tests/QueryHelpers.cs index 24a6a711..b2ca55b1 100644 --- a/src/Generator.Tests/QueryHelpers.cs +++ b/src/Generator.Tests/QueryHelpers.cs @@ -1,8 +1,7 @@ using System.Linq; -using CppSharp; using CppSharp.AST; -namespace Generator.Tests +namespace CppSharp.Generator.Tests { public static class LibraryQueryExtensions { diff --git a/src/Generator.Tests/TestCLITypePrinter.cs b/src/Generator.Tests/TestCLITypePrinter.cs index 54cef0e4..9a303234 100644 --- a/src/Generator.Tests/TestCLITypePrinter.cs +++ b/src/Generator.Tests/TestCLITypePrinter.cs @@ -3,7 +3,7 @@ using CppSharp.Generators.CLI; using CppSharp.Types; using NUnit.Framework; -namespace Generator.Tests +namespace CppSharp.Generator.Tests { [TypeMap("FnPtr3")] public class CLITypePrinterTypeMap : TypeMap