matlab.unittest.constraints.IsSubsetOf 클래스
패키지: matlab.unittest.constraints
슈퍼클래스: matlab.unittest.constraints.BooleanConstraint
실제 세트가 예상 세트의 일부인지 규정하는 제약 조건
생성
IsSubsetOf(
는 실제 값 집합이 예상 값 집합의 일부인지 규정하는 제약 조건을 만듭니다. 이 제약 조건은 예상 값 집합의 일부가 아닌 실제 값 집합에 대해 가설 검정(Qualification) 실패를 생성합니다. expSet
)ismember(actSet,expSet)
에 포함된 값이 모두 true이고 실제 값과 예상 값이 다음 조건 중 하나를 충족하는 경우 실제 값 집합이 예상 값 집합의 일부로 간주됩니다.
실제 값과 예상 값이 동일한 클래스입니다.
실제 값이 객체입니다.
예상 값이 객체입니다.
입력 인수
expSet
— 실제 값 집합과 비교할 예상 값 집합
테스트 값에 따라 달라짐
실제 값 집합과 비교할 예상 값 집합입니다. 입력값의 유형은 테스트 값에 따라 달라집니다.
속성
Superset
— 실제 값 집합의 상위 집합
테스트 값에 따라 달라짐
실제 값 집합의 상위 집합입니다. 속성의 데이터형은 테스트 값에 따라 달라집니다. 제약 조건을 충족하기 위해 실제 값의 집합은 Superset
의 부분 집합이어야 합니다. expSet
입력 인수를 통해 생성자에 이 속성을 설정합니다.
복사 의미 체계
값입니다. 값 클래스가 복사 작업에 미치는 영향에 대한 내용은 객체 복사 항목을 참조하십시오.
예제
실제 세트가 예상 세트의 일부인지 테스트하기
대화형 방식 테스트를 위한 테스트 케이스를 생성합니다.
import matlab.unittest.TestCase; import matlab.unittest.constraints.IsSubsetOf; testCase = TestCase.forInteractiveUse;
실제 셀형 배열이 예상 세트의 일부인지 확인합니다.
testCase.verifyThat({'c','b'}, IsSubsetOf({'a','b','c'}));
Interactive verification passed.
testCase.verifyThat({'a';'d'}, IsSubsetOf({'a','b','c'}));
Interactive verification failed. --------------------- Framework Diagnostic: --------------------- IsSubsetOf failed. --> The actual value contains 1 element(s) not found in the expected superset: --> Element at index 2 not found in the expected superset: 'd' Actual Value (cell): 'a' 'd' Expected Superset (cell): 'a' 'b' 'c'
double형 세트가 예상 세트의 일부인지 어설션합니다.
testCase.assertThat([25;209], IsSubsetOf(magic(21)));
Interactive assertion passed.
testCase.assertThat(25:33, IsSubsetOf(30:40));
Interactive assertion failed. --------------------- Framework Diagnostic: --------------------- IsSubsetOf failed. --> The actual value contains 5 element(s) not found in the expected superset: --> Element at index 1 not found in the expected superset: 25 --> Element at index 2 not found in the expected superset: 26 --> Element at index 3 not found in the expected superset: 27 --> Element at index 4 not found in the expected superset: 28 --> Element at index 5 not found in the expected superset: 29 Actual Value (double): 25 26 27 28 29 30 31 32 33 Expected Superset (double): 30 31 32 33 34 35 36 37 38 39 40 Assertion failed.
테이블의 행이 예상 테이블의 일부인지 확인합니다.
actT = table([3,1]',{'C';'A'},logical([0;1])); expT = table([1:2:5]',{'A';'C';'E'},logical([1;0;0])); testCase.verifyThat(actT, IsSubsetOf(expT));
Interactive verification passed.
실제 세트와 예상 세트의 유형이 다른 경우 IsSubsetOf
제약 조건이 충족되지 않는지 여부를 테스트합니다.
testCase.assumeThat(single(1:3), IsSubsetOf(0:5));
Interactive assumption failed. --------------------- Framework Diagnostic: --------------------- IsSubsetOf failed. --> Classes do not match. Actual Class: single Expected Class: double Actual Value (single): 1 2 3 Expected Superset (double): 0 1 2 3 4 5 Assumption failed.
버전 내역
MATLAB 명령
다음 MATLAB 명령에 해당하는 링크를 클릭했습니다.
명령을 실행하려면 MATLAB 명령 창에 입력하십시오. 웹 브라우저는 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)