Skip to content
This repository has been archived by the owner on Aug 12, 2024. It is now read-only.

Commit

Permalink
Test reference counting
Browse files Browse the repository at this point in the history
ref #24
  • Loading branch information
jklmnn committed Dec 7, 2021
1 parent d1e7287 commit fc35ff2
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions tests/z3-tests.adb
Original file line number Diff line number Diff line change
Expand Up @@ -813,6 +813,46 @@ package body Z3.Tests is -- GCOV_EXCL_LINE

---------------------------------------------------------------------------

procedure Test_Reference_Counting (T : in out Test_Cases.Test_Case'Class)
is
pragma Unreferenced (T);
Context : Z3.Context;
Solver : constant Z3.Solver := Create (Context);
Optimize : constant Z3.Optimize := Create (Context);

procedure Copy_Ctx (Local_Ctx : Z3.Context)
is
Ctx2 : Z3.Context;
Solver : Z3.Solver := Create (Context);
Unused_Result : Result;
begin
Ctx2 := Local_Ctx;
pragma Inspection_Point (Ctx2);
Solver.Assert (Bool ("A", Context));
Unused_Result := Solver.Check;
end Copy_Ctx;
procedure Copy_Solver (Local_Solver : Z3.Solver)
is
Solver2 : Z3.Solver := Create (Context);
begin
Solver2 := Local_Solver;
pragma Inspection_Point (Solver2);
end Copy_Solver;
procedure Copy_Optimize (Local_Optimize : Z3.Optimize)
is
Optimize2 : Z3.Optimize := Create (Context);
begin
Optimize2 := Local_Optimize;
pragma Inspection_Point (Optimize2);
end Copy_Optimize;
begin
Copy_Ctx (Context);
Copy_Solver (Solver);
Copy_Optimize (Optimize);
end Test_Reference_Counting;

---------------------------------------------------------------------------

overriding
procedure Register_Tests (T : in out Test_Case)
is
Expand All @@ -838,6 +878,7 @@ package body Z3.Tests is -- GCOV_EXCL_LINE
Register_Routine (T, Test_Big_Int'Access, "Big Integer");
Register_Routine (T, Test_Logic'Access, "Logic");
Register_Routine (T, Test_Real'Access, "Real");
Register_Routine (T, Test_Reference_Counting'Access, "Reference Counting");
end Register_Tests;

---------------------------------------------------------------------------
Expand Down

0 comments on commit fc35ff2

Please sign in to comment.