Skip to content
This repository was archived by the owner on May 22, 2023. It is now read-only.

Commit 06eb7a8

Browse files
committed
prove block client test
ref #80
1 parent 5a1e244 commit 06eb7a8

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

test/block_client/component.adb

+13-8
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,15 @@ is
5252
Read_State : State := (others => -1);
5353

5454
function State_Finished (S : State) return Boolean is
55-
(S.Sent = Request_Count and S.Acked = Request_Count);
55+
(S.Acked >= Request_Count);
5656

5757
procedure Single (S : in out State;
5858
Operation : Block.Request_Kind) with
5959
Pre => Block_Client.Initialized (Client)
60-
and Componolit.Interfaces.Log.Client.Initialized (Log)
61-
and Operation in Block.Read .. Block.Write,
60+
and then Componolit.Interfaces.Log.Client.Initialized (Log)
61+
and then Operation in Block.Read .. Block.Write,
6262
Post => Block_Client.Initialized (Client)
63-
and Componolit.Interfaces.Log.Client.Initialized (Log);
63+
and then Componolit.Interfaces.Log.Client.Initialized (Log);
6464

6565
procedure Write (C : Block.Client_Instance;
6666
R : Request_Id;
@@ -75,15 +75,17 @@ is
7575
procedure Single (S : in out State;
7676
Operation : Block.Request_Kind)
7777
is
78+
use type Block_Client.Result;
7879
Block_Size : constant Block.Size := Block_Client.Block_Size (Client);
7980
Result : Block_Client.Result;
8081
begin
81-
if
82-
Block_Size <= 4096 and Block_Size >= 256
83-
then
82+
if Block_Size <= 4096 and Block_Size >= 256 then
8483
for I in Request_Cache'Range loop
8584

86-
if Block_Client.Status (Request_Cache (I)) = Block.Pending then
85+
if
86+
S.Acked < Request_Count
87+
and then Block_Client.Status (Request_Cache (I)) = Block.Pending
88+
then
8789
Block_Client.Update_Request (Client, Request_Cache (I));
8890
if Block_Client.Status (Request_Cache (I)) = Block.Ok then
8991
case Block_Client.Kind (Request_Cache (I)) is
@@ -128,6 +130,9 @@ is
128130
Main.Vacate (P_Cap, Main.Failure);
129131
end case;
130132
end if;
133+
134+
pragma Loop_Invariant (Block_Client.Initialized (Client));
135+
pragma Loop_Invariant (Componolit.Interfaces.Log.Client.Initialized (Log));
131136
end loop;
132137
Block_Client.Submit (Client);
133138
else

0 commit comments

Comments
 (0)