Code covered by the BSD License  

Highlights from
MATLAB xUnit Test Framework

image thumbnail

MATLAB xUnit Test Framework

by

 

31 Jan 2009 (Updated )

MATLAB xUnit is a unit test framework for MATLAB code.

Editor's Notes:

This file was selected as MATLAB Central Pick of the Week

testAssertFalse
function test_suite = testAssertFalse
%testAssertFalse Unit tests for assertFalse

%   Steven L. Eddins
%   Copyright 2008 The MathWorks, Inc.

initTestSuite;

function testAssertFalseHappyCase
assertFalse(false);

function testAssertFalseHappyCaseWithTwoArgs
assertFalse(false, '1.e4 e5 2.Nf3 Nc6');

function testAssertFalseFailed
% Verify exception when false is passed to assertFalse.
assertExceptionThrown(@() assertFalse(true), 'assertFalse:trueCondition');

function testAssertFalseNonscalar
% Verify that assertFalse doesn't like nonscalar input.
assertExceptionThrown(@() assertFalse(logical([0 0])), 'assertFalse:invalidCondition');

function testAssertFalseNonlogical
% Verify that assertFalse doesn't like nonlogical input.
assertExceptionThrown(@() assertFalse(0), 'assertFalse:invalidCondition');

Contact us