[b4b313]: / matlab_xunit_3.1 / matlab_xunit / tests / testAssertTrue.m

Download this file

26 lines (18 with data), 817 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
function test_suite = testAssertTrue
%testAssertTrue Unit tests for assertTrue
% Steven L. Eddins
% Copyright 2008 The MathWorks, Inc.
initTestSuite;
function testAssertTrueHappyCase
assertTrue(true);
function testAssertTrueHappyCaseWithTwoArgs
assertTrue(true, '1.e4 e5 2.Nf3 Nc6');
function testAssertTrueFailed
% Verify exception when false is passed to assertTrue.
assertExceptionThrown(@() assertTrue(false), 'assertTrue:falseCondition');
function testAssertTrueNonscalar
% Verify that assertTrue doesn't like nonscalar input.
assertExceptionThrown(@() assertTrue(logical([1 1])), 'assertTrue:invalidCondition');
function testAssertTrueNonlogical
% Verify that assertTrue doesn't like nonlogical input.
assertExceptionThrown(@() assertTrue(5), 'assertTrue:invalidCondition');