Commit 2a7bdd79 authored by Vinicius Jarina's avatar Vinicius Jarina
Browse files

Added tests to NUnit.

Removed Old tests
parent 6b07ec99
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion>9.0.30729</ProductVersion>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{AEAB974E-4F69-4840-A2C4-7BC55F7C7C3E}</ProjectGuid>
<OutputType>Exe</OutputType>
<ProjectGuid>{D5FCADFA-5047-40C2-B392-256875862920}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>LuaInterface.Tests</RootNamespace>
<AssemblyName>TestLua</AssemblyName>
<ReleaseVersion>2.x</ReleaseVersion>
<RootNamespace>LuaInterface.Test</RootNamespace>
<AssemblyName>LuaInterface.Test</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\Run\Debug</OutputPath>
<DefineConstants>DEBUG</DefineConstants>
<OutputPath>..\tests\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x86</PlatformTarget>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<DebugType>none</DebugType>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\..\Run\Release</OutputPath>
<DefineConstants>RELEASE</DefineConstants>
<OutputPath>..\tests\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x86</PlatformTarget>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\Run\Debug_x64</OutputPath>
<DefineConstants>DEBUG</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x64</PlatformTarget>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
<DebugType>none</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\..\Run\Release_x64</OutputPath>
<DefineConstants>RELEASE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x64</PlatformTarget>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="nunit.framework">
<HintPath>..\lib\nunit\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Entity.cs" />
<Compile Include="TestLua.cs" />
<Compile Include="TestLuaInterface.cs" />
<Compile Include="..\tests\Entity.cs">
<Link>Entity.cs</Link>
</Compile>
<Compile Include="..\tests\LuaTests.cs">
<Link>LuaTests.cs</Link>
</Compile>
<Compile Include="..\tests\TestLua.cs">
<Link>TestLua.cs</Link>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Core\LuaInterface\LuaInterface.csproj">
<ProjectReference Include="..\Core\KopiLua\KopiLua.csproj">
<Project>{E8DDBC21-EF74-4ABA-9C49-BFC702BE25D8}</Project>
<Name>KopiLua</Name>
</ProjectReference>
<ProjectReference Include="..\Core\LuaInterface\LuaInterface.csproj">
<Project>{F55CABBB-4108-4A39-94E1-581FD46DC021}</Project>
<Name>LuaInterface</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Folder Include="Properties\" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
<Visible>False</Visible>
<ProductName>Windows Installer 3.1</ProductName>
<Install>true</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<Content Include="Readme.txt" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
......
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle ("LuaInterface.Test")]
[assembly: AssemblyDescription ("")]
[assembly: AssemblyConfiguration ("")]
[assembly: AssemblyCompany ("")]
[assembly: AssemblyProduct ("LuaInterface.Test")]
[assembly: AssemblyCopyright ("Copyright © 2013")]
[assembly: AssemblyTrademark ("")]
[assembly: AssemblyCulture ("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible (false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid ("eaeb5ab2-711e-46eb-955f-fbb7b581e7aa")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion ("1.0.0.0")]
[assembly: AssemblyFileVersion ("1.0.0.0")]
......@@ -3,8 +3,6 @@ Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Test", "Test", "{0E28CF40-4DFA-46FE-95BB-E90648DFE6F5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestLuaInterface", "Test\TestLuaInterface\TestLuaInterface.csproj", "{AEAB974E-4F69-4840-A2C4-7BC55F7C7C3E}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Applications", "Applications", "{B13128D8-A4F3-4C53-A4C6-F2EA34F527BD}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LuaRunner", "Applications\LuaRunner\LuaRunner.csproj", "{3CE4CCB6-3465-43E3-B5ED-5FB9B70D20E5}"
......@@ -15,49 +13,79 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KopiLua", "Core\KopiLua\Kop
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LuaInterface", "Core\LuaInterface\LuaInterface.csproj", "{F55CABBB-4108-4A39-94E1-581FD46DC021}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LuaInterface.Test", "LuaInterface.Test\LuaInterface.Test.csproj", "{D5FCADFA-5047-40C2-B392-256875862920}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x86 = Debug|x86
Release|x86 = Release|x86
Debug|Any CPU = Debug|Any CPU
Debug|Mixed Platforms = Debug|Mixed Platforms
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|Mixed Platforms = Release|Mixed Platforms
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{3CE4CCB6-3465-43E3-B5ED-5FB9B70D20E5}.Debug|Any CPU.ActiveCfg = Debug|x86
{3CE4CCB6-3465-43E3-B5ED-5FB9B70D20E5}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
{3CE4CCB6-3465-43E3-B5ED-5FB9B70D20E5}.Debug|Mixed Platforms.Build.0 = Debug|x86
{3CE4CCB6-3465-43E3-B5ED-5FB9B70D20E5}.Debug|x64.ActiveCfg = Debug|x64
{3CE4CCB6-3465-43E3-B5ED-5FB9B70D20E5}.Debug|x64.Build.0 = Debug|x64
{3CE4CCB6-3465-43E3-B5ED-5FB9B70D20E5}.Debug|x86.ActiveCfg = Debug|x86
{3CE4CCB6-3465-43E3-B5ED-5FB9B70D20E5}.Debug|x86.Build.0 = Debug|x86
{3CE4CCB6-3465-43E3-B5ED-5FB9B70D20E5}.Release|Any CPU.ActiveCfg = Release|x86
{3CE4CCB6-3465-43E3-B5ED-5FB9B70D20E5}.Release|Mixed Platforms.ActiveCfg = Release|x86
{3CE4CCB6-3465-43E3-B5ED-5FB9B70D20E5}.Release|Mixed Platforms.Build.0 = Release|x86
{3CE4CCB6-3465-43E3-B5ED-5FB9B70D20E5}.Release|x64.ActiveCfg = Release|x64
{3CE4CCB6-3465-43E3-B5ED-5FB9B70D20E5}.Release|x64.Build.0 = Release|x64
{3CE4CCB6-3465-43E3-B5ED-5FB9B70D20E5}.Release|x86.ActiveCfg = Release|x86
{3CE4CCB6-3465-43E3-B5ED-5FB9B70D20E5}.Release|x86.Build.0 = Release|x86
{AEAB974E-4F69-4840-A2C4-7BC55F7C7C3E}.Debug|x64.ActiveCfg = Debug|x64
{AEAB974E-4F69-4840-A2C4-7BC55F7C7C3E}.Debug|x64.Build.0 = Debug|x64
{AEAB974E-4F69-4840-A2C4-7BC55F7C7C3E}.Debug|x86.ActiveCfg = Debug|x86
{AEAB974E-4F69-4840-A2C4-7BC55F7C7C3E}.Debug|x86.Build.0 = Debug|x86
{AEAB974E-4F69-4840-A2C4-7BC55F7C7C3E}.Release|x64.ActiveCfg = Release|x64
{AEAB974E-4F69-4840-A2C4-7BC55F7C7C3E}.Release|x64.Build.0 = Release|x64
{AEAB974E-4F69-4840-A2C4-7BC55F7C7C3E}.Release|x86.ActiveCfg = Release|x86
{AEAB974E-4F69-4840-A2C4-7BC55F7C7C3E}.Release|x86.Build.0 = Release|x86
{E8DDBC21-EF74-4ABA-9C49-BFC702BE25D8}.Debug|Any CPU.ActiveCfg = Debug|x86
{E8DDBC21-EF74-4ABA-9C49-BFC702BE25D8}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
{E8DDBC21-EF74-4ABA-9C49-BFC702BE25D8}.Debug|Mixed Platforms.Build.0 = Debug|x86
{E8DDBC21-EF74-4ABA-9C49-BFC702BE25D8}.Debug|x64.ActiveCfg = Debug|x64
{E8DDBC21-EF74-4ABA-9C49-BFC702BE25D8}.Debug|x64.Build.0 = Debug|x64
{E8DDBC21-EF74-4ABA-9C49-BFC702BE25D8}.Debug|x86.ActiveCfg = Debug|x86
{E8DDBC21-EF74-4ABA-9C49-BFC702BE25D8}.Debug|x86.Build.0 = Debug|x86
{E8DDBC21-EF74-4ABA-9C49-BFC702BE25D8}.Release|Any CPU.ActiveCfg = Release|x86
{E8DDBC21-EF74-4ABA-9C49-BFC702BE25D8}.Release|Mixed Platforms.ActiveCfg = Release|x86
{E8DDBC21-EF74-4ABA-9C49-BFC702BE25D8}.Release|Mixed Platforms.Build.0 = Release|x86
{E8DDBC21-EF74-4ABA-9C49-BFC702BE25D8}.Release|x64.ActiveCfg = Release|x64
{E8DDBC21-EF74-4ABA-9C49-BFC702BE25D8}.Release|x64.Build.0 = Release|x64
{E8DDBC21-EF74-4ABA-9C49-BFC702BE25D8}.Release|x86.ActiveCfg = Release|x86
{E8DDBC21-EF74-4ABA-9C49-BFC702BE25D8}.Release|x86.Build.0 = Release|x86
{F55CABBB-4108-4A39-94E1-581FD46DC021}.Debug|Any CPU.ActiveCfg = Debug|x86
{F55CABBB-4108-4A39-94E1-581FD46DC021}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
{F55CABBB-4108-4A39-94E1-581FD46DC021}.Debug|Mixed Platforms.Build.0 = Debug|x86
{F55CABBB-4108-4A39-94E1-581FD46DC021}.Debug|x64.ActiveCfg = Debug|x64
{F55CABBB-4108-4A39-94E1-581FD46DC021}.Debug|x64.Build.0 = Debug|x64
{F55CABBB-4108-4A39-94E1-581FD46DC021}.Debug|x86.ActiveCfg = Debug|x86
{F55CABBB-4108-4A39-94E1-581FD46DC021}.Debug|x86.Build.0 = Debug|x86
{F55CABBB-4108-4A39-94E1-581FD46DC021}.Release|Any CPU.ActiveCfg = Release|x86
{F55CABBB-4108-4A39-94E1-581FD46DC021}.Release|Mixed Platforms.ActiveCfg = Release|x86
{F55CABBB-4108-4A39-94E1-581FD46DC021}.Release|Mixed Platforms.Build.0 = Release|x86
{F55CABBB-4108-4A39-94E1-581FD46DC021}.Release|x64.ActiveCfg = Release|x64
{F55CABBB-4108-4A39-94E1-581FD46DC021}.Release|x64.Build.0 = Release|x64
{F55CABBB-4108-4A39-94E1-581FD46DC021}.Release|x86.ActiveCfg = Release|x86
{F55CABBB-4108-4A39-94E1-581FD46DC021}.Release|x86.Build.0 = Release|x86
{D5FCADFA-5047-40C2-B392-256875862920}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D5FCADFA-5047-40C2-B392-256875862920}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D5FCADFA-5047-40C2-B392-256875862920}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{D5FCADFA-5047-40C2-B392-256875862920}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{D5FCADFA-5047-40C2-B392-256875862920}.Debug|x64.ActiveCfg = Debug|Any CPU
{D5FCADFA-5047-40C2-B392-256875862920}.Debug|x86.ActiveCfg = Debug|Any CPU
{D5FCADFA-5047-40C2-B392-256875862920}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D5FCADFA-5047-40C2-B392-256875862920}.Release|Any CPU.Build.0 = Release|Any CPU
{D5FCADFA-5047-40C2-B392-256875862920}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{D5FCADFA-5047-40C2-B392-256875862920}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{D5FCADFA-5047-40C2-B392-256875862920}.Release|x64.ActiveCfg = Release|Any CPU
{D5FCADFA-5047-40C2-B392-256875862920}.Release|x86.ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{AEAB974E-4F69-4840-A2C4-7BC55F7C7C3E} = {0E28CF40-4DFA-46FE-95BB-E90648DFE6F5}
{3CE4CCB6-3465-43E3-B5ED-5FB9B70D20E5} = {B13128D8-A4F3-4C53-A4C6-F2EA34F527BD}
{E8DDBC21-EF74-4ABA-9C49-BFC702BE25D8} = {B8664957-CB71-4F11-A4DB-59E7514BC5F3}
{F55CABBB-4108-4A39-94E1-581FD46DC021} = {B8664957-CB71-4F11-A4DB-59E7514BC5F3}
......
Error:
- TestLua.exe -> TestThreading() ==Problem with threading!==
\ No newline at end of file
/*
* This file is part of LuaInterface.
*
* Copyright (C) 2003-2005 Fabio Mascarenhas de Queiroz.
* Copyright (C) 2012 Megax <http://megax.yeahunter.hu/>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
using System;
using System.Text;
using System.Collections.Generic;
namespace LuaInterface.Tests
{
public class Entity
{
public event EventHandler<EventArgs> Clicked;
protected virtual void OnEntityClicked(EventArgs e)
{
var handler = Clicked;
if(handler != null)
handler(this, e); // Use the () operator to raise the event.
}
public Entity()
{
}
public void Click()
{
OnEntityClicked(new EventArgs());
}
}
}
\ No newline at end of file
EXTRA_DIST =
#Warning: This is an automatically generated file, do not edit!
if ENABLE_DEBUG_X86
SUBDIRS = .
endif
if ENABLE_RELEASE_X86
SUBDIRS = .
endif
if ENABLE_DEBUG_X64
SUBDIRS = .
endif
if ENABLE_RELEASE_X64
SUBDIRS = .
endif
# Projekt-specifikus makefile beszúrása
include TestLuaInterface.make
\ No newline at end of file
/*
* This file is part of LuaInterface.
*
* Copyright (C) 2003-2005 Fabio Mascarenhas de Queiroz.
* Copyright (C) 2012 Megax <http://megax.yeahunter.hu/>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
using System;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using LuaInterface.Config;
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
[assembly: AssemblyTitle("TestLuaInterface")]
[assembly: AssemblyDescription(Consts.LuaInterfaceDescription)]
[assembly: AssemblyConfiguration(Consts.LuaInterfaceConfiguration)]
[assembly: AssemblyCompany(Consts.LuaInterfaceCompany)]
[assembly: AssemblyProduct(Consts.LuaInterfaceProduct)]
[assembly: AssemblyCopyright(Consts.LuaInterfaceCopyright)]
[assembly: AssemblyTrademark(Consts.LuaInterfaceTrademark)]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion(Consts.LuaInterfaceVersion)]
[assembly: AssemblyFileVersion(Consts.LuaInterfaceFileVersion)]
\ No newline at end of file
Note that this project should be considered deprecated. While I'm leaving it here for the moment, it will likely be removed from the repository in future.
\ No newline at end of file
/*
* This file is part of LuaInterface.
*
* Copyright (C) 2003-2005 Fabio Mascarenhas de Queiroz.
* Copyright (C) 2012 Megax <http://megax.yeahunter.hu/>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
using System;
using System.Threading;
using System.Reflection;
using System.Diagnostics;
using LuaInterface;
namespace LuaInterface.Tests
{
/*
* Delegates used for testing Lua function -> delegate translation
*/
public delegate int TestDelegate1(int a, int b);
public delegate int TestDelegate2(int a, out int b);
public delegate void TestDelegate3(int a, ref int b);
public delegate TestClass TestDelegate4(int a, int b);
public delegate int TestDelegate5(TestClass a, TestClass b);
public delegate int TestDelegate6(int a, out TestClass b);
public delegate void TestDelegate7(int a, ref TestClass b);
/*
* Interface used for testing Lua table -> interface translation
*/
public interface ITest
{
int intProp
{
get;
set;
}
TestClass refProp
{
get;
set;
}
int test1(int a,int b);
int test2(int a, out int b);
void test3(int a, ref int b);
TestClass test4(int a, int b);
int test5(TestClass a, TestClass b);
int test6(int a, out TestClass b);
void test7(int a, ref TestClass b);
}
public interface IFoo1
{
int foo();
}
public interface IFoo2
{
int foo();
}
class MyClass
{
public int Func1() { return 1;}
}
/// <summary>
/// Use to test threading
/// </summary>
class DoWorkClass
{
//private object _Lock = new object();
public void DoWork()
{
//lock (_Lock)
//{
//simulate work by sleeping
//Console.WriteLine("Started to do work on thread: " + Thread.CurrentThread.ManagedThreadId);
Thread.Sleep(new Random().Next(0, 1000));
//Console.WriteLine("Finished work on thread: " + Thread.CurrentThread.ManagedThreadId);
//}
}
}
/// <summary>
/// test structure passing
/// </summary>
public struct TestStruct
{
public TestStruct(float val)
{
v = val;
}
public float v;
public float val
{
get { return v; }
set { v = value; }
}
}
/// <summary>
/// Generic class with generic and non-generic methods
/// </summary>
/// <typeparam name="T"></typeparam>
public class TestClassGeneric<T>
{
private object _PassedValue;
private bool _RegularMethodSuccess;
public bool RegularMethodSuccess
{
get { return _RegularMethodSuccess; }
}
private bool _GenericMethodSuccess;
public bool GenericMethodSuccess
{
get { return _GenericMethodSuccess; }
}
public void GenericMethod(T value)
{
_PassedValue = value;
_GenericMethodSuccess = true;
}
public void RegularMethod()
{
_RegularMethodSuccess = true;
}
/// <summary>
/// Returns true if the generic method was successfully passed a matching value
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
public bool Validate(T value)
{
return value.Equals(_PassedValue);
}
}
/// <summary>
/// Normal class containing a generic method
/// </summary>
public class TestClassWithGenericMethod
{
private object _PassedValue;
public object PassedValue
{
get { return _PassedValue; }
}
private bool _GenericMethodSuccess;
public bool GenericMethodSuccess
{
get { return _GenericMethodSuccess; }
}
public void GenericMethod<T>(T value)
{
_PassedValue = value;
_GenericMethodSuccess = true;
}
internal bool Validate<T>(T value)
{
return value.Equals(_PassedValue);
}
}
/*
* Sample class used in several test cases to check if
* Lua scripts are accessing objects correctly
*/
public class TestClass : IFoo1, IFoo2
{
public int val;
private string strVal;
public TestClass()
{
val = 0;
}
public TestClass(int val)
{
this.val = val;
}
public TestClass(string val)
{
this.strVal = val;
}
public static TestClass makeFromString(String str)
{
return new TestClass(str);
}
bool? nb2 = null;
public bool? NullableBool
{
get { return nb2; }
set { nb2 = value; }
}
TestStruct s = new TestStruct();
public TestStruct Struct
{
get { return s; }
set { s = (TestStruct)value; }
}
public int testval
{
get
{
return this.val;
}
set
{
this.val = value;
}
}
public int this[int index]
{
get { return 1; }
set { }
}
public int this[string index]
{
get { return 1; }
set { }
}
public int sum(int x, int y)
{
return x + y;
}
public void setVal(int newVal)
{
val = newVal;
}
public void setVal(string newVal)
{
strVal = newVal;
}
public int getVal()
{
return val;
}
public string getStrVal()
{
return strVal;
}
public int outVal(out int val)
{
val = 5;
return 3;
}
public int outVal(out int val, int val2)
{
val = 5;
return val2;
}
public int outVal(int val, ref int val2)
{
val2 = val + val2;
return val;
}
public int callDelegate1(TestDelegate1 del)
{
return del(2, 3);
}
public int callDelegate2(TestDelegate2 del)
{
int a = 3;
int b = del(2, out a);
return a + b;
}
public int callDelegate3(TestDelegate3 del)
{
int a = 3;
del(2, ref a);
//Console.WriteLine(a);
return a;
}
public int callDelegate4(TestDelegate4 del)
{
return del(2, 3).testval;
}
public int callDelegate5(TestDelegate5 del)
{
return del(new TestClass(2), new TestClass(3));
}
public int callDelegate6(TestDelegate6 del)
{
TestClass test = new TestClass();
int a = del(2, out test);
return a + test.testval;
}
public int callDelegate7(TestDelegate7 del)
{
TestClass test = new TestClass(3);
del(2, ref test);
return test.testval;
}
public int callInterface1(ITest itest)
{
return itest.test1(2, 3);
}
public int callInterface2(ITest itest)
{
int a = 3;
int b = itest.test2(2, out a);
return a + b;
}
public int callInterface3(ITest itest)
{
int a = 3;
itest.test3(2, ref a);
//Console.WriteLine(a);
return a;
}
public int callInterface4(ITest itest)
{
return itest.test4(2, 3).testval;
}
public int callInterface5(ITest itest)
{
return itest.test5(new TestClass(2), new TestClass(3));
}
public int callInterface6(ITest itest)
{
TestClass test = new TestClass();
int a = itest.test6(2, out test);
return a + test.testval;
}
public int callInterface7(ITest itest)
{
TestClass test = new TestClass(3);
itest.test7(2, ref test);
return test.testval;
}
public int callInterface8(ITest itest)
{
itest.intProp = 3;
return itest.intProp;
}
public int callInterface9(ITest itest)
{
itest.refProp = new TestClass(3);
return itest.refProp.testval;
}
public void exceptionMethod()
{
throw new Exception("exception test");
}
public virtual int overridableMethod(int x, int y)
{
return x + y;
}
public static int callOverridable(TestClass test, int x, int y)
{
return test.overridableMethod(x, y);
}
int IFoo1.foo()
{
return 3;
}
public int foo()
{
return 5;
}
private void _PrivateMethod()
{
Console.WriteLine("Private method called");
}
public void MethodOverload()
{
Console.WriteLine("Method with no params");
}
public void MethodOverload(TestClass testClass)
{
Console.WriteLine("Method with testclass param");
}
public void MethodOverload(int i, int j, int k)
{
Console.WriteLine("Overload without out param: " + i + ", " + j + ", " + k);
}
public void MethodOverload(int i, int j, out int k)
{
k = 5;
Console.WriteLine("Overload with out param" + i + ", " + j);
}
}
}
\ No newline at end of file
This diff is collapsed.
# Warning: This is an automatically generated file, do not edit!
if ENABLE_DEBUG_X86
ASSEMBLY_COMPILER_COMMAND = dmcs
ASSEMBLY_COMPILER_FLAGS = -noconfig -codepage:utf8 -warn:4 -optimize- -debug "-define:DEBUG"
ASSEMBLY = ../../Run/Debug/TestLua.exe
ASSEMBLY_MDB = $(ASSEMBLY).mdb
COMPILE_TARGET = exe
PROJECT_REFERENCES = \
../../Run/Debug/LuaInterface.dll
BUILD_DIR = ../../Run/Debug
TESTLUA_EXE_MDB_SOURCE=../../Run/Debug/TestLua.exe.mdb
TESTLUA_EXE_MDB=$(BUILD_DIR)/TestLua.exe.mdb
LUAINTERFACE_DLL_SOURCE=../../Run/Debug/LuaInterface.dll
KOPILUA_DLL_SOURCE=../../Run/Debug/KopiLua.dll
endif
if ENABLE_RELEASE_X86
ASSEMBLY_COMPILER_COMMAND = dmcs
ASSEMBLY_COMPILER_FLAGS = -noconfig -codepage:utf8 -warn:4 -optimize+ "-define:RELEASE"
ASSEMBLY = ../../Run/Release/TestLua.exe
ASSEMBLY_MDB =
COMPILE_TARGET = exe
PROJECT_REFERENCES = \
../../Run/Release/LuaInterface.dll
BUILD_DIR = ../../Run/Release
TESTLUA_EXE_MDB=
LUAINTERFACE_DLL_SOURCE=../../Run/Release/LuaInterface.dll
KOPILUA_DLL_SOURCE=../../Run/Release/KopiLua.dll
endif
if ENABLE_DEBUG_X64
ASSEMBLY_COMPILER_COMMAND = dmcs
ASSEMBLY_COMPILER_FLAGS = -noconfig -codepage:utf8 -warn:4 -optimize- -debug "-define:DEBUG"
ASSEMBLY = ../../Run/Debug_x64/TestLua.exe
ASSEMBLY_MDB = $(ASSEMBLY).mdb
COMPILE_TARGET = exe
PROJECT_REFERENCES = \
../../Run/Debug_x64/LuaInterface.dll
BUILD_DIR = ../../Run/Debug_x64
TESTLUA_EXE_MDB_SOURCE=../../Run/Debug_x64/TestLua.exe.mdb
TESTLUA_EXE_MDB=$(BUILD_DIR)/TestLua.exe.mdb
LUAINTERFACE_DLL_SOURCE=../../Run/Debug_x64/LuaInterface.dll
KOPILUA_DLL_SOURCE=../../Run/Debug_x64/KopiLua.dll
endif
if ENABLE_RELEASE_X64
ASSEMBLY_COMPILER_COMMAND = dmcs
ASSEMBLY_COMPILER_FLAGS = -noconfig -codepage:utf8 -warn:4 -optimize+ "-define:RELEASE"
ASSEMBLY = ../../Run/Release_x64/TestLua.exe
ASSEMBLY_MDB =
COMPILE_TARGET = exe
PROJECT_REFERENCES = \
../../Run/Release_x64/LuaInterface.dll
BUILD_DIR = ../../Run/Release_x64
TESTLUA_EXE_MDB=
LUAINTERFACE_DLL_SOURCE=../../Run/Release_x64/LuaInterface.dll
KOPILUA_DLL_SOURCE=../../Run/Release_x64/KopiLua.dll
endif
AL=al
SATELLITE_ASSEMBLY_NAME=$(notdir $(basename $(ASSEMBLY))).resources.dll
PROGRAMFILES = \
$(TESTLUA_EXE_MDB) \
$(LUAINTERFACE_DLL) \
$(KOPILUA_DLL)
BINARIES = \
$(TESTLUAINTERFACE)
RESGEN=resgen2
all: $(ASSEMBLY) $(PROGRAMFILES) $(BINARIES)
FILES = \
Entity.cs \
TestLua.cs \
TestLuaInterface.cs \
Properties/AssemblyInfo.cs
DATA_FILES =
RESOURCES =
EXTRAS = \
Properties \
Readme.txt \
testluainterface.in
REFERENCES = \
System \
System.Data \
System.Xml
DLL_REFERENCES =
CLEANFILES = $(PROGRAMFILES) $(BINARIES)
include $(top_srcdir)/Makefile.include
LUAINTERFACE_DLL = $(BUILD_DIR)/LuaInterface.dll
KOPILUA_DLL = $(BUILD_DIR)/KopiLua.dll
TESTLUAINTERFACE = $(BUILD_DIR)/testluainterface
$(eval $(call emit-deploy-wrapper,TESTLUAINTERFACE,testluainterface,x))
$(eval $(call emit_resgen_targets))
$(build_xamlg_list): %.xaml.g.cs: %.xaml
xamlg '$<'
$(ASSEMBLY_MDB): $(ASSEMBLY)
$(ASSEMBLY): $(build_sources) $(build_resources) $(build_datafiles) $(DLL_REFERENCES) $(PROJECT_REFERENCES) $(build_xamlg_list) $(build_satellite_assembly_list)
mkdir -p $(shell dirname $(ASSEMBLY))
$(ASSEMBLY_COMPILER_COMMAND) $(ASSEMBLY_COMPILER_FLAGS) -out:$(ASSEMBLY) -target:$(COMPILE_TARGET) $(build_sources_embed) $(build_resources_embed) $(build_references_ref)
#!/bin/sh
exec mono "@expanded_libdir@/@PACKAGE@/TestLua.exe" "$@"
This diff is collapsed.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace LuaInterface.Test.Mock
{
public class Entity
{
public event EventHandler<EventArgs> Clicked;
protected virtual void OnEntityClicked(EventArgs e)
{
EventHandler<EventArgs> handler = Clicked;
if (handler != null)
{
// Use the () operator to raise the event.
handler(this, e);
}
}
public Entity()
{
}
public void Click()
{
OnEntityClicked(new EventArgs());
}
}
}
This diff is collapsed.
//note: this should be cleaned up and replaced with moq mocks where possible
namespace LuaInterface.Test.Mock
{
using System;
using LuaInterface;
using System.Threading;
using System.Diagnostics;
using System.Reflection;
/*
* Delegates used for testing Lua function -> delegate translation
*/
public delegate int TestDelegate1(int a, int b);
public delegate int TestDelegate2(int a, out int b);
public delegate void TestDelegate3(int a, ref int b);
public delegate TestClass TestDelegate4(int a, int b);
public delegate int TestDelegate5(TestClass a, TestClass b);
public delegate int TestDelegate6(int a, out TestClass b);
public delegate void TestDelegate7(int a, ref TestClass b);
/*
* Interface used for testing Lua table -> interface translation
*/
public interface ITest
{
int intProp
{
get;
set;
}
TestClass refProp
{
get;
set;
}
int test1(int a, int b);
int test2(int a, out int b);
void test3(int a, ref int b);
TestClass test4(int a, int b);
int test5(TestClass a, TestClass b);
int test6(int a, out TestClass b);
void test7(int a, ref TestClass b);
}
public interface IFoo1
{
int foo();
}
public interface IFoo2
{
int foo();
}
class MyClass
{
public int Func1() { return 1; }
}
/// <summary>
/// Use to test threading
/// </summary>
class DoWorkClass
{
private object _Lock = new object();
public void DoWork()
{
//simulate work by sleeping
//Console.WriteLine("Started to do work on thread: " + Thread.CurrentThread.ManagedThreadId);
Thread.Sleep(new Random().Next(0, 1000));
//Console.WriteLine("Finished work on thread: " + Thread.CurrentThread.ManagedThreadId);
}
}
/// <summary>
/// test structure passing
/// </summary>
public struct TestStruct
{
public TestStruct(float val)
{
v = val;
}
public float v;
public float val
{
get { return v; }
set { v = value; }
}
}
/// <summary>
/// Generic class with generic and non-generic methods
/// </summary>
/// <typeparam name="T"></typeparam>
public class TestClassGeneric<T>
{
private object _PassedValue;
private bool _RegularMethodSuccess;
public bool RegularMethodSuccess
{
get { return _RegularMethodSuccess; }
}
private bool _GenericMethodSuccess;
public bool GenericMethodSuccess
{
get { return _GenericMethodSuccess; }
}
public void GenericMethod(T value)
{
_PassedValue = value;
_GenericMethodSuccess = true;
}
public void RegularMethod()
{
_RegularMethodSuccess = true;
}
/// <summary>
/// Returns true if the generic method was successfully passed a matching value
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
public bool Validate(T value)
{
return value.Equals(_PassedValue);
}
}
/// <summary>
/// Normal class containing a generic method
/// </summary>
public class TestClassWithGenericMethod
{
private object _PassedValue;
public object PassedValue
{
get { return _PassedValue; }
}
private bool _GenericMethodSuccess;
public bool GenericMethodSuccess
{
get { return _GenericMethodSuccess; }
}
public void GenericMethod<T>(T value)
{
_PassedValue = value;
_GenericMethodSuccess = true;
}
internal bool Validate<T>(T value)
{
return value.Equals(_PassedValue);
}
}
public class TestClass2
{
public static int func(int x, int y)
{
return x + y;
}
public int funcInstance(int x, int y)
{
return x + y;
}
}
/*
* Sample class used in several test cases to check if
* Lua scripts are accessing objects correctly
*/
public class TestClass : IFoo1, IFoo2
{
public int val;
private string strVal;
public TestClass()
{
val = 0;
}
public TestClass(int val)
{
this.val = val;
}
public TestClass(string val)
{
this.strVal = val;
}
public static TestClass makeFromString(String str)
{
return new TestClass(str);
}
bool? nb2 = null;
public bool? NullableBool
{
get { return nb2; }
set { nb2 = value; }
}
TestStruct s = new TestStruct();
public TestStruct Struct
{
get { return s; }
set { s = (TestStruct)value; }
}
public int testval
{
get
{
return this.val;
}
set
{
this.val = value;
}
}
public int this[int index]
{
get { return 1; }
set { }
}
public int this[string index]
{
get { return 1; }
set { }
}
public int sum(int x, int y)
{
return x + y;
}
public void setVal(int newVal)
{
val = newVal;
}
public void setVal(string newVal)
{
strVal = newVal;
}
public int getVal()
{
return val;
}
public string getStrVal()
{
return strVal;
}
public int outVal(out int val)
{
val = 5;
return 3;
}
public int outVal(out int val, int val2)
{
val = 5;
return val2;
}
public int outVal(int val, ref int val2)
{
val2 = val + val2;
return val;
}
public int outValMutiple(int arg, out string arg2, out string arg3)
{
arg2 = Guid.NewGuid().ToString();
arg3 = Guid.NewGuid().ToString();
return arg;
}
public int callDelegate1(TestDelegate1 del)
{
return del(2, 3);
}
public int callDelegate2(TestDelegate2 del)
{
int a = 3;
int b = del(2, out a);
return a + b;
}
public int callDelegate3(TestDelegate3 del)
{
int a = 3;
del(2, ref a);
//Console.WriteLine(a);
return a;
}
public int callDelegate4(TestDelegate4 del)
{
return del(2, 3).testval;
}
public int callDelegate5(TestDelegate5 del)
{
return del(new TestClass(2), new TestClass(3));
}
public int callDelegate6(TestDelegate6 del)
{
TestClass test = new TestClass();
int a = del(2, out test);
return a + test.testval;
}
public int callDelegate7(TestDelegate7 del)
{
TestClass test = new TestClass(3);
del(2, ref test);
return test.testval;
}
public int callInterface1(ITest itest)
{
return itest.test1(2, 3);
}
public int callInterface2(ITest itest)
{
int a = 3;
int b = itest.test2(2, out a);
return a + b;
}
public int callInterface3(ITest itest)
{
int a = 3;
itest.test3(2, ref a);
//Console.WriteLine(a);
return a;
}
public int callInterface4(ITest itest)
{
return itest.test4(2, 3).testval;
}
public int callInterface5(ITest itest)
{
return itest.test5(new TestClass(2), new TestClass(3));
}
public int callInterface6(ITest itest)
{
TestClass test = new TestClass();
int a = itest.test6(2, out test);
return a + test.testval;
}
public int callInterface7(ITest itest)
{
TestClass test = new TestClass(3);
itest.test7(2, ref test);
return test.testval;
}
public int callInterface8(ITest itest)
{
itest.intProp = 3;
return itest.intProp;
}
public int callInterface9(ITest itest)
{
itest.refProp = new TestClass(3);
return itest.refProp.testval;
}
public void exceptionMethod()
{
throw new Exception("exception test");
}
public virtual int overridableMethod(int x, int y)
{
return x + y;
}
public static int callOverridable(TestClass test, int x, int y)
{
return test.overridableMethod(x, y);
}
int IFoo1.foo()
{
return 3;
}
public int foo()
{
return 5;
}
private void _PrivateMethod()
{
Console.WriteLine("Private method called");
}
public void MethodOverload()
{
Console.WriteLine("Method with no params");
}
public void MethodOverload(TestClass testClass)
{
Console.WriteLine("Method with testclass param");
}
public void MethodOverload(int i, int j, int k)
{
Console.WriteLine("Overload without out param: " + i + ", " + j + ", " + k);
}
public void MethodOverload(int i, int j, out int k)
{
k = 5;
Console.WriteLine("Overload with out param" + i + ", " + j);
}
}
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment