Skip to content
Snippets Groups Projects
Commit c60d63ac authored by erwan's avatar erwan
Browse files

test: add the new for_init_search required functions in test/*/config.ml

parent 9e9446a7
No related branches found
No related tags found
No related merge requests found
...@@ -13,3 +13,4 @@ let potential = Some clash_number ...@@ -13,3 +13,4 @@ let potential = Some clash_number
(* let potential = None *) (* let potential = None *)
let legitimate = None let legitimate = None
let fault = None let fault = None
let for_init_search = None
digraph ring7 { digraph ring7 {
graph [k=3] graph [k=3]
root [algo="root.ml" init="{root=1;v=0}" ] root [algo="root.ml" init="{root=1;c=1}" ]
p2 [algo="p.ml" init="{root=0;v=0}" ] p2 [algo="p.ml" init="{root=0;c=3}" ]
p3 [algo="p.ml" init="{root=0;v=0}" ] p3 [algo="p.ml" init="{root=0;c=3}" ]
p4 [algo="p.ml" init="{root=0;v=0}" ] p4 [algo="p.ml" init="{root=0;c=2}" ]
p5 [algo="p.ml" init="{root=0;v=0}" ] p5 [algo="p.ml" init="{root=0;c=2}" ]
p6 [algo="p.ml" init="{root=0;v=0}" ] p6 [algo="p.ml" init="{root=0;c=1}" ]
p7 [algo="p.ml" init="{root=0;v=0}" ] p7 [algo="p.ml" init="{root=0;c=1}" ]
p8 [algo="p.ml" init="{root=0;v=0}" ] p8 [algo="p.ml" init="{root=0;c=0}" ]
root -> p2 -> p3 -> p4 -> p5 -> p6 -> p7 -> p8 -> root root -> p2 -> p3 -> p4 -> p5 -> p6 -> p7 -> p8 -> root
} }
(* semi-anonymous network: each node knows if its neighbors is the root! *)
type t = { root: bool ; v : int } (* semi-anonymous network: we know who is the root! *) type t = { root: bool ; v : int }
let to_string s = Printf.sprintf "c=%i" s.v let to_string s = Printf.sprintf "c=%i" s.v
let first = ref true let first = ref true
let (of_string: (string -> t) option) = let (of_string: (string -> t) option) =
Some (fun s -> Some (fun s ->
try (* if the root node is not explicitly set in the dot file, we let res =
consider the first one to be the root *) try Scanf.sscanf s "{root=%d;c=%d}" (fun i1 i2 -> { root = i1<>0; v = i2 } )
Scanf.sscanf s "{root=%d;v=%d}" (fun i1 i2 -> { root = i1<>0; v = i2 } )
with with
_ -> e1 ->
try try (* if the root node is not explicitly set in the dot file, we
consider the first one to be the root *)
let res = Scanf.sscanf s "c=%d" (fun i -> { root = !first; v = i } ) in let res = Scanf.sscanf s "c=%d" (fun i -> { root = !first; v = i } ) in
first := false; first := false;
res res
with with
_ -> e2 ->
Printf.printf "state.m: Unable to parse the initial state in the .dot: '%s'\n%!" s; Printf.printf
"state.ml: can't parse the initial state in the .dot: '%s'\n%s\n%s\n%!" s
(Printexc.to_string e1) (Printexc.to_string_default e2) ;
assert false assert false
in
(* Printf.printf "state.ml: { root = %b ; c = %d }\n%!" res.root res.v; *)
res
) )
let copy x = x let copy x = x
......
...@@ -42,3 +42,4 @@ let potential = Some pf ...@@ -42,3 +42,4 @@ let potential = Some pf
let legitimate = None (* None => only silent configuration are legitimate *) let legitimate = None (* None => only silent configuration are legitimate *)
let fault = None (* None => the simulation stop once a legitimate configuration is reached *) let fault = None (* None => the simulation stop once a legitimate configuration is reached *)
let for_init_search = None
...@@ -6,3 +6,4 @@ ...@@ -6,3 +6,4 @@
let potential = None (* None => only -sd, -cd, -lcd, -dd, or -custd are possible *) let potential = None (* None => only -sd, -cd, -lcd, -dd, or -custd are possible *)
let legitimate = None (* None => only silent configuration are legitimate *) let legitimate = None (* None => only silent configuration are legitimate *)
let fault = None (* None => the simulation stop once a legitimate configuration is reached *) let fault = None (* None => the simulation stop once a legitimate configuration is reached *)
let for_init_search = None
...@@ -6,3 +6,4 @@ ...@@ -6,3 +6,4 @@
let potential = None (* None => only -sd, -cd, -lcd, -dd, or -custd are possible *) let potential = None (* None => only -sd, -cd, -lcd, -dd, or -custd are possible *)
let legitimate = None (* None => only silent configuration are legitimate *) let legitimate = None (* None => only silent configuration are legitimate *)
let fault = None (* None => the simulation stop once a legitimate configuration is reached *) let fault = None (* None => the simulation stop once a legitimate configuration is reached *)
let for_init_search = None
...@@ -39,3 +39,4 @@ let potential = Some pf ...@@ -39,3 +39,4 @@ let potential = Some pf
let legitimate = None (* None => only silent configuration are legitimate *) let legitimate = None (* None => only silent configuration are legitimate *)
let fault = None (* None => the simulation stop once a legitimate configuration is reached *) let fault = None (* None => the simulation stop once a legitimate configuration is reached *)
let for_init_search = None
...@@ -52,3 +52,4 @@ let potential_combined: State.t Algo.potential_fun = ...@@ -52,3 +52,4 @@ let potential_combined: State.t Algo.potential_fun =
let potential = Some potential_combined let potential = Some potential_combined
let legitimate = None (* None => only silent configuration are legitimate *) let legitimate = None (* None => only silent configuration are legitimate *)
let fault = None (* None => the simulation stop once a legitimate configuration is reached *) let fault = None (* None => the simulation stop once a legitimate configuration is reached *)
let for_init_search = None
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment