Main Content

이 번역 페이지는 최신 내용을 담고 있지 않습니다. 최신 내용을 영문으로 보려면 여기를 클릭하십시오.

matlab.unittest.constraints.IsSupersetOf 클래스

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

실제 집합이 예상 집합의 상위 집합인지 테스트

생성

IsSupersetOf(expSet)는 실제 값 집합이 예상 값 집합의 상위 집합인지 규정하는 제약 조건을 생성합니다. 이 제약 조건은 예상 값 집합의 상위 집합이 아닌 실제 값 집합에 대해 가설 검정(Qualification) 실패를 생성합니다. ismember(expSet,actSet)에 포함된 값이 모두 true이고 실제 값과 예상 값이 다음 조건 중 하나를 충족하는 경우 실제 값 집합이 예상 값 집합의 상위 집합으로 간주됩니다.

  • 실제 값과 예상 값이 동일한 클래스입니다.

  • 실제 값이 객체입니다.

  • 예상 값이 객체입니다.

입력 인수

모두 확장

실제 값 집합과 비교할 예상 값 집합입니다. 입력값의 유형은 테스트 값에 따라 달라집니다.

속성

모두 확장

실제 값 집합의 부분 집합입니다. 속성의 데이터형은 테스트 값에 따라 달라집니다. 제약 조건을 충족하려면 실제 값 집합이 Subset의 상위 집합이어야 합니다. expSet 입력 인수를 통해 생성자에 이 속성을 설정합니다.

복사 의미 체계

값입니다. 값 클래스가 복사 작업에 미치는 영향에 대한 내용은 객체 복사 항목을 참조하십시오.

예제

모두 축소

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

import matlab.unittest.TestCase;
import matlab.unittest.constraints.IsSupersetOf;

testCase = TestCase.forInteractiveUse;

실제 셀형 배열이 예상 집합의 일부인지 확인합니다.

testCase.verifyThat({'a','b','c'}, IsSupersetOf({'c';'b'}));
Interactive verification passed.
testCase.verifyThat({'a','b','c'}, IsSupersetOf({'a','d'}));
Interactive verification failed.

---------------------
Framework Diagnostic:
---------------------
IsSupersetOf failed.
--> The expected subset contains 1 element(s) not found in the actual value:
    --> Element at index 2 not found in the actual value:
                'd'

Actual Value (cell):
        'a'    'b'    'c'
Expected Subset (cell):
        'a'    'd'

double형 집합이 예상 집합의 일부인지 어설션합니다.

testCase.assertThat(magic(21), IsSupersetOf([25;209]));
Interactive assertion passed.
testCase.assertThat(25:33, IsSupersetOf(30:40));
Interactive assertion failed.

---------------------
Framework Diagnostic:
---------------------
IsSupersetOf failed.
--> The expected subset contains elements not found in the actual value (First 5 of 7):
    --> Element at index 5 not found in the actual value:
                34
    --> Element at index 6 not found in the actual value:
                35
    --> Element at index 7 not found in the actual value:
                36
    --> Element at index 8 not found in the actual value:
                37
    --> Element at index 9 not found in the actual value:
                38

Actual Value (double):
        25    26    27    28    29    30    31    32    33
Expected Subset (double):
        30    31    32    33    34    35    36    37    38    39    40
Assertion failed.

테이블의 행이 예상 테이블의 일부인지 확인합니다.

actT = table([1:2:5]',{'A';'C';'E'},logical([1;0;0]));
expT = table([3,1]',{'C';'A'},logical([0;1]));
testCase.verifyThat(actT, IsSupersetOf(expT));
Interactive verification passed.

실제 집합과 예상 집합의 유형이 다른 경우 IsSubsetOf 제약 조건이 충족되지 않는지 여부를 테스트합니다.

testCase.assumeThat(single(0:5), IsSupersetOf(1:3));
Interactive assumption failed.

---------------------
Framework Diagnostic:
---------------------
IsSupersetOf failed.
--> Classes do not match.
    
    Actual Class:
        single
    Expected Class:
        double

Actual Value (single):
         0     1     2     3     4     5
Expected Subset (double):
         1     2     3
Assumption failed.

버전 내역

R2016a에 개발됨