This commit is contained in:
2018-03-27 00:56:30 +03:00
parent 97c84efe7f
commit da5f7dd342
8 changed files with 201 additions and 103 deletions

View File

@@ -13,7 +13,6 @@ uses
DUnitX.TestFramework,
Unit1 in 'Unit1.pas',
RuntimeBuilder in '..\Source\RuntimeBuilder.pas',
RuntimeBuilder.Types in '..\Source\RuntimeBuilder.Types.pas',
RuntimeBuilder.Fasm in '..\Source\RuntimeBuilder.Fasm.pas',
FasmOnDelphi in '..\FasmOnDelphi\Source\FasmOnDelphi.pas',
Fasm4Delphi in '..\FasmOnDelphi\Fasm4Delphi\Source\Fasm4Delphi.pas';

View File

@@ -97,7 +97,6 @@
</DelphiCompile>
<DCCReference Include="Unit1.pas"/>
<DCCReference Include="..\Source\RuntimeBuilder.pas"/>
<DCCReference Include="..\Source\RuntimeBuilder.Types.pas"/>
<DCCReference Include="..\Source\RuntimeBuilder.Fasm.pas"/>
<DCCReference Include="..\FasmOnDelphi\Source\FasmOnDelphi.pas"/>
<DCCReference Include="..\FasmOnDelphi\Fasm4Delphi\Source\Fasm4Delphi.pas"/>
@@ -457,13 +456,13 @@
<Operation>1</Operation>
</Platform>
</DeployClass>
<ProjectRoot Platform="iOSDevice32" Name="$(PROJECTNAME).app"/>
<ProjectRoot Platform="OSX32" Name="$(PROJECTNAME)"/>
<ProjectRoot Platform="Android" Name="$(PROJECTNAME)"/>
<ProjectRoot Platform="Win32" Name="$(PROJECTNAME)"/>
<ProjectRoot Platform="iOSDevice64" Name="$(PROJECTNAME).app"/>
<ProjectRoot Platform="Win64" Name="$(PROJECTNAME)"/>
<ProjectRoot Platform="iOSSimulator" Name="$(PROJECTNAME).app"/>
<ProjectRoot Platform="OSX32" Name="$(PROJECTNAME)"/>
<ProjectRoot Platform="iOSDevice32" Name="$(PROJECTNAME).app"/>
</Deployment>
<Platforms>
<Platform value="OSX32">False</Platform>

View File

@@ -3,7 +3,7 @@ unit Unit1;
interface
uses
System.SysUtils,DUnitX.TestFramework,RuntimeBuilder,RuntimeBuilder.Fasm,RuntimeBuilder.Types;
System.SysUtils,DUnitX.TestFramework,RuntimeBuilder,RuntimeBuilder.Fasm;
type
[TestFixture]
@@ -11,6 +11,8 @@ type
public
[TestCase]
procedure Test1();
[TestCase]
procedure Test2();
end;
implementation
@@ -34,6 +36,28 @@ FreeAndNil(Src);
FreeAndNil(Fasm);
end;
procedure TRuntimeBuilderTestObject.Test2();
var
Fasm:TRTBFasmCompiler;
Src:TRTBSource;
lib:TRTBLib;
Func1:TRTBFunc;
begin
Fasm:=TRTBFasmCompiler.Create('..\..\..\FasmOnDelphi\fasmw172\fasm');
Src:=Fasm.GenNewSrc;
Src.LoadFromFile('..\..\testlib.fasm');
Fasm.LoadLib('W:\RuntimeBuilder\FasmOnDelphi\fasmw172\INCLUDE\win32a.inc');
lib:=Src.CompilateAsLib;
Func1:=lib.Funtion['MyEcho'];
if 234665<>Func1.Call(TypeInfo(integer),[234665],CRTBCallTypeStdCall).AsInteger then
begin
raise Exception.Create('Error in test2');
end;
FreeAndNil(Func1);
FreeAndNil(Src);
FreeAndNil(Fasm);
end;
initialization
TDUnitX.RegisterTestFixture(TRuntimeBuilderTestObject);
end.

29
Tests/testlib.fasm Normal file
View File

@@ -0,0 +1,29 @@
entry DllEntryPoint
section '.text' code readable executable
proc DllEntryPoint hinstDLL,fdwReason,lpvReserved
mov eax,TRUE
ret
endp
proc MyEcho HWnd
mov eax,[HWnd]
ret
endp
dd GetLastError
section '.idata' import data readable writeable
library kernel,'KERNEL32.DLL'
import kernel,\
GetLastError,'GetLastError'
section '.edata' export data readable
export '1.DLL',\
MyEcho,'MyEcho'
section '.reloc' fixups data readable discardable