-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_IFC.m
More file actions
63 lines (53 loc) · 2.39 KB
/
test_IFC.m
File metadata and controls
63 lines (53 loc) · 2.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
classdef test_IFC < 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_today(testCase)
ifc = IFC(datetime('28-Dec-2024'));
testCase.verifyEqual(ifc.Year, uint16(2024));
testCase.verifyEqual(ifc.Month, MONTHS(13));
testCase.verifyEqual(ifc.Day, uint8(26));
testCase.verifyEqual(ifc.DayOfWeek, DAYSOFWEEK(5));
end
function test_yearday_noleap(testCase)
ifc = IFC(datetime('31-Dec-2023'));
testCase.verifyEqual(ifc.Year, uint16(2023));
testCase.verifyEqual(ifc.Month, MONTHS(14));
testCase.verifyEqual(ifc.Day, uint8(0));
testCase.verifyEqual(ifc.DayOfWeek, DAYSOFWEEK(7));
end
function test_yearday_leap(testCase)
ifc = IFC(datetime('31-Dec-2020'));
testCase.verifyEqual(ifc.Year, uint16(2020));
testCase.verifyEqual(ifc.Month, MONTHS(14));
testCase.verifyEqual(ifc.Day, uint8(0));
testCase.verifyEqual(ifc.DayOfWeek, DAYSOFWEEK(7));
end
function test_leapday_noleap(testCase)
ifc = IFC(datetime('17-Jun-2003'));
testCase.verifyEqual(ifc.Year, uint16(2003));
testCase.verifyEqual(ifc.Month, MONTHS(6));
testCase.verifyEqual(ifc.Day, uint8(28));
testCase.verifyEqual(ifc.DayOfWeek, DAYSOFWEEK(0));
end
function test_leapday_leap(testCase)
ifc = IFC(datetime('17-Jun-2008'));
testCase.verifyEqual(ifc.Year, uint16(2008));
testCase.verifyEqual(ifc.Month, MONTHS(14));
testCase.verifyEqual(ifc.Day, uint8(0));
testCase.verifyEqual(ifc.DayOfWeek, DAYSOFWEEK(8));
end
function test_all_vectorized(testCase)
ifc = IFC(datetime(["28-Dec-2024"; "31-Dec-2023"; "31-Dec-2020"; "17-Jun-2003"; "17-Jun-2008"]));
testCase.verifyEqual([ifc.Year], uint16([2024; 2023; 2020; 2003; 2008]));
testCase.verifyEqual([ifc.Month], MONTHS([13; 14; 14; 6; 14]));
testCase.verifyEqual([ifc.Day], uint8([26; 0; 0; 28; 0]));
testCase.verifyEqual([ifc.DayOfWeek], DAYSOFWEEK([5; 7; 7; 0; 8]));
end
end
end