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

test_stringToCellArray
function test_suite = test_stringToCellArray
%test_stringToCellArray Unit test for stringToCellArray

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

initTestSuite;

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