matlab.unittest.constraints.HasInf クラス
パッケージ: matlab.unittest.constraints
スーパークラス: matlab.unittest.constraints.BooleanConstraint
無限値を含む配列を指定する制約
構築
HasInf
は、実際の値の配列に無限値があるかどうかを判別できる制約を作成します。この制約は、実際の値の配列に少なくとも 1 つの無限値が含まれる場合にのみ満たされます。
コピーのセマンティクス
値。値クラスがコピー操作に与える影響については、オブジェクトのコピーを参照してください。
例
実際の値の配列に無限値が含まれることをテスト
対話型テスト用にテスト ケースを作成します。
import matlab.unittest.TestCase import matlab.unittest.constraints.HasInf testCase = TestCase.forInteractiveUse;
値 Inf
が制約を満たすことをテストします。
testCase.verifyThat(Inf, HasInf)
Interactive verification passed.
配列に無限値が含まれることをアサートします。
testCase.assertThat([0 1 1 2 3 5 8 13], HasInf)
Interactive assertion failed.
---------------------
Framework Diagnostic:
---------------------
HasInf failed.
--> At least one element must be Inf or -Inf.
Actual double:
0 1 1 2 3 5 8 13
Assertion failed.
配列に無限値は含まれません。
配列に無限値が含まれることを検証します。
testCase.verifyThat([-Inf 5 NaN], HasInf)
Interactive verification passed.
虚数部が無限大である複素数が制約を満たすことをアサートします。
testCase.assertThat(42+Inf*1i, HasInf)
Interactive verification passed.
配列に無限値が含まれないことを検証します。
testCase.verifyThat([NaN -7+NaN*1i], ~HasInf)
Interactive verification passed.
HasInf
制約を打ち消しても値が有限であるとは限らず、確認できるのは無限値が含まれないということだけです。
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)