Skip to content

Commit

Permalink
Remove unneeded connection checks from functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Jbsco committed Aug 15, 2024
1 parent b03cc12 commit 1ea9b42
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -398,10 +398,8 @@ package body Component.Parameters.Implementation is

-- OK, now we need to validate all the parameters.
for Idx in Self.Connector_Parameter_Update_T_Provide'Range loop
if Self.Is_Parameter_Update_T_Provide_Connected (Idx) then
if Self.Validate_Parameters (Component_Id => Idx) /= Success then
Status_To_Return := Parameter_Error;
end if;
if Self.Validate_Parameters (Component_Id => Idx) /= Success then
Status_To_Return := Parameter_Error;
end if;
end loop;

Expand Down Expand Up @@ -439,9 +437,7 @@ package body Component.Parameters.Implementation is

-- OK, now we need to update all the parameters.
for Idx in Self.Connector_Parameter_Update_T_Provide'Range loop
if Self.Is_Parameter_Update_T_Provide_Connected (Idx) then
Set_Status (Self.Update_Parameters (Component_Id => Idx));
end if;
Set_Status (Self.Update_Parameters (Component_Id => Idx));
end loop;

-- Send out a new parameter's packet if configured to do so:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ package body Parameters_Tests.Implementation is
overriding procedure Set_Up_Test (Self : in out Instance) is
begin
-- Allocate heap memory to component:
Self.Tester.Init_Base (Queue_Size => Self.Tester.Component_Instance.Get_Max_Queue_Element_Size * 3, Parameter_Update_T_Provide_Count => 4);
Self.Tester.Init_Base (Queue_Size => Self.Tester.Component_Instance.Get_Max_Queue_Element_Size * 3, Parameter_Update_T_Provide_Count => 3);

-- Make necessary connections between tester and component:
Self.Tester.Connect;
Expand Down Expand Up @@ -112,6 +112,11 @@ package body Parameters_Tests.Implementation is
[(Id => 2, Component_Id => 1, Start_Index => 0, End_Index => 3), (Id => 5, Component_Id => 3, Start_Index => 4, End_Index => 15), (Id => 1, Component_Id => 1, Start_Index => 16, End_Index => 17),
(Id => 3, Component_Id => 2, Start_Index => 18, End_Index => 19), (Id => 4, Component_Id => 4, Start_Index => 20, End_Index => 23)];
begin
Self.Tear_Down_Test;
Self.Tester.Init_Base (Queue_Size => Self.Tester.Component_Instance.Get_Max_Queue_Element_Size * 3, Parameter_Update_T_Provide_Count => 4);
Self.Tester.Connect;
-- Now run the test, which is to call component init with a custom parameter
-- table entry list that causes it to access index 4, which is unconnected.
T.Component_Instance.Init (Parameter_Table_Entries'Unchecked_Access, False);
Assert (False, "Unconnected Component Id init failed!");
exception
Expand Down

0 comments on commit 1ea9b42

Please sign in to comment.