Skip to content

Commit

Permalink
feat: Basic scaffolding for Message,Module
Browse files Browse the repository at this point in the history
Includes tests for the scaffolding
  • Loading branch information
gcarreno committed Sep 24, 2023
1 parent 034a521 commit ad8e75a
Show file tree
Hide file tree
Showing 10 changed files with 242 additions and 4 deletions.
20 changes: 20 additions & 0 deletions src/messages/polykerma.messages.interfaces.pas
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
unit PolyKerma.Messages.Interfaces;

{$mode objfpc}{$H+}

interface

uses
Classes
;

type
{ IMessage }
IMessage = Interface
['{62E0D2A6-6AEE-42DF-BADD-D210BA7A2BD1}']
end;

implementation

end.

40 changes: 40 additions & 0 deletions src/messages/polykerma.messages.message.pas
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
unit PolyKerma.Messages.Message;

{$mode objfpc}{$H+}

interface

uses
Classes
, PolyKerma.Messages.Interfaces
;

type
{ TMessage }
TMessage = class(TInterfacedObject, IMessage)
private
protected
public
constructor Create;
destructor Destroy; override;

published
end;

implementation

{ TDispatcher }

constructor TMessage.Create;
begin

end;

destructor TMessage.Destroy;
begin
inherited Destroy;
end;

end.


Empty file.
21 changes: 21 additions & 0 deletions src/modules/polykerma.modules.interfaces.pas
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
unit PolyKerma.Modules.Interfaces;

{$mode objfpc}{$H+}

interface

uses
Classes
;

type
{ IModule }
IModule = Interface
['{3D802B56-58A0-4E9C-97D9-8602B52EF731}']
end;

implementation

end.


41 changes: 41 additions & 0 deletions src/modules/polykerma.modules.module.pas
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
unit PolyKerma.Modules.Module;

{$mode objfpc}{$H+}

interface

uses
Classes
, PolyKerma.Modules.Interfaces
;

type
{ TModule }
TModule = class(TInterfacedObject, IModule)
private
protected
public
constructor Create;
destructor Destroy; override;

published
end;

implementation

{ TDispatcher }

constructor TModule.Create;
begin

end;

destructor TModule.Destroy;
begin
inherited Destroy;
end;

end.



4 changes: 2 additions & 2 deletions tests/dispatcher/polykerma.test.dispatcher.pas
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ TTestDispatcher= class(TTestCase)
protected
public
published
procedure TestDispatherCreate;
procedure TestDispatcherCreate;
end;

implementation

procedure TTestDispatcher.TestDispatherCreate;
procedure TTestDispatcher.TestDispatcherCreate;
begin
FDispatcher:= TDispatcher.Create;
AssertNotNull('Dispatcher not null', FDispatcher);
Expand Down
42 changes: 42 additions & 0 deletions tests/messages/polykerma.test.messages.pas
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
unit PolyKerma.Test.Messages;

{$mode objfpc}{$H+}

interface

uses
Classes
, SysUtils
, fpcunit
//, testutils
, testregistry
, PolyKerma.Messages.Interfaces
, PolyKerma.Messages.Message
;

type

TTestMessages= class(TTestCase)
private
FMessage: IMessage;
protected
public
published
procedure TestMessageCreate;
end;

implementation

procedure TTestMessages.TestMessageCreate;
begin
FMessage:= TMessage.Create;
AssertNotNull('Message not null', FMessage);
end;



initialization

RegisterTest(TTestMessages);
end.

42 changes: 42 additions & 0 deletions tests/modules/polykerma.test.module.pas
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
unit PolyKerma.Test.Module;

{$mode objfpc}{$H+}

interface

uses
Classes
, SysUtils
, fpcunit
//, testutils
, testregistry
, PolyKerma.Modules.Interfaces
, PolyKerma.Modules.Module
;

type

TTestModule= class(TTestCase)
private
FModule: IModule;
protected
public
published
procedure TestModuleCreate;
end;

implementation

procedure TTestModule.TestModuleCreate;
begin
FModule:= TModule.Create;
AssertNotNull('Module not null', FModule);
end;



initialization

RegisterTest(TTestModule);
end.

34 changes: 32 additions & 2 deletions tests/polykermatests.lpi
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<PackageName Value="FCL"/>
</Item1>
</RequiredPackages>
<Units Count="4">
<Units Count="10">
<Unit0>
<Filename Value="polykermatests.lpr"/>
<IsPartOfProject Value="True"/>
Expand All @@ -50,6 +50,36 @@
<IsPartOfProject Value="True"/>
<UnitName Value="PolyKerma.Dispatcher"/>
</Unit3>
<Unit4>
<Filename Value="messages/polykerma.test.messages.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="PolyKerma.Test.Messages"/>
</Unit4>
<Unit5>
<Filename Value="../src/messages/polykerma.messages.interfaces.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="PolyKerma.Messages.Interfaces"/>
</Unit5>
<Unit6>
<Filename Value="../src/messages/polykerma.messages.message.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="PolyKerma.Messages.Message"/>
</Unit6>
<Unit7>
<Filename Value="modules/polykerma.test.module.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="PolyKerma.Test.Module"/>
</Unit7>
<Unit8>
<Filename Value="../src/modules/polykerma.modules.interfaces.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="PolyKerma.Modules.Interfaces"/>
</Unit8>
<Unit9>
<Filename Value="../src/modules/polykerma.modules.module.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="PolyKerma.Modules.Module"/>
</Unit9>
</Units>
</ProjectOptions>
<CompilerOptions>
Expand All @@ -59,7 +89,7 @@
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<OtherUnitFiles Value="dispatcher;../src/dispatcher"/>
<OtherUnitFiles Value="dispatcher;../src/dispatcher;messages;../src/messages;modules;../src/modules"/>
<UnitOutputDirectory Value="../bin/lib/$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
</CompilerOptions>
Expand Down
2 changes: 2 additions & 0 deletions tests/polykermatests.lpr
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
Classes
, consoletestrunner
, PolyKerma.Test.Dispatcher
, PolyKerma.Test.Messages
, PolyKerma.Test.Module
;

type
Expand Down

0 comments on commit ad8e75a

Please sign in to comment.