cpp-lln-lab / CPP_PTB

a set of function to make it easier to create behavioral, EEG, fMRI experiment with psychtoolbox
https://cpp-ptb.readthedocs.io/en/latest/index.html#
MIT License
12 stars 13 forks source link

unit test for read and filter logfile #78

Closed Remi-Gau closed 3 years ago

Remi-Gau commented 3 years ago

Actually, if you want to try writing a unit test, this function is perfect for it.

function test_suite = test_readOutputFilter %#ok<*STOUT>
    try % assignment of 'localfunctions' is necessary in Matlab >= 2016
        test_functions = localfunctions(); %#ok<*NASGU>
    catch % no problem; early Matlab versions can use initTestSuite fine
    end
    initTestSuite;
end

function test_readOutputFilterBasic()

    %% set up
   cfg = ... % fill in
   filterHeader = ... % fill in
   filterContent  = ... % fill in

   outputFiltered = readOutputFilter(cfg, filterHeader, filterContent)

   %% test data
   expectedOutput = ... % create a structure that describes what output you expect

    %% test
    assertEqual(expectedOutput, outputFiltered); % make sure they match

end

_Originally posted by @Remi-Gau in https://github.com/cpp-lln-lab/CPP_PTB/pull/75#issuecomment-678102618_