From 184fd46bc41251a0be2326091d477da78b76e1ba Mon Sep 17 00:00:00 2001 From: Maria Guerra Date: Tue, 21 May 2024 10:31:42 +0100 Subject: [PATCH] Fix or_component.py tests. --- claasp/components/or_component.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/claasp/components/or_component.py b/claasp/components/or_component.py index 372130df..8a739614 100644 --- a/claasp/components/or_component.py +++ b/claasp/components/or_component.py @@ -173,14 +173,18 @@ def cp_xor_linear_mask_propagation_constraints(self, model): sage: gift = GiftPermutation() sage: or_component = gift.component_from(39, 6) sage: cp = CpModel(gift) - sage: or_component.cp_xor_linear_mask_propagation_constraints(cp) - (['array[0..31] of var int: p_or_39_6;', - 'array[0..63] of var 0..1:or_39_6_i;', - 'array[0..31] of var 0..1:or_39_6_o;'], - ['constraint table(or_39_6_i[0]++or_39_6_i[32]++or_39_6_o[0]++p_or_39_6[0],and2inputs_LAT);', - ... - 'constraint table(or_39_6_i[31]++or_39_6_i[63]++or_39_6_o[31]++p_or_39_6[31],and2inputs_LAT);', - 'constraint p[0] = sum(p_or_39_6);']) + sage: declarations, constraints = or_component.cp_xor_linear_mask_propagation_constraints(cp) + sage: declarations + ['array[0..31] of var 0..3200: p_or_39_6;', + 'array[0..63] of var 0..1:or_39_6_i;', + 'array[0..31] of var 0..1:or_39_6_o;'] + sage: constraints + ['constraint table([or_39_6_i[0]]++[or_39_6_i[32]]++[or_39_6_o[0]]++[p_or_39_6[0]],and2inputs_LAT);', + 'constraint table([or_39_6_i[1]]++[or_39_6_i[33]]++[or_39_6_o[1]]++[p_or_39_6[1]],and2inputs_LAT);', + ... + 'constraint table([or_39_6_i[31]]++[or_39_6_i[63]]++[or_39_6_o[31]]++[p_or_39_6[31]],and2inputs_LAT);', + 'constraint p[0] = sum(p_or_39_6);'] + """ input_size = int(self.input_bit_size) output_size = int(self.output_bit_size)