Skip to content

Commit

Permalink
ADD: primitive test
Browse files Browse the repository at this point in the history
  • Loading branch information
PascalCorpsman committed Dec 13, 2024
1 parent 288935e commit 4d7054e
Show file tree
Hide file tree
Showing 3 changed files with 161 additions and 0 deletions.
86 changes: 86 additions & 0 deletions test/fpcunitproject1.lpi
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="12"/>
<PathDelim Value="\"/>
<General>
<SessionStorage Value="InProjectDir"/>
<Title Value="fpcunitproject1"/>
<UseAppBundle Value="False"/>
<ResourceType Value="res"/>
</General>
<BuildModes>
<Item Name="Default" Default="True"/>
</BuildModes>
<PublishOptions>
<Version Value="2"/>
<UseFileFilters Value="True"/>
</PublishOptions>
<RunParams>
<FormatVersion Value="2"/>
</RunParams>
<RequiredPackages>
<Item>
<PackageName Value="LCLBase"/>
</Item>
<Item>
<PackageName Value="laztestinsight"/>
</Item>
<Item>
<PackageName Value="FCL"/>
</Item>
</RequiredPackages>
<Units>
<Unit>
<Filename Value="fpcunitproject1.lpr"/>
<IsPartOfProject Value="True"/>
</Unit>
<Unit>
<Filename Value="testcase1.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="TestCase1"/>
</Unit>
<Unit>
<Filename Value="..\usandtris.pas"/>
<IsPartOfProject Value="True"/>
</Unit>
<Unit>
<Filename Value="..\upieces.pas"/>
<IsPartOfProject Value="True"/>
</Unit>
<Unit>
<Filename Value="..\..\Sample\DatenSteuerung\ufifo.pas"/>
<IsPartOfProject Value="True"/>
</Unit>
<Unit>
<Filename Value="..\..\Sample\OpenGL\dglopengl.pas"/>
<IsPartOfProject Value="True"/>
</Unit>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<Target>
<Filename Value="fpcunitproject1"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<OtherUnitFiles Value="..;..\src;..\..\Sample\DatenSteuerung;..\..\Sample\OpenGL"/>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
</CompilerOptions>
<Debugging>
<Exceptions>
<Item>
<Name Value="EAbort"/>
</Item>
<Item>
<Name Value="ECodetoolError"/>
</Item>
<Item>
<Name Value="EFOpenError"/>
</Item>
</Exceptions>
</Debugging>
</CONFIG>
28 changes: 28 additions & 0 deletions test/fpcunitproject1.lpr
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
program fpcunitproject1;

{$mode objfpc}{$H+}

uses
Classes, consoletestrunner, testcase1;

type

{ TMyTestRunner }

TMyTestRunner = class(TTestRunner)
protected
// override the protected methods of TTestRunner to customize its behavior
end;

var
Application: TMyTestRunner;

begin
DefaultRunAllTests:=True;
DefaultFormat:=fPlainNoTiming;
Application := TMyTestRunner.Create(nil);
Application.Initialize;
Application.Title := 'FPCUnit Console test runner';
Application.Run;
Application.Free;
end.
47 changes: 47 additions & 0 deletions test/testcase1.pas
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
Unit TestCase1;

{$MODE objfpc}{$H+}

Interface

Uses
Classes, SysUtils, fpcunit, testutils, testregistry, usandtris;

Type

{ TTestCase1 }

TTestCase1 = Class(TTestCase)
protected
Procedure SetUp; override;
Procedure TearDown; override;
published
Procedure CanCreateInstance;
End;

Implementation

Procedure TTestCase1.CanCreateInstance;
Var
fDut: TSandTris;
Begin
fdut := TSandTris.Create();
AssertTrue('Can not create instance', assigned(fDut));
fdut.free;
End;

Procedure TTestCase1.SetUp;
Begin

End;

Procedure TTestCase1.TearDown;
Begin

End;

Initialization

RegisterTest(TTestCase1);
End.

0 comments on commit 4d7054e

Please sign in to comment.