matlab.unittest.constraints.IsFalse 类
命名空间: matlab.unittest.constraints
超类: matlab.unittest.constraints.Constraint
测试值是否为 false
描述
matlab.unittest.constraints.IsFalse
类提供一个约束来测试值是否为 false。
创建对象
描述
c = matlab.unittest.constraints.IsFalse
创建一个约束来测试值是否为 false。标量逻辑值 0
(false
) 满足该约束。
示例
测试值是否为 false
使用 IsFalse
约束测试值。
首先,导入此示例中使用的类。
import matlab.unittest.TestCase import matlab.unittest.constraints.IsFalse
创建一个供交互测试的测试用例。
testCase = TestCase.forInteractiveUse;
验证 false
满足 IsFalse
约束。
testCase.verifyThat(false,IsFalse)
Verification passed.
测试 true
是否满足该约束。测试失败。
testCase.verifyThat(true,IsFalse)
Verification failed. --------------------- Framework Diagnostic: --------------------- IsFalse failed. --> The value must evaluate to "false". Actual Value: logical 1
测试值 0
。测试失败,因为该值的类型为 double
。
testCase.verifyThat(0,IsFalse)
Verification failed. --------------------- Framework Diagnostic: --------------------- IsFalse failed. --> The value must be logical. It is of type "double". Actual Value: 0
测试值 [false false]
。测试失败,因为该值不是标量。
testCase.verifyThat([false false],IsFalse)
Verification failed. --------------------- Framework Diagnostic: --------------------- IsFalse failed. --> The value must be scalar. It has a size of [1 2]. Actual Value: 1×2 logical array 0 0
版本历史记录
在 R2013a 中推出
MATLAB 命令
您点击的链接对应于以下 MATLAB 命令:
请在 MATLAB 命令行窗口中直接输入以执行命令。Web 浏览器不支持 MATLAB 命令。
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)