Code covered by the BSD License  

Highlights from
mlunit_2008a

image thumbnail
from mlunit_2008a by Christopher
A MATLAB unit test framework supporting new classdef files (r2008a)

SinTestCase
classdef SinTestCase < TestCase

% SINTESTCASE Example of a simple test case on a built-in matlab
% function (in this case, the sin function).

    properties
    end

    methods
        function testCosine(self)
            self.assertEquals(1, cos(0));
        end

        function testSine(self)
            self.assertEquals(0, sin(0));
        end

        function testSineCosine(self)
            self.assertEquals(cos(0), sin(pi/2));
        end

        % this one fails
        function testSineTangent(self)
            self.assertEquals(sin(pi/2), tan(pi/2));
        end
    end
end

Contact us at files@mathworks.com