From 873ce7c14c549c95eb8de138a46a51328b916b54 Mon Sep 17 00:00:00 2001
From: Erwan Jahier <erwan.jahier@univ-grenoble-alpes.fr>
Date: Wed, 18 Nov 2020 13:38:02 +0100
Subject: [PATCH] test: Add some comments in ml file

---
 test/dijkstra-ring/config.ml | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/test/dijkstra-ring/config.ml b/test/dijkstra-ring/config.ml
index 98b279bf..d017e2e0 100644
--- a/test/dijkstra-ring/config.ml
+++ b/test/dijkstra-ring/config.ml
@@ -1,20 +1,26 @@
-
 open Algo
 open State
 
 let potential = None
 let fault = None 
 
+(* For the Dijkstra ring, a configuration is legitimate iff there is 
+ exactly one token.
+
+   nb: there are as many tokens as enabled nodes. So let's count enable nodes!
+ *)
 let (legitimate: pid list -> (pid -> t * (t neighbor * pid) list) -> bool) =
   fun  pidl get -> 
-  (* only one node is enabled *)
+  (* increment the token number i if pid is enabled *)
   let incr_token i pid =
     let s, nl = get pid in
     let nl = List.map fst nl in
     let have_token = (if s.root then Root.enable_f s nl else P.enable_f s nl) <> [] in
     if have_token then i+1 else i
   in
+  (* Now let's iterate on all the nodes starting from |tokens|=0 *)
   let token_nb = List.fold_left incr_token 0 pidl in
+  (* if there is 1 token, returns true *)
   token_nb = 1
 
 let legitimate = Some legitimate
-- 
GitLab