首页 > 解决方案 > Specman 中的列表生成

问题描述

我有类型 my_type : [a,b,c,d,e,f]; 我有 my_list : my_type 列表;

我想生成 my_list,但是 c、d、f 应该放在一起是有限制的。如果生成的列表中有 c、d 或 f,则必须是所有 3 个。(我可以在列表中没有它们)。

标签: specman

解决方案


干得好:

type my_type : [a,b,c,d,e,f]; 

{
  my_list: list of my_type;
  keep my_list.has(it in [c,d,f]) => ( ( c in my_list ) && ( d in my_list ) && ( f in my_list) );
}

推荐阅读