Code covered by the BSD License
-
MATLAB xUnit Test Framework: ...
-
MATLAB xUnit Test Framework: ...
-
MATLAB xUnit Test Framework: ...
-
MATLAB xUnit Test Framework: ...
-
MATLAB xUnit Test Framework: ...
-
MATLAB xUnit Test Framework: ...
-
MATLAB xUnit Test Framework: ...
-
MATLAB xUnit Test Framework: ...
-
MATLAB xUnit Test Framework: ...
-
MATLAB xUnit Test Framework: ...
-
MATLAB xUnit Test Framework: ...
-
MATLAB xUnit Test Framework: ...
-
abc.tests.test_that
Do-nothing test used in the examples for organizing tests inside packages.
-
abc.tests.test_this
Do-nothing test used in the examples for organizing tests inside packages.
-
abc_tests.test_that
Do-nothing test used in the examples for organizing tests inside packages.
-
abc_tests.test_this
Do-nothing test used in the examples for organizing tests inside packages.
-
assertAlmostEqual(A, B, relto...
assertEqual Assert that inputs are equal within relative tolerance
-
assertElementsAlmostEqual(var...
assertElementsAlmostEqual Assert floating-point array elements almost equal.
-
assertEqual(A, B, custom_mess...
assertEqual Assert that inputs are equal
-
assertExceptionThrown(f, expe...
assertExceptionThrown Assert that specified exception is thrown
-
assertFalse(condition, messag...
assertFalse Assert that input condition is false
-
assertFilesEqual(filename1, f...
assertFilesEqual Assert that files contain the same contents.
-
assertTrue(condition, message...
assertTrue Assert that input condition is true
-
assertVectorsAlmostEqual(vara...
assertVectorsAlmostEqual Assert floating-point vectors almost equal in norm sense.
-
mtest(name)
mtest Run unit tests
-
mtest.utils.compareFloats(var...
compareFloats Compare floating-point arrays using tolerance.
-
mtest.utils.containsRegexp(st...
containsRegexp True if string contains regular expression
-
mtest.utils.generateDoc
generateDoc Publish the example scripts in the doc directory
-
mtest.utils.isAlmostEqual(A, ...
isAlmostEqual Equality test using relative tolerance
-
mtest.utils.isSetUpString(str...
isSetUpString True if string looks like the name of a setup function
-
mtest.utils.isTearDownString(...
isTearDownString True if string looks like the name of a teardown function
-
mtest.utils.isTestCaseSubclas...
isTestCaseSubclass True for name of a TestCase subclass
-
mtest.utils.isTestString(str)
isTestString True if string looks like the name of a test
-
mtest.utils.parseFloatAssertI...
parseFloatAssertInputs Parse inputs for floating-point assertion functions.
-
notTestString
This function exists to help test that the TestSuite.fromPwd() method does not
-
runtests(varargin)
runtests Run unit tests
-
testAssertAlmostEqual
testAssertAlmostEqual Unit tests for assertAlmostEqual
-
testAssertEqual
testAssertEqual Unit tests for assertEqual
-
testAssertExceptionThrown
testAssertExceptionThrown Unit tests for assertExceptionThrown
-
testAssertFalse
testAssertFalse Unit tests for assertFalse
-
testAssertTrue
testAssertTrue Unit tests for assertTrue
-
testBadSinTest
Example of a failing test case. The test writer should have used
-
testContainsRegexp
testContainsRegexp Unit tests for containsRegexp
-
testCos
-
testFliplr
-
testFliplrMatrix
testFliplrMatrix Unit test for fliplr with matrix input
-
testFliplrVector
testFliplrVector Unit test for fliplr with vector input
-
testFoobar
testFoobar Passing M-file test
-
testFoobar
testFoobar Passing M-file test
-
testFunctionHandlesA
testFunctionHandlesE Test file used by TestFunctionHandlesTest
-
testFunctionHandlesA
testFunctionHandlesA Test file used by TestFunctionHandlesTest
-
testFunctionHandlesB
testFunctionHandlesB Test file used by TestFunctionHandlesTest
-
testFunctionHandlesC
testFunctionHandlesC Test file used by TestFunctionHandlesTest
-
testFunctionHandlesD
testFunctionHandlesD Test file used by TestFunctionHandlesTest
-
testFunctionHandlesTeardownNo...
Verify that test file works if it has a teardown function but no setup
-
testIsAlmostEqual
testIsAlmostEqual Unit tests for isAlmostEqual
-
testIsSetUpString
testIsSetUpString Unit tests for isSetUpString
-
testIsTearDownString
testIsTearDownString Unit tests for isTearDownString
-
testIsTestCaseSubclass
testIsTestCaseSubclass Unit tests for isTestCaseSubclass
-
testIsTestString
testIsTestString Unit tests for isTestString
-
testRuntestsWithDirectoryName
testRuntestsWithDirectoryName Unit test for mtest('dirname') syntax.
-
testSample
-
testSetupExample
-
testSimple
testSimple Simple M-file test that passes
-
testSin
-
testSubfunctions
testSubfunctions Contains two passing subfunction tests
-
testSubfunctions
testSubfunctions Contains two passing subfunction tests
-
testWithSetupError
Example of a test with an error. The setup function calls cos with
-
test_TestSuiteInDir
test_TestSuiteInDir Unit test for TestSuiteInDir class.
-
test_arrayToString
test_arrayToString Unit test for arrayToString.
-
test_assertElementsAlmostEqua...
-
test_assertFilesEqual
test_assertFilesEqual Unit test for assertFilesEqual
-
test_assertVectorsAlmostEqual
-
test_compareFloats
-
test_comparisonMessage
test_comparisonMessage Unit test for comparisonMessage.
-
test_packageName
-
test_parseFloatAssertInputs
-
test_stringToCellArray
test_stringToCellArray Unit test for stringToCellArray
-
test_thatFails
-
test_thatPasses
-
xunit.mocktests.helper_that(x...
helper_that is not a test file.
-
xunit.mocktests.subpkg.test_a...
-
xunit.mocktests.test_this
test_this.m is a function-file test case.
-
xunit.mocktests.test_this
test_that.m is a subfunction test file.
-
xunit.utils.arrayToString(A)
arrayToString Convert array to string for display.
-
xunit.utils.compareFloats(var...
compareFloats Compare floating-point arrays using tolerance.
-
xunit.utils.comparisonMessage...
comparisonMessage Generate assertion message when comparing two arrays.
-
xunit.utils.containsRegexp(st...
containsRegexp True if string contains regular expression
-
xunit.utils.generateDoc
generateDoc Publish the example scripts in the doc directory
-
xunit.utils.isAlmostEqual(A, ...
isAlmostEqual Equality test using relative tolerance
-
xunit.utils.isSetUpString(str...
isSetUpString True if string looks like the name of a setup function
-
xunit.utils.isTearDownString(...
isTearDownString True if string looks like the name of a teardown function
-
xunit.utils.isTestCaseSubclas...
isTestCaseSubclass True for name of a TestCase subclass
-
xunit.utils.isTestString(str)
isTestString True if string looks like the name of a test
-
xunit.utils.parseFloatAssertI...
parseFloatAssertInputs Parse inputs for floating-point assertion functions.
-
xunit.utils.stringToCellArray...
stringToCellArray Convert string with newlines to cell array of strings.
-
BadFixture
-
CommandWindowTestRunDisplay
-
ExceptionNotThrownTest
-
FailingTestCase
FailingTestCase
-
FunctionHandleTestCase
FunctionHandleTestCase Test case based on a function handle
-
LoggingTestCase
LoggingTestCase
-
MtestTest
TestSuiteTest Unit tests for mtest command-line test runner.
-
NoTestMethods
-
PassingExceptionTest
-
RuntestsTest
TestSuiteTest Unit tests for runtests command-line test runner.
-
TestCase
TestCase Class defining interface for test cases
-
TestCaseInDir
TestCaseInDir Test case requiring temporary directory change
-
TestCaseSubclass
TestCaseSubclass TestCase subclass containing two passing tests
-
TestCaseSubclass
TestCaseSubclass TestCase subclass containing two passing tests
-
TestCaseTest
TestCaseTest Unit tests for the TestCase class
-
TestCaseWithAddPath
TestCaseInDir Test case requiring temporary path modification
-
TestCaseWithAddPathTest
TestCaseTest Unit tests for the TestCaseWithAddPath class
-
TestComponent
TestComponent Abstract base class for TestCase and TestSuite
-
TestComponentInDir
TestComponentInDir Test component requiring temporary directory change
-
TestFuncHandleTests
TestFuncHandleTests TeseCase class used to test function-handle-based tests
-
TestRunDisplay
TestRunDisplay Print test suite execution results.
-
TestRunLogger
TestRunLogger Collect data (silently) from running test suite
-
TestRunLoggerTest
TestSuiteTest Unit tests for TestSuite class
-
TestRunMonitor
TestRunMonitor Abstract base class for monitoring a running test suite
-
TestSuite
TestSuite Collection of TestComponent objects
-
TestSuiteInDir
TestSuiteInDir Test suite requiring temporary directory change
-
TestSuiteTest
TestSuiteTest Unit tests for TestSuite class
-
TestUsingTestCase
-
TestsToBeDiscovered
-
ThrowsExceptionTest
-
TwoPassingTests
-
VerboseTestRunDisplay
VerboseTestRunDisplay Print test suite execution results.
-
WrongExceptionThrownTest
-
xunit.mocktests.A
Class A is a TestCase subclass containing two test cases (test_a and test_b).
-
xunit.mocktests.B
Class B is not a TestCase subclass.
-
xunit.mocktests.FooTest
-
Contents.m
-
Contents.m
-
Contents.m
-
Contents.m
-
Readme.m
-
initTestSuite.m
-
View all files
from
MATLAB xUnit Test Framework
by Steve Eddins
MATLAB xUnit is a unit test framework for MATLAB code.
|
| TestComponentInDir |
%TestComponentInDir Test component requiring temporary directory change
% The TestComponentInDir class defines a test component that has to be run by
% first changing to a specified directory.
%
% The setUp method adds the starting directory to the path and then uses cd to
% change into the specified directory. The tearDown method restores the
% original path and directory.
%
% TestComponentInDir methods:
% TestComponentInDir - Constructor
% setUp - Add test directory to MATLAB path
% tearDown - Restore original MATLAB path
%
% See also TestComponent
% Steven L. Eddins
% Copyright 2008-2009 The MathWorks, Inc.
classdef TestComponentInDir < TestComponent
properties (SetAccess = private, GetAccess = protected)
%TestDirectory - Directory to change to in the test fixture
TestDirectory
%OriginalPath - Path prior to adding the starting directory
OriginalPath
%OriginalDirectory - Starting directory
OriginalDirectory
end
methods
function self = TestComponentInDir(testDirectory)
%TestCaseInDir Constructor
% TestCaseInDir(testName, testDirectory) constructs a test case
% using the specified name and located in the specified directory.
self.TestDirectory = testDirectory;
end
function setUp(self)
%setUp Add test directory to MATLAB path
% test_case.setUp() saves the current directory in the
% OriginalDirectory property, saves the current path in the
% OriginalPath property, and then uses cd to change into the test
% directory.
self.OriginalDirectory = pwd;
self.OriginalPath = path;
addpath(pwd);
cd(self.TestDirectory);
end
function tearDown(self)
%tearDown Restore original MATLAB path and directory
% test_case.tearDown() restores the original path and directory.
cd(self.OriginalDirectory);
path(self.OriginalPath);
end
end
end
|
|
Contact us