Code covered by the BSD License  

Highlights from
MATLAB xUnit Test Framework

image thumbnail

MATLAB xUnit Test Framework


Steve Eddins (view profile)


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

function test_suite = test_stringToCellArray
%test_stringToCellArray Unit test for stringToCellArray

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


function test_happyCase
s = sprintf('Hello\nWorld');
assertEqual(xunit.utils.stringToCellArray(s), {'Hello' ; 'World'});

function test_emptyInput
assertEqual(xunit.utils.stringToCellArray(''), cell(0, 1));

function test_spacesInFront
s = sprintf('    Hello\n  World\n');
assertEqual(xunit.utils.stringToCellArray(s), {'    Hello' ; '  World'});

function test_spacesAtEnd
s = sprintf('Hello  \nWorld     ');
assertEqual(xunit.utils.stringToCellArray(s), {'Hello  ' ; 'World     '});

Contact us