FAdd PC –compatibility

This commit is contained in:
2018-02-12 18:08:40 +03:00
parent 092b1faa37
commit b7a7c3d056
12 changed files with 227 additions and 35 deletions

View File

@@ -0,0 +1,79 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="10"/>
<PathDelim Value="\"/>
<General>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<Title Value="fpcunitproject1"/>
<ResourceType Value="res"/>
<UseXPManifest Value="True"/>
<Icon Value="0"/>
</General>
<i18n>
<EnableI18N LFM="False"/>
</i18n>
<VersionInfo>
<StringTable ProductVersion=""/>
</VersionInfo>
<BuildModes Count="1">
<Item1 Name="Default" Default="True"/>
</BuildModes>
<PublishOptions>
<Version Value="2"/>
</PublishOptions>
<RunParams>
<local>
<FormatVersion Value="1"/>
</local>
</RunParams>
<RequiredPackages Count="3">
<Item1>
<PackageName Value="fpcunittestrunner"/>
</Item1>
<Item2>
<PackageName Value="LCL"/>
</Item2>
<Item3>
<PackageName Value="FCL"/>
</Item3>
</RequiredPackages>
<Units Count="3">
<Unit0>
<Filename Value="fpcunitproject1.lpr"/>
<IsPartOfProject Value="True"/>
</Unit0>
<Unit1>
<Filename Value="testcase1.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="TestCase1"/>
</Unit1>
<Unit2>
<Filename Value="..\Source\Fasm4Delphi.pas"/>
<IsPartOfProject Value="True"/>
</Unit2>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<OtherUnitFiles Value="..\Source"/>
</SearchPaths>
</CompilerOptions>
<Debugging>
<Exceptions Count="3">
<Item1>
<Name Value="EAbort"/>
</Item1>
<Item2>
<Name Value="ECodetoolError"/>
</Item2>
<Item3>
<Name Value="EFOpenError"/>
</Item3>
</Exceptions>
</Debugging>
</CONFIG>

View File

@@ -0,0 +1,13 @@
program fpcunitproject1;
{$mode objfpc}{$H+}
uses
Interfaces, Forms, GuiTestRunner, fpcunittestrunner, TestCase1;
begin
Application.Initialize;
Application.CreateForm(TGuiTestRunner, TestRunner);
Application.Run;
end.

View File

@@ -0,0 +1,46 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectSession>
<PathDelim Value="\"/>
<Version Value="10"/>
<BuildModes Active="Default"/>
<Units Count="3">
<Unit0>
<Filename Value="fpcunitproject1.lpr"/>
<IsPartOfProject Value="True"/>
<EditorIndex Value="1"/>
<CursorPos X="66" Y="6"/>
<UsageCount Value="20"/>
<Loaded Value="True"/>
</Unit0>
<Unit1>
<Filename Value="testcase1.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="TestCase1"/>
<IsVisibleTab Value="True"/>
<TopLine Value="21"/>
<CursorPos X="62" Y="41"/>
<UsageCount Value="20"/>
<Loaded Value="True"/>
</Unit1>
<Unit2>
<Filename Value="..\Source\Fasm4Delphi.pas"/>
<IsPartOfProject Value="True"/>
<EditorIndex Value="-1"/>
<WindowIndex Value="-1"/>
<TopLine Value="-1"/>
<CursorPos X="-1" Y="-1"/>
<UsageCount Value="20"/>
</Unit2>
</Units>
<JumpHistory Count="2" HistoryIndex="1">
<Position1>
<Filename Value="fpcunitproject1.lpr"/>
</Position1>
<Position2>
<Filename Value="testcase1.pas"/>
<Caret Line="8" Column="66"/>
</Position2>
</JumpHistory>
</ProjectSession>
</CONFIG>

51
FPCTests/testcase1.pas Normal file
View File

@@ -0,0 +1,51 @@
unit TestCase1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, fpcunit, testutils, testregistry,Fasm4Delphi;
type
TTestCase1= class(TTestCase)
published
procedure TestHookUp;
end;
implementation
const
CompliterMemSize=$10000;
var
CompliterMem:PFASM_STATE;
procedure TTestCase1.TestHookUp;
begin
if fasm_AssembleFile('..\Tests\Test1.asm',CompliterMem,CompliterMemSize)<>FASM_OK then
Fail('Error in test1:'+sLineBreak+
'Condition: '+CompliterMem^.condition.ToString+sLineBreak+
'Error Code: '+CompliterMem^.error_code.ToString);
if fasm_Assemble('add eax,0',CompliterMem,CompliterMemSize)<>FASM_OK then
writeln('Error in test2:'+sLineBreak+
'Condition: '+CompliterMem^.condition.ToString+sLineBreak+
'Error Code: '+CompliterMem^.error_code.ToString);
if fasm_AssembleFile('..\FasmDll\FASM.ASH',CompliterMem,CompliterMemSize)=FASM_OK then
Fail('Error in test3:'+sLineBreak+
'FASM is compiling something that it is can not compile at all.');
if fasm_Assemble('call -100',CompliterMem,CompliterMemSize)<>FASM_OK then
Fail('Error in test4:'+sLineBreak+
'Condition: '+CompliterMem^.condition.ToString+sLineBreak+
'Error Code: '+CompliterMem^.error_code.ToString);
end;
initialization
LoadFASM('..\FasmDll\FASM.DLL');
GetMem(CompliterMem,CompliterMemSize);
RegisterTest(TTestCase1);
end.