Commit 3074ccaf authored by Iustin Pop's avatar Iustin Pop
Browse files

Fix another data generation issue in tests



Another "good" seed value manages to generate nodes with identical
names, which of course makes the sets be of smaller value than the
lists. Avoid this issue by generating unique node names.
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarRené Nussbaumer <rn@google.com>
parent 16670b57
......@@ -1281,14 +1281,19 @@ prop_Loader_lookupInstance kti inst =
Loader.lookupInstance il inst ==? Data.Map.lookup inst il
where il = Data.Map.fromList kti
prop_Loader_assignIndices nodes =
Data.Map.size nassoc == length nodes &&
prop_Loader_assignIndices =
-- generate nodes with unique names
forAll (arbitrary `suchThat`
(\nodes ->
let names = map Node.name nodes
in length names == length (nub names))) $ \nodes ->
let (nassoc, kt) =
Loader.assignIndices (map (\n -> (Node.name n, n)) nodes)
in Data.Map.size nassoc == length nodes &&
Container.size kt == length nodes &&
(if not (null nodes)
if not (null nodes)
then maximum (IntMap.keys kt) == length nodes - 1
else True)
where (nassoc, kt) =
Loader.assignIndices (map (\n -> (Node.name n, n)) nodes)
else True
-- | Checks that the number of primary instances recorded on the nodes
-- is zero.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment