1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
|
--
-- Copyright (c) 2009,
-- Reto Buerki, Adrian-Ken Rueegsegger
--
-- This file is part of Alog.
--
-- Alog is free software; you can redistribute it and/or modify
-- it under the terms of the GNU Lesser General Public License as published
-- by the Free Software Foundation; either version 2.1 of the License, or
-- (at your option) any later version.
--
-- Alog is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU Lesser General Public License for more details.
--
-- You should have received a copy of the GNU Lesser General Public License
-- along with Alog; if not, write to the Free Software
-- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
-- MA 02110-1301 USA
--
with Ada.Task_Identification;
with Ahven; use Ahven;
with Alog.Log_Request;
package body Log_Request_Tests is
use Alog;
-------------------------------------------------------------------------
procedure Initialize (T : in out Testcase) is
begin
T.Set_Name (Name => "Tests for log requests");
T.Add_Test_Routine
(Routine => Log_Request_Getter'Access,
Name => "log request getters");
end Initialize;
-------------------------------------------------------------------------
procedure Log_Request_Getter is
use Ada.Task_Identification;
Request : Log_Request.Instance;
Ref_ID : constant Task_Id := Current_Task;
Ref_Src : constant String := "Foo";
Ref_Msg : constant String := "Some log message";
begin
Assert (Condition => Request.Get_Caller_ID = Null_Task_Id,
Message => "Default ID not Null_Task_Id");
Assert (Condition => Request.Get_Log_Level = Info,
Message => "Default log level not INFO");
Assert (Condition => Request.Get_Message = "",
Message => "Default message not empty");
Request := Log_Request.Create (ID => Ref_ID,
Source => Ref_Src,
Level => Notice,
Message => Ref_Msg);
Assert (Condition => Request.Get_Caller_ID = Ref_ID,
Message => "Caller ID mismatch");
Assert (Condition => Request.Get_Source = Ref_Src,
Message => "Source mismatch");
Assert (Condition => Request.Get_Log_Level = Notice,
Message => "Log level mismatch");
Assert (Condition => Request.Get_Message = Ref_Msg,
Message => "Message mismatch");
end Log_Request_Getter;
end Log_Request_Tests;
|