-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bb3514b
commit 184fa81
Showing
1 changed file
with
49 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
classdef InstallExtensionTest < matlab.unittest.TestCase | ||
|
||
methods (TestClassSetup) | ||
function setupClass(testCase) | ||
% Get the root path of the matnwb repository | ||
rootPath = misc.getMatnwbDir(); | ||
|
||
% Use a fixture to add the folder to the search path | ||
testCase.applyFixture(matlab.unittest.fixtures.PathFixture(rootPath)); | ||
|
||
% Use a fixture to create a temporary working directory | ||
testCase.applyFixture(matlab.unittest.fixtures.WorkingFolderFixture); | ||
generateCore('savedir', '.'); | ||
end | ||
end | ||
|
||
methods (Test) | ||
function testInstallExtension(testCase) | ||
nwbInstallExtension("ndx-miniscope", 'savedir', '.') | ||
|
||
testCase.verifyTrue(isfolder('./+types/+ndx_miniscope'), ... | ||
'Folder with extension types does not exist') | ||
end | ||
|
||
function testUseInstalledExtension(testCase) | ||
nwbObject = testCase.initNwbFile(); | ||
|
||
miniscopeDevice = types.ndx_miniscope.Miniscope(... | ||
'deviceType', 'test_device', ... | ||
'compression', 'GREY', ... | ||
'frameRate', '30fps', ... | ||
'framesPerFile', int8(100) ); | ||
|
||
nwbObject.general_devices.set('TestMiniscope', miniscopeDevice); | ||
|
||
testCase.verifyClass(nwbObject.general_devices.get('TestMiniscope'), ... | ||
'types.ndx_miniscope.Miniscope') | ||
end | ||
end | ||
|
||
methods (Static) | ||
function nwb = initNwbFile() | ||
nwb = NwbFile( ... | ||
'session_description', 'test file for nwb extension', ... | ||
'identifier', 'export_test', ... | ||
'session_start_time', datetime("now", 'TimeZone', 'local') ); | ||
end | ||
end | ||
end |