Commits

Paweł Wieczorek committed a78bfaf

Delivery of eq_arithmetic_expression in Lang.Tac

Comments (0)

Files changed (3)

source/Lang/TAC/AST.ml

     when op1 = op2 ->
         eq_atom atom1a atom2a && eq_atom atom1b atom2b
 
+    | AEXPR_UnaryOperator (_, op1, atom1)
+    , AEXPR_UnaryOperator (_, op2, atom2)
+    when op1 = op2 ->
+        eq_atom atom1 atom2 
+
     | _ ->
         false
 

test/TestSet/Test_Lang/Test_Common/Test_AST.ml

         let from_2 embed xs ys =
             List.map embed (Util.cartesian_product_2 xs ys)
 
+        let many_from_2_x_xs embed xs yss =
+            let f ys = List.map (fun x -> from_2 embed [x] ys) xs
+                in
+            Util.concat_map f yss
+
         let from_3 embed xs ys zs =
             List.map embed (Util.cartesian_product_3 xs ys zs)
 

test/TestSet/Test_Lang/Test_TAC/Test_AST.ml

         let embed atom = MUT.AEXPR_Atom (new_label (), atom) in
         AstCartesianProduct.many_from_1 embed atoms_equals
 
+    let equal_aexprs_from_auops =
+        let embed (aop, atom) = MUT.AEXPR_UnaryOperator (new_label (), aop, atom) in
+        AstCartesianProduct.many_from_2_x_xs embed
+            arithmetic_unary_operators
+            atoms_equals
+
+
     let different_aexprs = List.concat
         [ different_aexprs_from_atoms 
         ; different_aexprs_from_abops
 
     let equal_aexprs = List.concat
         [ equal_aexprs_from_atom
+        ; equal_aexprs_from_auops 
         ]
 end