PB03-023: Fix adalog tests

Change-Id: Ifeb3ccb8042c6f327b67b5c74e0aa70e6d7515d1
This commit is contained in:
Raphael Amiard
2016-11-10 10:55:50 +01:00
parent 659e452a7d
commit e25fc9e153
6 changed files with 17 additions and 8 deletions

View File

@@ -41,7 +41,7 @@ class Bind(AbstractExpression):
Bind(A, B, property)
"""
def __init__(self, from_expr, to_expr, conv_prop=None):
def __init__(self, from_expr, to_expr, conv_prop=None, eq_prop=None):
"""
:param AbstractExpression from_expr: An expression resolving to a
logical variable that is the source of the bind.

View File

@@ -2,11 +2,12 @@ with Adalog.Abstract_Relation; use Adalog.Abstract_Relation;
with Adalog.Main_Support; use Adalog.Main_Support;
package Support is
function Eq (A, B : Integer) return Boolean is (A = B);
type Dummy_Data is null record;
D : Dummy_Data;
No_Data : constant Dummy_Data := (null record);
function Transform (D : Dummy_Data; I : Integer) return Integer is (I ** 2);
package Bind is new Eq_Int.Raw_Custom_Bind (Dummy_Data, Transform);
package Bind is new Eq_Int.Raw_Custom_Bind (Dummy_Data, No_Data, Transform, Eq);
function Square (X, Y : Eq_Int.Refs.Raw_Var) return Relation
is (Bind.Create (X, Y, D));
is (Bind.Create (X, Y, No_Data));
end Support;

View File

@@ -2,9 +2,11 @@ with Adalog.Main_Support; use Adalog.Main_Support;
with Adalog.Predicates; use Adalog.Predicates;
package Support is
function Eq (A, B : Integer) return Boolean is (A = B);
type Dummy_Data is null record;
No_Data : constant Dummy_Data := (null record);
function Transform (D : Dummy_Data; I : Integer) return Integer is (I * 3);
package Bind is new Eq_Int.Raw_Custom_Bind (Dummy_Data, Transform);
package Bind is new Eq_Int.Raw_Custom_Bind (Dummy_Data, No_Data, Transform, Eq);
type Pred is null record;

View File

@@ -1,7 +1,9 @@
with Adalog.Main_Support; use Adalog.Main_Support;
package Support is
function Eq (A, B : Integer) return Boolean is (A = B);
type Dummy_Data is null record;
No_Data : constant Dummy_Data := (null record);
function Transform (D : Dummy_Data; I : Integer) return Integer is (I * 3);
package Bind is new Eq_Int.Raw_Custom_Bind (Dummy_Data, Transform);
package Bind is new Eq_Int.Raw_Custom_Bind (Dummy_Data, No_Data, Transform, Eq);
end Support;

View File

@@ -2,9 +2,11 @@ with Adalog.Main_Support; use Adalog.Main_Support;
with Adalog.Predicates; use Adalog.Predicates;
package Support is
function Eq (A, B : Integer) return Boolean is (A = B);
type Dummy_Data is null record;
No_Data : constant Dummy_Data := (null record);
function Transform (D : Dummy_Data; I : Integer) return Integer is (I * 3);
package Bind is new Eq_Int.Raw_Custom_Bind (Dummy_Data, Transform);
package Bind is new Eq_Int.Raw_Custom_Bind (Dummy_Data, No_Data, Transform, Eq);
type Pred is null record;
function Call (Self : Pred; L, R : Integer) return Boolean is (L = R * 2);

View File

@@ -1,7 +1,9 @@
with Adalog.Main_Support; use Adalog.Main_Support;
package Support is
function Eq (A, B : Integer) return Boolean is (A = B);
type Dummy_Data is null record;
No_Data : constant Dummy_Data := (null record);
function Transform (D : Dummy_Data; I : Integer) return Integer is (I * 3);
package Bind is new Eq_Int.Raw_Custom_Bind (Dummy_Data, Transform);
package Bind is new Eq_Int.Raw_Custom_Bind (Dummy_Data, No_Data, Transform, Eq);
end Support;