Main Content

matlab.unittest.constraints.IsGreaterThan 클래스

네임스페이스: matlab.unittest.constraints
슈퍼클래스: matlab.unittest.constraints.Constraint

값이 지정된 값보다 큰지 테스트

설명

matlab.unittest.constraints.IsGreaterThan 클래스는 숫자형 값이 특정 값보다 큰지 테스트하는 제약 조건을 제공합니다.

생성

설명

예제

c = matlab.unittest.constraints.IsGreaterThan(floorValue)는 값이 floorValue보다 큰지 테스트하는 제약 조건을 만들고 FloorValue 속성을 설정합니다. 비교하는 값들은 크기가 같거나 호환 가능해야 합니다. 호환되는 배열에 대한 자세한 내용은 기본 연산에 대해 호환되는 배열 크기 항목을 참조하십시오.

속성

모두 확장

비교할 값으로, 숫자형 배열로 반환됩니다. 제약 조건을 생성할 때 이 속성의 값을 지정합니다.

특성:

GetAccess
public
SetAccess
private

예제

모두 축소

IsGreaterThan 제약 조건을 사용하여 숫자형 값을 비교합니다.

먼저 이 예제에서 사용되는 클래스를 가져옵니다.

import matlab.unittest.TestCase
import matlab.unittest.constraints.IsGreaterThan

대화형 방식 테스트를 위한 테스트 케이스를 생성합니다.

testCase = TestCase.forInteractiveUse;

32보다 큰지 확인합니다.

testCase.verifyThat(3,IsGreaterThan(2))
Verification passed.

행렬 [1 2 3; 4 5 6]의 각 요소가 바닥(floor) 값 4보다 큰지 테스트합니다. 테스트가 실패합니다.

testCase.verifyThat([1 2 3; 4 5 6],IsGreaterThan(4))
Verification failed.
    ---------------------
    Framework Diagnostic:
    ---------------------
    IsGreaterThan failed.
    --> Each element must be greater than the minimum value.
        
        Failing Indices:
             1     2     3     5
    
    Actual Value:
         1     2     3
         4     5     6
    Minimum Value (Exclusive):
         4

5가 바닥(floor) 벡터 [1 2 3]의 각 요소보다 큰지 확인합니다.

testCase.verifyThat(5,IsGreaterThan([1 2 3]))
Verification passed.

벡터 [5 -3 2]의 각 요소가 바닥(floor) 벡터 [4 -9 0]의 대응하는 요소보다 큰지 테스트합니다. 테스트가 통과합니다.

testCase.verifyThat([5 -3 2],IsGreaterThan([4 -9 0]))
Verification passed.

두 개의 동일한 배열을 비교합니다. 테스트가 실패합니다.

testCase.verifyThat(eye(2),IsGreaterThan(eye(2)))
Verification failed.
    ---------------------
    Framework Diagnostic:
    ---------------------
    IsGreaterThan failed.
    --> Each element must be greater than each corresponding element of the minimum value array.
        
        Failing Indices:
             1     2     3     4
    
    Actual Value:
         1     0
         0     1
    Minimum Value (Exclusive):
         1     0
         0     1

버전 내역

R2013a에 개발됨