matlab.unittest.constraints.HasUniqueElements 类
命名空间: matlab.unittest.constraints
超类: matlab.unittest.constraints.BooleanConstraint
测试集合是否有唯一元素
描述
matlab.unittest.constraints.HasUniqueElements
类提供一个约束来测试集合是否有唯一元素。
该约束使用 unique
函数来分析该集合。因此,unique
函数必须支持用于约束的实际值。
创建对象
描述
c = matlab.unittest.constraints.HasUniqueElements
创建一个约束来测试集合是否有唯一元素。对于实际集合 actual
,如果 numel(unique(actual))
等于 numel(actual)
,则满足约束。
示例
版本历史记录
在 R2016a 中推出