-- C940005.A
|
-- C940005.A
|
--
|
--
|
-- Grant of Unlimited Rights
|
-- Grant of Unlimited Rights
|
--
|
--
|
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
|
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
|
-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
|
-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
|
-- unlimited rights in the software and documentation contained herein.
|
-- unlimited rights in the software and documentation contained herein.
|
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
|
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
|
-- this public release, the Government intends to confer upon all
|
-- this public release, the Government intends to confer upon all
|
-- recipients unlimited rights equal to those held by the Government.
|
-- recipients unlimited rights equal to those held by the Government.
|
-- These rights include rights to use, duplicate, release or disclose the
|
-- These rights include rights to use, duplicate, release or disclose the
|
-- released technical data and computer software in whole or in part, in
|
-- released technical data and computer software in whole or in part, in
|
-- any manner and for any purpose whatsoever, and to have or permit others
|
-- any manner and for any purpose whatsoever, and to have or permit others
|
-- to do so.
|
-- to do so.
|
--
|
--
|
-- DISCLAIMER
|
-- DISCLAIMER
|
--
|
--
|
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
|
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
|
-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
|
-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
|
-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
|
-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
|
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
|
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
|
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
|
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
|
-- PARTICULAR PURPOSE OF SAID MATERIAL.
|
-- PARTICULAR PURPOSE OF SAID MATERIAL.
|
--*
|
--*
|
--
|
--
|
-- OBJECTIVE:
|
-- OBJECTIVE:
|
-- Check that the body of a protected function can have internal calls
|
-- Check that the body of a protected function can have internal calls
|
-- to other protected functions and that the body of a protected
|
-- to other protected functions and that the body of a protected
|
-- procedure can have internal calls to protected procedures and to
|
-- procedure can have internal calls to protected procedures and to
|
-- protected functions.
|
-- protected functions.
|
--
|
--
|
-- TEST DESCRIPTION:
|
-- TEST DESCRIPTION:
|
-- Simulate a meter at a freeway on-ramp which, when real-time sensors
|
-- Simulate a meter at a freeway on-ramp which, when real-time sensors
|
-- determine that the freeway is becoming saturated, triggers stop lights
|
-- determine that the freeway is becoming saturated, triggers stop lights
|
-- which control the access of vehicles to prevent further saturation.
|
-- which control the access of vehicles to prevent further saturation.
|
-- Each on-ramp is represented by a protected object - in this case only
|
-- Each on-ramp is represented by a protected object - in this case only
|
-- one is shown (Test_Ramp). The routines to sample and alter the states
|
-- one is shown (Test_Ramp). The routines to sample and alter the states
|
-- of the various sensors, to queue the vehicles on the meter and to
|
-- of the various sensors, to queue the vehicles on the meter and to
|
-- release them are all part of the protected object and can be shared
|
-- release them are all part of the protected object and can be shared
|
-- by various tasks. Apart from the function/procedure tests this example
|
-- by various tasks. Apart from the function/procedure tests this example
|
-- has a mix of other tasking features.
|
-- has a mix of other tasking features.
|
--
|
--
|
--
|
--
|
-- CHANGE HISTORY:
|
-- CHANGE HISTORY:
|
-- 06 Dec 94 SAIC ACVC 2.0
|
-- 06 Dec 94 SAIC ACVC 2.0
|
-- 13 Nov 95 SAIC Updated and fixed bugs ACVC 2.0.1
|
-- 13 Nov 95 SAIC Updated and fixed bugs ACVC 2.0.1
|
--
|
--
|
--!
|
--!
|
|
|
|
|
with Report;
|
with Report;
|
with ImpDef;
|
with ImpDef;
|
with Ada.Calendar;
|
with Ada.Calendar;
|
|
|
procedure C940005 is
|
procedure C940005 is
|
|
|
begin
|
begin
|
|
|
Report.Test ("C940005", "Check internal calls of protected functions" &
|
Report.Test ("C940005", "Check internal calls of protected functions" &
|
" and procedures");
|
" and procedures");
|
|
|
declare -- encapsulate the test
|
declare -- encapsulate the test
|
|
|
function "+" (Left : Ada.Calendar.Time; Right: Duration)
|
function "+" (Left : Ada.Calendar.Time; Right: Duration)
|
return Ada.Calendar.Time renames Ada.Calendar."+";
|
return Ada.Calendar.Time renames Ada.Calendar."+";
|
|
|
-- Weighted load given to each potential problem area and accumulated
|
-- Weighted load given to each potential problem area and accumulated
|
type Load_Factor is range 0..8;
|
type Load_Factor is range 0..8;
|
Clear_Level : constant Load_Factor := 0;
|
Clear_Level : constant Load_Factor := 0;
|
Minimum_Level : constant Load_Factor := 1;
|
Minimum_Level : constant Load_Factor := 1;
|
Moderate_Level : constant Load_Factor := 2;
|
Moderate_Level : constant Load_Factor := 2;
|
Serious_Level : constant Load_Factor := 4;
|
Serious_Level : constant Load_Factor := 4;
|
Critical_Level : constant Load_Factor := 6;
|
Critical_Level : constant Load_Factor := 6;
|
|
|
-- Weighted loads given to each Sample Point (pure weights, not levels)
|
-- Weighted loads given to each Sample Point (pure weights, not levels)
|
Local_Overload_wt : constant Load_Factor := 1;
|
Local_Overload_wt : constant Load_Factor := 1;
|
Next_Ramp_in_Overload_wt : constant Load_Factor := 1;
|
Next_Ramp_in_Overload_wt : constant Load_Factor := 1;
|
Ramp_Junction_in_Overload_wt : constant Load_Factor :=2; --higher wght
|
Ramp_Junction_in_Overload_wt : constant Load_Factor :=2; --higher wght
|
-- :::: other weighted loads
|
-- :::: other weighted loads
|
|
|
TC_Multiplier : integer := 1; -- changed half way through
|
TC_Multiplier : integer := 1; -- changed half way through
|
TC_Expected_Passage_Total : constant integer := 486;
|
TC_Expected_Passage_Total : constant integer := 486;
|
|
|
-- This is the time between synchronizing pulses to the ramps.
|
-- This is the time between synchronizing pulses to the ramps.
|
-- In reality one would expect a time of 5 to 10 seconds. In
|
-- In reality one would expect a time of 5 to 10 seconds. In
|
-- the interests of speeding up the test suite a shorter time
|
-- the interests of speeding up the test suite a shorter time
|
-- is used
|
-- is used
|
Pulse_Time_Delta : constant duration := ImpDef.Switch_To_New_Task;
|
Pulse_Time_Delta : constant duration := ImpDef.Switch_To_New_Task;
|
|
|
-- control over stopping tasks
|
-- control over stopping tasks
|
protected Control is
|
protected Control is
|
procedure Stop_Now;
|
procedure Stop_Now;
|
function Stop return Boolean;
|
function Stop return Boolean;
|
private
|
private
|
Halt : Boolean := False;
|
Halt : Boolean := False;
|
end Control;
|
end Control;
|
|
|
protected body Control is
|
protected body Control is
|
procedure Stop_Now is
|
procedure Stop_Now is
|
begin
|
begin
|
Halt := True;
|
Halt := True;
|
end Stop_Now;
|
end Stop_Now;
|
|
|
function Stop return Boolean is
|
function Stop return Boolean is
|
begin
|
begin
|
return Halt;
|
return Halt;
|
end Stop;
|
end Stop;
|
end Control;
|
end Control;
|
|
|
task Pulse_Task; -- task to generate a pulse for each ramp
|
task Pulse_Task; -- task to generate a pulse for each ramp
|
|
|
-- Carrier task. One is created for each vehicle arriving at the ramp
|
-- Carrier task. One is created for each vehicle arriving at the ramp
|
task type Vehicle;
|
task type Vehicle;
|
type acc_Vehicle is access Vehicle;
|
type acc_Vehicle is access Vehicle;
|
|
|
--================================================================
|
--================================================================
|
protected Test_Ramp is
|
protected Test_Ramp is
|
function Next_Ramp_in_Overload return Load_Factor;
|
function Next_Ramp_in_Overload return Load_Factor;
|
function Local_Overload return Load_Factor;
|
function Local_Overload return Load_Factor;
|
function Freeway_Overload return Load_Factor;
|
function Freeway_Overload return Load_Factor;
|
function Freeway_Breakdown return Boolean;
|
function Freeway_Breakdown return Boolean;
|
function Meter_in_use_State return Boolean;
|
function Meter_in_use_State return Boolean;
|
procedure Set_Local_Overload;
|
procedure Set_Local_Overload;
|
procedure Add_Meter_Queue;
|
procedure Add_Meter_Queue;
|
procedure Subtract_Meter_Queue;
|
procedure Subtract_Meter_Queue;
|
procedure Time_Pulse_Received;
|
procedure Time_Pulse_Received;
|
entry Wait_at_Meter;
|
entry Wait_at_Meter;
|
procedure TC_Passage (Pass_Point : Integer);
|
procedure TC_Passage (Pass_Point : Integer);
|
function TC_Get_Passage_Total return integer;
|
function TC_Get_Passage_Total return integer;
|
-- ::::::::: many routines are not shown (for example none of the
|
-- ::::::::: many routines are not shown (for example none of the
|
-- clears, none of the real-time-sensor handlers)
|
-- clears, none of the real-time-sensor handlers)
|
|
|
private
|
private
|
|
|
Release_One_Vehicle : Boolean := false;
|
Release_One_Vehicle : Boolean := false;
|
Meter_in_Use : Boolean := false;
|
Meter_in_Use : Boolean := false;
|
Fwy_Break_State : Boolean := false;
|
Fwy_Break_State : Boolean := false;
|
|
|
|
|
Ramp_Count : integer range 0..20 := 0;
|
Ramp_Count : integer range 0..20 := 0;
|
Ramp_Count_Threshold : integer := 15;
|
Ramp_Count_Threshold : integer := 15;
|
|
|
-- Current state of the various Sample Points
|
-- Current state of the various Sample Points
|
Local_State : Load_Factor := Clear_Level;
|
Local_State : Load_Factor := Clear_Level;
|
Next_Ramp_State : Load_Factor := Clear_Level;
|
Next_Ramp_State : Load_Factor := Clear_Level;
|
-- :::: other Sample Point states not shown
|
-- :::: other Sample Point states not shown
|
|
|
TC_Passage_Total : integer := 0;
|
TC_Passage_Total : integer := 0;
|
end Test_Ramp;
|
end Test_Ramp;
|
--================================================================
|
--================================================================
|
protected body Test_Ramp is
|
protected body Test_Ramp is
|
|
|
procedure Start_Meter is
|
procedure Start_Meter is
|
begin
|
begin
|
Meter_in_Use := True;
|
Meter_in_Use := True;
|
null; -- stub :::: trigger the metering hardware
|
null; -- stub :::: trigger the metering hardware
|
end Start_Meter;
|
end Start_Meter;
|
|
|
-- External call for Meter_in_Use
|
-- External call for Meter_in_Use
|
function Meter_in_Use_State return Boolean is
|
function Meter_in_Use_State return Boolean is
|
begin
|
begin
|
return Meter_in_Use;
|
return Meter_in_Use;
|
end Meter_in_Use_State;
|
end Meter_in_Use_State;
|
|
|
-- Trace the paths through the various routines by totaling the
|
-- Trace the paths through the various routines by totaling the
|
-- weighted call parameters
|
-- weighted call parameters
|
procedure TC_Passage (Pass_Point : Integer) is
|
procedure TC_Passage (Pass_Point : Integer) is
|
begin
|
begin
|
TC_Passage_Total := TC_Passage_Total+(Pass_Point*TC_Multiplier);
|
TC_Passage_Total := TC_Passage_Total+(Pass_Point*TC_Multiplier);
|
end TC_Passage;
|
end TC_Passage;
|
|
|
-- For the final check of the whole test
|
-- For the final check of the whole test
|
function TC_Get_Passage_Total return integer is
|
function TC_Get_Passage_Total return integer is
|
begin
|
begin
|
return TC_Passage_Total;
|
return TC_Passage_Total;
|
end TC_Get_Passage_Total;
|
end TC_Get_Passage_Total;
|
|
|
-- These Set/Clear routines are triggered by real-time sensors that
|
-- These Set/Clear routines are triggered by real-time sensors that
|
-- reflect traffic state
|
-- reflect traffic state
|
procedure Set_Local_Overload is
|
procedure Set_Local_Overload is
|
begin
|
begin
|
Local_State := Local_Overload_wt;
|
Local_State := Local_Overload_wt;
|
if not Meter_in_Use then
|
if not Meter_in_Use then
|
Start_Meter; -- LOCAL INTERNAL PROCEDURE FROM PROCEDURE
|
Start_Meter; -- LOCAL INTERNAL PROCEDURE FROM PROCEDURE
|
end if;
|
end if;
|
end Set_Local_Overload;
|
end Set_Local_Overload;
|
|
|
--::::: Set/Clear routines for all the other sensors not shown
|
--::::: Set/Clear routines for all the other sensors not shown
|
|
|
function Local_Overload return Load_Factor is
|
function Local_Overload return Load_Factor is
|
begin
|
begin
|
return Local_State;
|
return Local_State;
|
end Local_Overload;
|
end Local_Overload;
|
|
|
function Next_Ramp_in_Overload return Load_Factor is
|
function Next_Ramp_in_Overload return Load_Factor is
|
begin
|
begin
|
return Next_Ramp_State;
|
return Next_Ramp_State;
|
end Next_Ramp_in_Overload;
|
end Next_Ramp_in_Overload;
|
|
|
-- :::::::: other overload factor states not shown
|
-- :::::::: other overload factor states not shown
|
|
|
-- return the summation of all the load factors
|
-- return the summation of all the load factors
|
function Freeway_Overload return Load_Factor is
|
function Freeway_Overload return Load_Factor is
|
begin
|
begin
|
return Local_Overload -- EACH IS A CALL OF A
|
return Local_Overload -- EACH IS A CALL OF A
|
-- + :::: others -- FUNCTION FROM WITHIN
|
-- + :::: others -- FUNCTION FROM WITHIN
|
+ Next_Ramp_in_Overload; -- A FUNCTION
|
+ Next_Ramp_in_Overload; -- A FUNCTION
|
end Freeway_Overload;
|
end Freeway_Overload;
|
|
|
-- Freeway Breakdown is defined as traffic moving < 5mph
|
-- Freeway Breakdown is defined as traffic moving < 5mph
|
function Freeway_Breakdown return Boolean is
|
function Freeway_Breakdown return Boolean is
|
begin
|
begin
|
return Fwy_Break_State;
|
return Fwy_Break_State;
|
end Freeway_Breakdown;
|
end Freeway_Breakdown;
|
|
|
-- Keep count of vehicles currently on meter queue - we can't use
|
-- Keep count of vehicles currently on meter queue - we can't use
|
-- the 'count because we need the outcall trigger
|
-- the 'count because we need the outcall trigger
|
procedure Add_Meter_Queue is
|
procedure Add_Meter_Queue is
|
TC_Pass_Point : constant integer := 22;
|
TC_Pass_Point : constant integer := 22;
|
begin
|
begin
|
Ramp_Count := Ramp_Count + 1;
|
Ramp_Count := Ramp_Count + 1;
|
TC_Passage ( TC_Pass_Point ); -- note passage through here
|
TC_Passage ( TC_Pass_Point ); -- note passage through here
|
if Ramp_Count > Ramp_Count_Threshold then
|
if Ramp_Count > Ramp_Count_Threshold then
|
null; -- :::: stub, trigger surface street notification
|
null; -- :::: stub, trigger surface street notification
|
end if;
|
end if;
|
end Add_Meter_Queue;
|
end Add_Meter_Queue;
|
--
|
--
|
procedure Subtract_Meter_Queue is
|
procedure Subtract_Meter_Queue is
|
TC_Pass_Point : constant integer := 24;
|
TC_Pass_Point : constant integer := 24;
|
begin
|
begin
|
Ramp_Count := Ramp_Count - 1;
|
Ramp_Count := Ramp_Count - 1;
|
TC_Passage ( TC_Pass_Point ); -- note passage through here
|
TC_Passage ( TC_Pass_Point ); -- note passage through here
|
end Subtract_Meter_Queue;
|
end Subtract_Meter_Queue;
|
|
|
-- Here each Vehicle task queues itself awaiting release
|
-- Here each Vehicle task queues itself awaiting release
|
entry Wait_at_Meter when Release_One_Vehicle is
|
entry Wait_at_Meter when Release_One_Vehicle is
|
-- EXAMPLE OF ENTRY WITH BARRIERS AND PERSISTENT SIGNAL
|
-- EXAMPLE OF ENTRY WITH BARRIERS AND PERSISTENT SIGNAL
|
TC_Pass_Point : constant integer := 23;
|
TC_Pass_Point : constant integer := 23;
|
begin
|
begin
|
TC_Passage ( TC_Pass_Point ); -- note passage through here
|
TC_Passage ( TC_Pass_Point ); -- note passage through here
|
Release_One_Vehicle := false; -- Consume the signal
|
Release_One_Vehicle := false; -- Consume the signal
|
-- Decrement number of vehicles on ramp
|
-- Decrement number of vehicles on ramp
|
Subtract_Meter_Queue; -- CALL PROCEDURE FROM WITHIN ENTRY BODY
|
Subtract_Meter_Queue; -- CALL PROCEDURE FROM WITHIN ENTRY BODY
|
end Wait_at_Meter;
|
end Wait_at_Meter;
|
|
|
|
|
procedure Time_Pulse_Received is
|
procedure Time_Pulse_Received is
|
Load : Load_factor := Freeway_Overload; -- CALL MULTILEVEL
|
Load : Load_factor := Freeway_Overload; -- CALL MULTILEVEL
|
-- FUNCTION
|
-- FUNCTION
|
-- FROM WITHIN PROCEDURE
|
-- FROM WITHIN PROCEDURE
|
begin
|
begin
|
-- if broken down, no vehicles are released
|
-- if broken down, no vehicles are released
|
if not Freeway_Breakdown then -- CALL FUNCTION FROM A PROCEDURE
|
if not Freeway_Breakdown then -- CALL FUNCTION FROM A PROCEDURE
|
if Load < Moderate_Level then
|
if Load < Moderate_Level then
|
Release_One_Vehicle := true;
|
Release_One_Vehicle := true;
|
end if;
|
end if;
|
null; -- stub ::: If other levels, release every other
|
null; -- stub ::: If other levels, release every other
|
-- pulse, every third pulse etc.
|
-- pulse, every third pulse etc.
|
end if;
|
end if;
|
end Time_Pulse_Received;
|
end Time_Pulse_Received;
|
|
|
end Test_Ramp;
|
end Test_Ramp;
|
--================================================================
|
--================================================================
|
|
|
|
|
-- Simulate the arrival of a vehicle at the Ramp_Receiver and the
|
-- Simulate the arrival of a vehicle at the Ramp_Receiver and the
|
-- generation of an accompanying carrier task
|
-- generation of an accompanying carrier task
|
procedure New_Arrival is
|
procedure New_Arrival is
|
Next_Vehicle_Task: acc_Vehicle := new Vehicle;
|
Next_Vehicle_Task: acc_Vehicle := new Vehicle;
|
TC_Pass_Point : constant integer := 3;
|
TC_Pass_Point : constant integer := 3;
|
begin
|
begin
|
Test_Ramp.TC_Passage ( TC_Pass_Point ); -- Note passage through here
|
Test_Ramp.TC_Passage ( TC_Pass_Point ); -- Note passage through here
|
null;
|
null;
|
end New_arrival;
|
end New_arrival;
|
|
|
|
|
-- Carrier task. One is created for each vehicle arriving at the ramp
|
-- Carrier task. One is created for each vehicle arriving at the ramp
|
task body Vehicle is
|
task body Vehicle is
|
TC_Pass_point : constant integer := 1;
|
TC_Pass_point : constant integer := 1;
|
TC_Pass_Point_2 : constant integer := 21;
|
TC_Pass_Point_2 : constant integer := 21;
|
TC_Pass_Point_3 : constant integer := 2;
|
TC_Pass_Point_3 : constant integer := 2;
|
begin
|
begin
|
Test_Ramp.TC_Passage ( TC_Pass_Point ); -- note passage through here
|
Test_Ramp.TC_Passage ( TC_Pass_Point ); -- note passage through here
|
if Test_Ramp.Meter_in_Use_State then
|
if Test_Ramp.Meter_in_Use_State then
|
Test_Ramp.TC_Passage ( TC_Pass_Point_2 ); -- note passage
|
Test_Ramp.TC_Passage ( TC_Pass_Point_2 ); -- note passage
|
-- Increment count of number of vehicles on ramp
|
-- Increment count of number of vehicles on ramp
|
Test_Ramp.Add_Meter_Queue; -- CALL a protected PROCEDURE
|
Test_Ramp.Add_Meter_Queue; -- CALL a protected PROCEDURE
|
-- which is also called from within
|
-- which is also called from within
|
-- enter the meter queue
|
-- enter the meter queue
|
Test_Ramp.Wait_at_Meter; -- CALL a protected ENTRY
|
Test_Ramp.Wait_at_Meter; -- CALL a protected ENTRY
|
end if;
|
end if;
|
Test_Ramp.TC_Passage ( TC_Pass_Point_3 ); -- note passage thru here
|
Test_Ramp.TC_Passage ( TC_Pass_Point_3 ); -- note passage thru here
|
null; --:::: call to the first in the series of the Ramp_Sensors
|
null; --:::: call to the first in the series of the Ramp_Sensors
|
-- this "passes" the vehicle from one sensor to the next
|
-- this "passes" the vehicle from one sensor to the next
|
exception
|
exception
|
when others =>
|
when others =>
|
Report.Failed ("Unexpected exception in Vehicle Task");
|
Report.Failed ("Unexpected exception in Vehicle Task");
|
end Vehicle;
|
end Vehicle;
|
|
|
|
|
-- Task transmits a synchronizing "pulse" to all ramps
|
-- Task transmits a synchronizing "pulse" to all ramps
|
--
|
--
|
task body Pulse_Task is
|
task body Pulse_Task is
|
Pulse_Time : Ada.Calendar.Time := Ada.Calendar.Clock;
|
Pulse_Time : Ada.Calendar.Time := Ada.Calendar.Clock;
|
begin
|
begin
|
While not Control.Stop loop
|
While not Control.Stop loop
|
delay until Pulse_Time;
|
delay until Pulse_Time;
|
Test_Ramp.Time_Pulse_Received; -- causes INTERNAL CALLS
|
Test_Ramp.Time_Pulse_Received; -- causes INTERNAL CALLS
|
-- :::::::::: and to all the others
|
-- :::::::::: and to all the others
|
Pulse_Time := Pulse_Time + Pulse_Time_Delta; -- calculate next
|
Pulse_Time := Pulse_Time + Pulse_Time_Delta; -- calculate next
|
end loop;
|
end loop;
|
exception
|
exception
|
when others =>
|
when others =>
|
Report.Failed ("Unexpected exception in Pulse_Task");
|
Report.Failed ("Unexpected exception in Pulse_Task");
|
end Pulse_Task;
|
end Pulse_Task;
|
|
|
|
|
begin -- declare
|
begin -- declare
|
|
|
-- Test driver. This is ALL test control code
|
-- Test driver. This is ALL test control code
|
|
|
-- First simulate calls to the protected functions and procedures
|
-- First simulate calls to the protected functions and procedures
|
-- from without the protected object
|
-- from without the protected object
|
--
|
--
|
-- CALL FUNCTIONS
|
-- CALL FUNCTIONS
|
if Test_Ramp.Local_Overload /= Clear_Level then
|
if Test_Ramp.Local_Overload /= Clear_Level then
|
Report.Failed ("External Call to Local_Overload incorrect");
|
Report.Failed ("External Call to Local_Overload incorrect");
|
end if;
|
end if;
|
if Test_Ramp.Next_Ramp_in_Overload /= Clear_Level then
|
if Test_Ramp.Next_Ramp_in_Overload /= Clear_Level then
|
Report.Failed ("External Call to Next_Ramp_in_Overload incorrect");
|
Report.Failed ("External Call to Next_Ramp_in_Overload incorrect");
|
end if;
|
end if;
|
if Test_Ramp.Freeway_Overload /= Clear_Level then
|
if Test_Ramp.Freeway_Overload /= Clear_Level then
|
Report.Failed ("External Call to Freeway_Overload incorrect");
|
Report.Failed ("External Call to Freeway_Overload incorrect");
|
end if;
|
end if;
|
|
|
-- Now Simulate the arrival of a vehicle to verify path through test
|
-- Now Simulate the arrival of a vehicle to verify path through test
|
New_Arrival;
|
New_Arrival;
|
delay Pulse_Time_Delta*2; -- allow it to pass through the complex
|
delay Pulse_Time_Delta*2; -- allow it to pass through the complex
|
|
|
TC_Multiplier := 5; -- change the weights for the paths for the next
|
TC_Multiplier := 5; -- change the weights for the paths for the next
|
-- part of the test
|
-- part of the test
|
|
|
-- Simulate a real-time sensor reporting overload
|
-- Simulate a real-time sensor reporting overload
|
Test_Ramp.Set_Local_Overload; -- CALL A PROCEDURE (and change levels)
|
Test_Ramp.Set_Local_Overload; -- CALL A PROCEDURE (and change levels)
|
|
|
-- CALL FUNCTIONS again
|
-- CALL FUNCTIONS again
|
if Test_Ramp.Local_Overload /= Minimum_Level then
|
if Test_Ramp.Local_Overload /= Minimum_Level then
|
Report.Failed ("External Call to Local_Overload incorrect - 2");
|
Report.Failed ("External Call to Local_Overload incorrect - 2");
|
end if;
|
end if;
|
if Test_Ramp.Freeway_Overload /= Minimum_Level then
|
if Test_Ramp.Freeway_Overload /= Minimum_Level then
|
Report.Failed ("External Call to Freeway_Overload incorrect -2");
|
Report.Failed ("External Call to Freeway_Overload incorrect -2");
|
end if;
|
end if;
|
|
|
-- Now Simulate the arrival of another vehicle again causing
|
-- Now Simulate the arrival of another vehicle again causing
|
-- INTERNAL CALLS but following different paths (queuing on the
|
-- INTERNAL CALLS but following different paths (queuing on the
|
-- meter etc.)
|
-- meter etc.)
|
New_Arrival;
|
New_Arrival;
|
delay Pulse_Time_Delta*2; -- allow it to pass through the complex
|
delay Pulse_Time_Delta*2; -- allow it to pass through the complex
|
|
|
Control.Stop_Now; -- finish test
|
Control.Stop_Now; -- finish test
|
|
|
if TC_Expected_Passage_Total /= Test_Ramp.TC_Get_Passage_Total then
|
if TC_Expected_Passage_Total /= Test_Ramp.TC_Get_Passage_Total then
|
Report.Failed ("Unexpected paths taken");
|
Report.Failed ("Unexpected paths taken");
|
end if;
|
end if;
|
|
|
end; -- declare
|
end; -- declare
|
|
|
Report.Result;
|
Report.Result;
|
|
|
end C940005;
|
end C940005;
|
|
|