-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding some unit/integration tests for matpyuda
- Loading branch information
Stephen Dixon
authored and
Stephen Dixon
committed
Jul 26, 2023
1 parent
c14a157
commit 6c84291
Showing
5 changed files
with
188 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
source/wrappers/matlab/pyuda_interface/+matpyuda/MastClient.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
148 changes: 148 additions & 0 deletions
148
source/wrappers/matlab/pyuda_interface/TestMatpyudaMast.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,148 @@ | ||
function tests = TestMatpyudaMast | ||
tests = functiontests(localfunctions); | ||
end | ||
|
||
function test_base_client_constructor(testCase) | ||
try | ||
client = matpyuda.Client(); | ||
verifyInstanceOf(testCase, client, ?matpyuda.Client); | ||
catch(ME) | ||
verifyFail(testCase); | ||
end | ||
end | ||
|
||
function test_get_port(testCase) | ||
client = matpyuda.Client(); | ||
port = client.port(); | ||
verifyClass(testCase, port, ?int32); | ||
end | ||
|
||
function test_getset_port(testCase) | ||
client = matpyuda.Client(); | ||
client.port = 12345; | ||
port = client.port(); | ||
verifyEqual(testCase, port, int32(12345)); | ||
end | ||
|
||
function test_get_server(testCase) | ||
client = matpyuda.Client(); | ||
server = client.server(); | ||
verifyClass(testCase, server, ?string); | ||
end | ||
|
||
function test_getset_server(testCase) | ||
client = matpyuda.Client(); | ||
client.server = "madeup.server.addr"; | ||
server = client.server(); | ||
verifyEqual(testCase, server, "madeup.server.addr"); | ||
end | ||
|
||
function test_get_property_logical(testCase) | ||
client = matpyuda.Client(); | ||
p = client.get_property("get_meta"); | ||
verifyTrue(testCase, islogical(p)); | ||
end | ||
|
||
function test_getset_property_logical(testCase) | ||
client = matpyuda.Client(); | ||
client.set_property('get_meta', py.False); | ||
p(1) = client.get_property("get_meta"); | ||
client.set_property('get_meta', py.True); | ||
p(2) = client.get_property("get_meta"); | ||
verifyEqual(testCase, p, [false, true]); | ||
end | ||
|
||
function test_get_property_val(testCase) | ||
client = matpyuda.Client(); | ||
p = client.get_property("timeout"); | ||
verifyTrue(testCase, isnumeric(p)); | ||
end | ||
|
||
function test_getset_property_val(testCase) | ||
client = matpyuda.Client(); | ||
client.set_property('timeout', 0); | ||
p(1) = client.get_property("timeout"); | ||
client.set_property('timeout', 600); | ||
p(2) = client.get_property("timeout"); | ||
verifyEqual(testCase, p, int32([0, 600])); | ||
end | ||
|
||
function test_get_string(testCase) | ||
client = matpyuda.Client(); | ||
client.port =56565; | ||
client.server ="uda2.mast.l"; | ||
|
||
s = client.get("help::help()", ""); | ||
verifyClass(testCase, s, ?string); | ||
|
||
end | ||
|
||
function test_get_1d_double_signal(testCase) | ||
client = matpyuda.Client(); | ||
client.port = 56565; | ||
client.server= "uda2.mast.l"; | ||
client.set_property('get_meta', py.True); | ||
|
||
ip = client.get('ip', '30420'); | ||
assertClass(testCase, ip, ?matpyuda.Signal); | ||
verifyEqual(testCase, length(ip.data), 30000); | ||
verifyEqual(testCase, length(ip.dims), 1); | ||
verifyEqual(testCase, length(ip.dims.data), 30000); | ||
verifyEqual(testCase, length(ip.errors), 30000); | ||
|
||
verifyEqual(testCase, ip.label, "Plasma Current"); | ||
verifyEqual(testCase, ip.units, "kA"); | ||
verifyEqual(testCase, ip.description, ""); | ||
|
||
assertClass(testCase, ip.meta, ?struct); | ||
verifyEqual(testCase, ip.meta.exp_number, int32(30420)); | ||
end | ||
|
||
%function test_get_signal_meta(testCase) | ||
% | ||
%end | ||
|
||
%function test_get_2d_double_signal(testCase) | ||
% | ||
%end | ||
|
||
%function test_get_1d_int_signal(testCase) | ||
% | ||
%end | ||
|
||
%function test_get_2d_int_signal(testCase) | ||
% | ||
%end | ||
|
||
%function test_get_structured(testCase) | ||
% | ||
%end | ||
|
||
%function test_get_video(testCase) | ||
% | ||
%end | ||
|
||
% FOLLOWING TESTS REQUIRE MastClient IMPLEMENTATION TO BE UNCOMMENTED IN MATPYUDA PYTOHN PACKAGE | ||
% ... mast specific stuff eventually needs to move out of this main repo ... | ||
|
||
%function test_mast_client_constructor(testCase) | ||
% try | ||
% client = matpyuda.MastClient(); | ||
% verifyInstanceOf(testCase, client, ?matpyuda.Client); | ||
% catch(ME) | ||
% verifyFail(testCase); | ||
% end | ||
%end | ||
|
||
%function test_mast_list_signals(testCase) | ||
% client = matpyuda.MastClient(); | ||
% client.port = 56565; | ||
% client.server = "uda2.mast.l"; | ||
% | ||
% python_list = client.python_client.list_signals(alias='ane', shot='27999'); | ||
% matlab_list = client.list_signals(alias='ane', shot='27999'); | ||
% | ||
% verifyEqual(testCase, length(matlab_list), length(python_list)); | ||
% verifyEqual(testCase, matlab_list(1).signal_name, string(python_list{1}.signal_name)); | ||
% | ||
%end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
from .matpyuda import Client | ||
from .matpyuda import Client #, MastClient |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters