Diff of /trunk/Toss/Solver/StructureTest.ml [r1812] .. [r1813] Maximize Restore

  Switch to side-by-side view

--- a/trunk/Toss/Solver/StructureTest.ml
+++ b/trunk/Toss/Solver/StructureTest.ml
@@ -7,20 +7,22 @@
 let test_parse ?msg ?result s =
   let result = match result with
       None -> s | Some s -> s in
-  assert_equal ?msg ~printer:(fun x->x) result
-    (Structure.str (struc_of_string (s)))
+  assert_equal ?msg ~printer:(fun x->x) (Aux.normalize_spaces result)
+    (Aux.normalize_spaces (Structure.str (struc_of_string (s))))
 
 let test_sprint ?msg s =
   assert_equal ?msg ~printer:(fun x->x) s
     (Structure.sprint (struc_of_string s))
 
 let test_incident_in_struc struc e =
+  let tuple_str ?(with_paren=true) struc tp =
+    if Array.length tp = 1 && not with_paren then elem_str struc tp.(0) else
+      "(" ^ (String.concat ", "
+               (Array.to_list (Array.map (elem_str struc) tp))) ^ ")" in
   let inc_str (rname, tps) =
-    rname ^ " {" ^ (String.concat ", "
-                       (List.map (tuple_str struc) tps)) ^ "}"
-  in
+    rname ^ " {" ^ (String.concat ", " (List.map (tuple_str struc) tps)) ^"}" in
   (String.concat "; " (List.map inc_str (incident struc e)))
-
+    
 let test_incident s result = 
   let struc = struc_of_string s in
   assert_equal ~printer:(String.concat " | ") result
@@ -38,6 +40,7 @@
   "parse 1" >::
     (fun () ->
       test_parse "[a, b | R (a, b) | ]";
+      test_parse "[a, b | R (a, b) ; .s = a | ]";
     );
 
   "parse 2" >::
@@ -66,8 +69,8 @@
   "parse range" >::
     (fun () ->
       test_parse
-        ~result:("[e2, e3, e4 |  | nbr {e2->2., e3->3., e4->4.}; "^
-		    "x {e2->0., e3->15., e4->30.}; y {e2->0., e3->0., e4->0.}]")
+        ~result:("[e2, e3, e4 |  | nbr {e2->2., e3->3., e4->4.}; x {e2->0., " ^
+                    "e3->15., e4->30.}; y {e2->0., e3->0., e4->0.} ]")
 	"[ 2 - 4 | | - ]";
     );
 
@@ -372,11 +375,11 @@
  Relation R on from 0 to 4 given by succ {}.
  " in
       let (_, st) = struc_from_trs s in
-      assert_equal ~printer:(fun x -> x) 
+      assert_equal ~printer:(fun x -> x)
 	("[1, 2, 3, 4, 5, 6 | R {(1, 2); (2, 3); (3, 4); (4, 5); (5, 6)} | " ^
             "x {1->0., 2->1., 3->2., 4->3., 5->4., 6->5.}; " ^
-            "y {1->0., 2->1., 3->2., 4->3., 5->4., 6->5.}]")
-        (str (clear_names st));
+            "y {1->0., 2->1., 3->2., 4->3., 5->4., 6->5.} ]")
+        (Aux.normalize_spaces (str (clear_names st)));
     );
 
   "sprint simple" >::