35 lines
886 B
Matlab
35 lines
886 B
Matlab
classdef test_isLeap < matlab.unittest.TestCase
|
|
|
|
methods(TestClassSetup)
|
|
% Shared setup for the entire test class
|
|
end
|
|
|
|
methods(TestMethodSetup)
|
|
% Setup for each test
|
|
end
|
|
|
|
methods(Test)
|
|
% Test methods
|
|
|
|
function test_basic_2001(testCase)
|
|
testCase.verifyFalse(isLeap(2001));
|
|
end
|
|
|
|
function test_basic_1996(testCase)
|
|
testCase.verifyTrue(isLeap(1996));
|
|
end
|
|
|
|
function test_exception1_2100(testCase)
|
|
testCase.verifyFalse(isLeap(2100));
|
|
end
|
|
|
|
function test_exception2_2000(testCase)
|
|
testCase.verifyTrue(isLeap(2000));
|
|
end
|
|
|
|
function test_vectorized_all(testCase)
|
|
testCase.verifyEqual([true; false; false; false; true; false], isLeap([2000; 1999; 1998; 1997; 1996; 2100]));
|
|
end
|
|
end
|
|
|
|
end |