The unpac monorepo manager self-hosting as a monorepo using unpac
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

test_component not using Random anymore

+32 -33
+14 -14
tests/dune
··· 220 220 221 221 ;; Rules for the test_components test 222 222 223 - ;; (rule 224 - ;; (with-stdout-to 225 - ;; test_components.output 226 - ;; (run ./test_components.exe))) 223 + (rule 224 + (with-stdout-to 225 + test_components.output 226 + (run ./test_components.exe))) 227 227 228 - ;; (rule 229 - ;; (alias runtest) 230 - ;; (action 231 - ;; (progn 232 - ;; (diff test_components.expected test_components.output) 233 - ;; (echo "test_components: all tests succeeded.\n")))) 228 + (rule 229 + (alias runtest) 230 + (action 231 + (progn 232 + (diff test_components.expected test_components.output) 233 + (echo "test_components: all tests succeeded.\n")))) 234 234 235 - ;; (executable 236 - ;; (name test_components) 237 - ;; (modules test_components) 238 - ;; (libraries graph)) 235 + (executable 236 + (name test_components) 237 + (modules test_components) 238 + (libraries graph)) 239 239 240 240 ;; rules for the dot test 241 241
+7 -9
tests/test_components.expected
··· 1 - 7 components 1 + 4 components 2 2 0 -> 0 3 3 1 -> 1 4 - 2 -> 2 5 - 3 -> 3 6 - 4 -> 1 7 - 5 -> 1 8 - 6 -> 4 9 - 7 -> 1 10 - 8 -> 5 11 - 9 -> 6 4 + 2 -> 0 5 + 3 -> 2 6 + 4 -> 2 7 + 5 -> 3 8 + 6 -> 2 9 + 7 -> 0
+11 -10
tests/test_components.ml
··· 22 22 23 23 open Pack.Graph 24 24 25 - (* FIXME: do not use Random here, as OCaml 5.0 seems to generate a 26 - different graph *) 25 + (* 0 -- 2 -- 7 1 3 -- 4 5 26 + \ / 27 + 6 28 + 29 + component: 0 1 2 3 30 + *) 27 31 28 32 let () = 29 - Random.init 42; 30 - let g = Rand.graph ~v:10 ~e:3 () in 33 + let g = create () in 34 + let v = Array.init 8 V.create in 35 + Array.iter (add_vertex g) v; 36 + let add i j = add_edge g v.(i) v.(j) in 37 + add 0 2; add 7 2; add 3 4; add 4 6; add 3 6; 31 38 let n, f = C.components g in 32 39 printf "%d components@." n; 33 40 iter_vertex (fun v -> printf "%d -> %d@." (V.label v) (f v)) g 34 41 35 - 36 - (* 37 - Local Variables: 38 - compile-command: "ocaml -I .. graph.cma test_components.ml" 39 - End: 40 - *)