Skip to content

Commit 14e4f0c

Browse files
committed
test with R2023b
1 parent 8faa37b commit 14e4f0c

File tree

4 files changed

+71
-64
lines changed

4 files changed

+71
-64
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919

2020
strategy:
2121
matrix:
22-
release: [R2021a, R2025a]
22+
release: [R2023b, R2025a]
2323

2424
steps:
2525
- uses: actions/checkout@v4

.github/workflows/composite-buildtool/action.yml

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,14 @@ runs:
66

77
steps:
88

9-
- name: Run Matlab buildtool
10-
if: ${{ matrix.release >= 'R2024a' }}
9+
- name: Check Matlab Syntax
10+
if: ${{ matrix.release >= 'R2023b' }}
1111
uses: matlab-actions/run-build@v2
1212
with:
13-
startup-options: ${{ matrix.startup-options }}
14-
tasks: check test
13+
tasks: check
1514

16-
17-
- name: Run tests (manual)
18-
if: ${{ matrix.release < 'R2024a' }}
19-
uses: matlab-actions/run-tests@v2
20-
with:
21-
source-folder: addpath("${{ github.workspace }}")
22-
startup-options: -sd ./test -logfile ${{ matrix.release }}-${{ runner.os }}-test.log
23-
24-
25-
- name: upload logfile
26-
if: ${{ hashFiles(matrix.release-runner.os-test.log) != '' }}
27-
uses: actions/upload-artifact@v4
15+
- name: Test Matlab Code
16+
if: ${{ matrix.release >= 'R2023b' }}
17+
uses: matlab-actions/run-build@v2
2818
with:
29-
name: ${{ matrix.release }}-${{ runner.os }}-test-log
30-
path: ${{ matrix.release }}-${{ runner.os }}-test.log
31-
retention-days: 1
19+
tasks: test

buildfile.m

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,12 @@
44

55
addpath(plan.RootFolder)
66

7-
plan.DefaultTasks = "test";
8-
97
pkg_name = "+matmap3d";
108

11-
plan("check") = matlab.buildtool.tasks.CodeIssuesTask(pkg_name, Results="CodeIssues.sarif", ...
12-
IncludeSubfolders=true, WarningThreshold=0);
13-
plan("test") = matlab.buildtool.tasks.TestTask("test", TestResults="TestResults.xml", Strict=false);
9+
if ~isMATLABReleaseOlderThan("R2023b")
10+
plan("check") = matlab.buildtool.tasks.CodeIssuesTask(pkg_name, IncludeSubfolders=true, WarningThreshold=0);
11+
plan("test") = matlab.buildtool.tasks.TestTask("test", Strict=false);
12+
end
1413

1514
if ~isMATLABReleaseOlderThan("R2024a")
1615
plan("coverage") = matlab.buildtool.tasks.TestTask(Description="code coverage", SourceFiles="test", Strict=false, CodeCoverageResults="code-coverage.xml");

test/TestUnit.m

Lines changed: 59 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
properties
44
atol = 1e-9
55
rtol = 1e-6
6-
E = matmap3d.wgs84Ellipsoid()
76
angleUnit='d'
87
lat = 42
98
lon = -82
@@ -34,58 +33,62 @@
3433
methods(Test)
3534

3635
function test_ellipsoid(tc)
37-
tc.verifyClass(tc.E, 'matmap3d.referenceEllipsoid')
36+
tc.verifyClass(matmap3d.wgs84Ellipsoid(), 'matmap3d.referenceEllipsoid')
3837
end
3938

4039
function test_geodetic2ecef(tc)
4140

42-
[x,y,z] = matmap3d.geodetic2ecef(tc.E, tc.lat, tc.lon, tc.alt, tc.angleUnit);
41+
E = matmap3d.wgs84Ellipsoid();
42+
43+
[x,y,z] = matmap3d.geodetic2ecef(E, tc.lat, tc.lon, tc.alt, tc.angleUnit);
4344
tc.verifyEqual([x,y,z], [tc.x0, tc.y0, tc.z0], AbsTol=tc.atol, RelTol=tc.rtol)
4445

4546
[x,y,z] = matmap3d.geodetic2ecef([], 0,0,-1);
46-
tc.verifyEqual([x,y,z], [tc.E.SemimajorAxis-1,0,0], AbsTol=tc.atol, RelTol=tc.rtol)
47+
tc.verifyEqual([x,y,z], [E.SemimajorAxis-1,0,0], AbsTol=tc.atol, RelTol=tc.rtol)
4748

48-
[x,y,z] = matmap3d.geodetic2ecef(tc.E, 0,90,-1);
49-
tc.verifyEqual([x,y,z], [0, tc.E.SemimajorAxis-1,0], AbsTol=tc.atol, RelTol=tc.rtol)
49+
[x,y,z] = matmap3d.geodetic2ecef(E, 0,90,-1);
50+
tc.verifyEqual([x,y,z], [0, E.SemimajorAxis-1,0], AbsTol=tc.atol, RelTol=tc.rtol)
5051

51-
[x,y,z] = matmap3d.geodetic2ecef(tc.E, 0,-90,-1);
52-
tc.verifyEqual([x,y,z], [0, -tc.E.SemimajorAxis+1,0], AbsTol=tc.atol, RelTol=tc.rtol)
52+
[x,y,z] = matmap3d.geodetic2ecef(E, 0,-90,-1);
53+
tc.verifyEqual([x,y,z], [0, -E.SemimajorAxis+1,0], AbsTol=tc.atol, RelTol=tc.rtol)
5354

54-
[x,y,z] = matmap3d.geodetic2ecef(tc.E, 90,0,-1);
55-
tc.verifyEqual([x,y,z], [0,0,tc.E.SemiminorAxis-1], AbsTol=tc.atol, RelTol=tc.rtol)
55+
[x,y,z] = matmap3d.geodetic2ecef(E, 90,0,-1);
56+
tc.verifyEqual([x,y,z], [0, 0, E.SemiminorAxis-1], AbsTol=tc.atol, RelTol=tc.rtol)
5657

57-
[x,y,z] = matmap3d.geodetic2ecef(tc.E, 90,15,-1);
58-
tc.verifyEqual([x,y,z], [0,0,tc.E.SemiminorAxis-1], AbsTol=tc.atol, RelTol=tc.rtol)
58+
[x,y,z] = matmap3d.geodetic2ecef(E, 90,15,-1);
59+
tc.verifyEqual([x,y,z], [0,0, E.SemiminorAxis-1], AbsTol=tc.atol, RelTol=tc.rtol)
5960

60-
[x,y,z] = matmap3d.geodetic2ecef(tc.E, -90,0,-1);
61-
tc.verifyEqual([x,y,z], [0,0,-tc.E.SemiminorAxis+1], AbsTol=tc.atol, RelTol=tc.rtol)
61+
[x,y,z] = matmap3d.geodetic2ecef(E, -90,0,-1);
62+
tc.verifyEqual([x,y,z], [0,0, -E.SemiminorAxis+1], AbsTol=tc.atol, RelTol=tc.rtol)
6263

6364
end
6465

6566
function test_ecef2geodetic(tc)
6667

67-
ea = tc.E.SemimajorAxis;
68-
eb = tc.E.SemiminorAxis;
68+
E = matmap3d.wgs84Ellipsoid();
69+
70+
ea = E.SemimajorAxis;
71+
eb = E.SemiminorAxis;
6972

70-
[lt, ln, at] = matmap3d.ecef2geodetic(tc.E, tc.x0, tc.y0, tc.z0, tc.angleUnit);
73+
[lt, ln, at] = matmap3d.ecef2geodetic(E, tc.x0, tc.y0, tc.z0, tc.angleUnit);
7174
tc.verifyEqual([lt, ln, at], [tc.lat, tc.lon, tc.alt], AbsTol=tc.atol, RelTol=tc.rtol)
7275

7376
[lt, ln, at] = matmap3d.ecef2geodetic([], ea-1, 0, 0);
7477
tc.verifyEqual([lt, ln, at], [0, 0, -1], AbsTol=tc.atol, RelTol=tc.rtol)
7578

76-
[lt, ln, at] = matmap3d.ecef2geodetic(tc.E, 0, ea-1, 0);
79+
[lt, ln, at] = matmap3d.ecef2geodetic(E, 0, ea-1, 0);
7780
tc.verifyEqual([lt, ln, at], [0, 90, -1], AbsTol=tc.atol, RelTol=tc.rtol)
7881

79-
[lt, ln, at] = matmap3d.ecef2geodetic(tc.E, 0, 0, eb-1);
82+
[lt, ln, at] = matmap3d.ecef2geodetic(E, 0, 0, eb-1);
8083
tc.verifyEqual([lt, ln, at], [90, 0, -1], AbsTol=tc.atol, RelTol=tc.rtol)
8184

82-
[lt, ln, at] = matmap3d.ecef2geodetic(tc.E, 0, 0, -eb+1);
85+
[lt, ln, at] = matmap3d.ecef2geodetic(E, 0, 0, -eb+1);
8386
tc.verifyEqual([lt, ln, at], [-90, 0, -1], AbsTol=tc.atol, RelTol=tc.rtol)
8487

85-
[lt, ln, at] = matmap3d.ecef2geodetic(tc.E, -ea+1, 0, 0);
88+
[lt, ln, at] = matmap3d.ecef2geodetic(E, -ea+1, 0, 0);
8689
tc.verifyEqual([lt, ln, at], [0, 180, -1], AbsTol=tc.atol, RelTol=tc.rtol)
8790

88-
[lt, ln, at] = matmap3d.ecef2geodetic(tc.E, (ea-1000)/sqrt(2), (ea-1000)/sqrt(2), 0);
91+
[lt, ln, at] = matmap3d.ecef2geodetic(E, (ea-1000)/sqrt(2), (ea-1000)/sqrt(2), 0);
8992
tc.verifyEqual([lt,ln,at], [0,45,-1000], AbsTol=tc.atol, RelTol=tc.rtol)
9093

9194
end
@@ -113,66 +116,74 @@ function test_aer2enu(tc)
113116

114117
function test_ecef2aer(tc)
115118

116-
[a, e, r] = matmap3d.ecef2aer(tc.xl, tc.yl, tc.zl, tc.lat, tc.lon, tc.alt, tc.E, tc.angleUnit);
119+
E = matmap3d.wgs84Ellipsoid();
120+
121+
[a, e, r] = matmap3d.ecef2aer(tc.xl, tc.yl, tc.zl, tc.lat, tc.lon, tc.alt, E, tc.angleUnit);
117122
% round-trip
118123
tc.verifyEqual([a,e,r], [tc.az, tc.el, tc.srange], AbsTol=tc.atol, RelTol=tc.rtol)
119124

120125
% singularity check
121-
[a, e, r] = matmap3d.ecef2aer(tc.E.SemimajorAxis-1, 0, 0, 0,0,0, tc.E, tc.angleUnit);
126+
[a, e, r] = matmap3d.ecef2aer(E.SemimajorAxis-1, 0, 0, 0,0,0, E, tc.angleUnit);
122127
tc.verifyEqual([a,e,r], [0, -tc.a90, 1], AbsTol=tc.atol, RelTol=tc.rtol)
123128

124-
[a, e, r] = matmap3d.ecef2aer(-tc.E.SemimajorAxis+1, 0, 0, 0, 2*tc.a90,0, tc.E, tc.angleUnit);
129+
[a, e, r] = matmap3d.ecef2aer(-E.SemimajorAxis+1, 0, 0, 0, 2*tc.a90,0, E, tc.angleUnit);
125130
tc.verifyEqual([a,e,r], [0, -tc.a90, 1], AbsTol=tc.atol, RelTol=tc.rtol)
126131

127-
[a, e, r] = matmap3d.ecef2aer(0, tc.E.SemimajorAxis-1, 0,0, tc.a90,0, tc.E, tc.angleUnit);
132+
[a, e, r] = matmap3d.ecef2aer(0, E.SemimajorAxis-1, 0,0, tc.a90,0, E, tc.angleUnit);
128133
tc.verifyEqual([a,e,r], [0, -tc.a90, 1], AbsTol=tc.atol, RelTol=tc.rtol)
129134

130-
[a, e, r] = matmap3d.ecef2aer(0, -tc.E.SemimajorAxis+1, 0,0, -tc.a90,0, tc.E, tc.angleUnit);
135+
[a, e, r] = matmap3d.ecef2aer(0, -E.SemimajorAxis+1, 0,0, -tc.a90,0, E, tc.angleUnit);
131136
tc.verifyEqual([a,e,r], [0, -tc.a90, 1], AbsTol=tc.atol, RelTol=tc.rtol)
132137

133-
[a, e, r] = matmap3d.ecef2aer(0, 0, tc.E.SemiminorAxis-1, tc.a90, 0, 0, tc.E, tc.angleUnit);
138+
[a, e, r] = matmap3d.ecef2aer(0, 0, E.SemiminorAxis-1, tc.a90, 0, 0, E, tc.angleUnit);
134139
tc.verifyEqual([a,e,r], [0, -tc.a90, 1], AbsTol=tc.atol, RelTol=tc.rtol)
135140

136-
[a, e, r] = matmap3d.ecef2aer(0, 0, -tc.E.SemiminorAxis+1,-tc.a90,0,0, tc.E, tc.angleUnit);
141+
[a, e, r] = matmap3d.ecef2aer(0, 0, -E.SemiminorAxis+1,-tc.a90,0,0, E, tc.angleUnit);
137142
tc.verifyEqual([a,e,r], [0, -tc.a90, 1], AbsTol=tc.atol, RelTol=tc.rtol)
138143

139-
[a, e, r] = matmap3d.ecef2aer((tc.E.SemimajorAxis-1000)/sqrt(2), (tc.E.SemimajorAxis-1000)/sqrt(2), 0, 0, 45, 0);
144+
[a, e, r] = matmap3d.ecef2aer((E.SemimajorAxis-1000)/sqrt(2), (E.SemimajorAxis-1000)/sqrt(2), 0, 0, 45, 0);
140145
tc.verifyEqual([a,e,r],[0,-90,1000], AbsTol=tc.atol, RelTol=tc.rtol)
141146

142-
[x,y,z] = matmap3d.aer2ecef(tc.az, tc.el, tc.srange, tc.lat, tc.lon, tc.alt,tc.E, tc.angleUnit);
147+
[x,y,z] = matmap3d.aer2ecef(tc.az, tc.el, tc.srange, tc.lat, tc.lon, tc.alt, E, tc.angleUnit);
143148
tc.verifyEqual([x,y,z], [tc.xl, tc.yl, tc.zl], AbsTol=tc.atol, RelTol=tc.rtol)
144149

145-
[a,e,r] = matmap3d.ecef2aer(x,y,z, tc.lat, tc.lon, tc.alt, tc.E, tc.angleUnit);
150+
[a,e,r] = matmap3d.ecef2aer(x,y,z, tc.lat, tc.lon, tc.alt, E, tc.angleUnit);
146151
tc.verifyEqual([a,e,r], [tc.az, tc.el, tc.srange], AbsTol=tc.atol, RelTol=tc.rtol)
147152
end
148153

149154
function test_geodetic2aer(tc)
150155

151-
[lt,ln,at] = matmap3d.aer2geodetic(tc.az, tc.el, tc.srange, tc.lat, tc.lon, tc.alt, tc.E, tc.angleUnit);
156+
E = matmap3d.wgs84Ellipsoid();
157+
158+
[lt,ln,at] = matmap3d.aer2geodetic(tc.az, tc.el, tc.srange, tc.lat, tc.lon, tc.alt, E, tc.angleUnit);
152159
tc.verifyEqual([lt,ln,at], [tc.lat1, tc.lon1, tc.alt1], AbsTol=2*tc.atol_dist)
153160

154-
[a, e, r] = matmap3d.geodetic2aer(lt,ln,at, tc.lat, tc.lon, tc.alt, tc.E, tc.angleUnit); % round-trip
161+
[a, e, r] = matmap3d.geodetic2aer(lt,ln,at, tc.lat, tc.lon, tc.alt, E, tc.angleUnit); % round-trip
155162
tc.verifyEqual([a,e,r], [tc.az, tc.el, tc.srange], AbsTol=tc.atol, RelTol=tc.rtol)
156163
end
157164

158165
function test_geodetic2enu(tc)
159166

160-
[e, n, u] = matmap3d.geodetic2enu(tc.lat, tc.lon, tc.alt-1, tc.lat, tc.lon, tc.alt, tc.E, tc.angleUnit);
167+
E = matmap3d.wgs84Ellipsoid();
168+
169+
[e, n, u] = matmap3d.geodetic2enu(tc.lat, tc.lon, tc.alt-1, tc.lat, tc.lon, tc.alt, E, tc.angleUnit);
161170
tc.verifyEqual([e,n,u], [0,0,-1], AbsTol=tc.atol, RelTol=tc.rtol)
162171

163-
[lt, ln, at] = matmap3d.enu2geodetic(e,n,u,tc.lat,tc.lon,tc.alt, tc.E, tc.angleUnit); % round-trip
172+
[lt, ln, at] = matmap3d.enu2geodetic(e,n,u,tc.lat,tc.lon,tc.alt, E, tc.angleUnit); % round-trip
164173
tc.verifyEqual([lt, ln, at],[tc.lat, tc.lon, tc.alt-1], AbsTol=tc.atol, RelTol=tc.rtol)
165174
end
166175

167176
function test_enu2ecef(tc)
168177

169-
[x, y, z] = matmap3d.enu2ecef(tc.er, tc.nr, tc.ur, tc.lat,tc.lon,tc.alt, tc.E, tc.angleUnit);
178+
E = matmap3d.wgs84Ellipsoid();
179+
180+
[x, y, z] = matmap3d.enu2ecef(tc.er, tc.nr, tc.ur, tc.lat,tc.lon,tc.alt, E, tc.angleUnit);
170181
tc.verifyEqual([x,y,z],[tc.xl, tc.yl, tc.zl], AbsTol=tc.atol, RelTol=tc.rtol)
171182

172-
[e,n,u] = matmap3d.ecef2enu(x,y,z,tc.lat,tc.lon,tc.alt, tc.E, tc.angleUnit); % round-trip
183+
[e,n,u] = matmap3d.ecef2enu(x,y,z,tc.lat,tc.lon,tc.alt, E, tc.angleUnit); % round-trip
173184
tc.verifyEqual([e,n,u],[tc.er, tc.nr, tc.ur], AbsTol=tc.atol, RelTol=tc.rtol)
174185

175-
[n1, e1, d] = matmap3d.ecef2ned(x,y,z,tc.lat,tc.lon,tc.alt, tc.E, tc.angleUnit);
186+
[n1, e1, d] = matmap3d.ecef2ned(x,y,z,tc.lat,tc.lon,tc.alt, E, tc.angleUnit);
176187
tc.verifyEqual([e,n,u],[e1,n1,-d])
177188
end
178189

@@ -211,6 +222,15 @@ function test_ecef2eci(tc)
211222
tc.verifyEqual(r_eci, [-2981829.07728415; 5207029.04470791; 3161595.0981204], RelTol=1e-5)
212223
end
213224

225+
function test_ecef2eci_null(tc)
226+
E = matmap3d.wgs84Ellipsoid();
227+
228+
[x, y, z] = matmap3d.geodetic2ecef(E, 0, 0, 0);
229+
t = datetime(2000, 1, 1, 12, 0, 0, TimeZone='UTCLeapSeconds');
230+
r_eci = matmap3d.ecef2eci(t, [x;y;z]);
231+
tc.verifyEqual(r_eci, [1158174.72525987; -6272101.9503871; -143.138407305876], RelTol=tc.rtol)
232+
end
233+
214234

215235
function test_eci2aer(tc)
216236
eci = [-3.8454e8, -0.5099e8, -0.3255e8];

0 commit comments

Comments
 (0)