diff --git a/manualTests/miss_hit.cfg b/manualTests/miss_hit.cfg index f59bdb02..d86aaeb0 100644 --- a/manualTests/miss_hit.cfg +++ b/manualTests/miss_hit.cfg @@ -1,7 +1,6 @@ # style guide (https://florianschanda.github.io/miss_hit/style_checker.html) line_length: 100 regex_function_name: "((test_[a-z]+)|[a-z]+)(([A-Z]){1}[A-Za-z]+)*" -suppress_rule: "copyright_notice" # metrics limit for the code quality (https://florianschanda.github.io/miss_hit/metrics.html) metric "cnest": limit 4 diff --git a/manualTests/test_makeRawDataset.m b/manualTests/test_makeRawDataset.m index 4575f742..7008843f 100644 --- a/manualTests/test_makeRawDataset.m +++ b/manualTests/test_makeRawDataset.m @@ -1,3 +1,5 @@ +% (C) Copyright 2020 CPP_BIDS developers + function test_makeRawDataset() outputDir = fullfile(fileparts(mfilename('fullpath')), 'output'); diff --git a/src/templates/miss_hit.cfg b/src/templates/miss_hit.cfg new file mode 100644 index 00000000..d86aaeb0 --- /dev/null +++ b/src/templates/miss_hit.cfg @@ -0,0 +1,9 @@ +# style guide (https://florianschanda.github.io/miss_hit/style_checker.html) +line_length: 100 +regex_function_name: "((test_[a-z]+)|[a-z]+)(([A-Z]){1}[A-Za-z]+)*" + +# metrics limit for the code quality (https://florianschanda.github.io/miss_hit/metrics.html) +metric "cnest": limit 4 +metric "file_length": limit 500 +metric "cyc": limit 15 +metric "parameters": limit 5 \ No newline at end of file diff --git a/src/templates/templateFunction.m b/src/templates/templateFunction.m index b222ebc9..3ac5e46b 100644 --- a/src/templates/templateFunction.m +++ b/src/templates/templateFunction.m @@ -17,8 +17,13 @@ % :param argin3: (dimension) optional argument % :type argin3: integer % - % :returns: - :argout1: (type) (dimension) - % - :argout2: (type) (dimension) + % :returns: + % :argout1: (type) (dimension) + % :argout2: (type) (dimension) + % + % :output: + % :file created: description + % :other file created: description % % .. todo: % diff --git a/src/templates/templateTest.m b/src/templates/templateTest.m new file mode 100644 index 00000000..73b91769 --- /dev/null +++ b/src/templates/templateTest.m @@ -0,0 +1,29 @@ +% (C) Copyright 2020 CPP_BIDS developers + +function test_suite = test_templateTest %#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_templateTestBasic() + + %% set up + + % cfg.input_1 = ... + + %% use function to test + + % actualOupout = foo(cfg); + + %% assert that output content / type / size is what you expect + + % expectedOuput = X; + + % assertEqual(actualOupout, expectedOuput) + + %% clean up (delete temporary files that were created) + +end diff --git a/tests/miss_hit.cfg b/tests/miss_hit.cfg index f59bdb02..d86aaeb0 100644 --- a/tests/miss_hit.cfg +++ b/tests/miss_hit.cfg @@ -1,7 +1,6 @@ # style guide (https://florianschanda.github.io/miss_hit/style_checker.html) line_length: 100 regex_function_name: "((test_[a-z]+)|[a-z]+)(([A-Z]){1}[A-Za-z]+)*" -suppress_rule: "copyright_notice" # metrics limit for the code quality (https://florianschanda.github.io/miss_hit/metrics.html) metric "cnest": limit 4 diff --git a/tests/test_askForGroupAndOrSession.m b/tests/test_askForGroupAndOrSession.m index cfa91a0a..e01e1918 100644 --- a/tests/test_askForGroupAndOrSession.m +++ b/tests/test_askForGroupAndOrSession.m @@ -1,3 +1,5 @@ +% (C) Copyright 2020 CPP_BIDS developers + function test_suite = test_askForGroupAndOrSession %#ok<*STOUT> try % assignment of 'localfunctions' is necessary in Matlab >= 2016 test_functions = localfunctions(); %#ok<*NASGU> diff --git a/tests/test_checkCFG.m b/tests/test_checkCFG.m index 25809d22..b2c9d787 100644 --- a/tests/test_checkCFG.m +++ b/tests/test_checkCFG.m @@ -1,3 +1,5 @@ +% (C) Copyright 2020 CPP_BIDS developers + function test_suite = test_checkCFG %#ok<*STOUT> try % assignment of 'localfunctions' is necessary in Matlab >= 2016 test_functions = localfunctions(); %#ok<*NASGU> diff --git a/tests/test_createDataDictionary.m b/tests/test_createDataDictionary.m index 0f6c2045..8ce43eed 100644 --- a/tests/test_createDataDictionary.m +++ b/tests/test_createDataDictionary.m @@ -1,3 +1,5 @@ +% (C) Copyright 2020 CPP_BIDS developers + function test_suite = test_createDataDictionary %#ok<*STOUT> try % assignment of 'localfunctions' is necessary in Matlab >= 2016 test_functions = localfunctions(); %#ok<*NASGU> diff --git a/tests/test_createDatasetDescription.m b/tests/test_createDatasetDescription.m index f7b6983e..3d96c9e5 100644 --- a/tests/test_createDatasetDescription.m +++ b/tests/test_createDatasetDescription.m @@ -1,3 +1,5 @@ +% (C) Copyright 2020 CPP_BIDS developers + function test_suite = test_createDatasetDescription %#ok<*STOUT> try % assignment of 'localfunctions' is necessary in Matlab >= 2016 test_functions = localfunctions(); %#ok<*NASGU> diff --git a/tests/test_createFilename.m b/tests/test_createFilename.m index 36f5b546..89721fee 100644 --- a/tests/test_createFilename.m +++ b/tests/test_createFilename.m @@ -1,3 +1,5 @@ +% (C) Copyright 2020 CPP_BIDS developers + function test_suite = test_createFilename %#ok<*STOUT> try % assignment of 'localfunctions' is necessary in Matlab >= 2016 test_functions = localfunctions(); %#ok<*NASGU> diff --git a/tests/test_createJson.m b/tests/test_createJson.m index 2eedd989..a2f164c9 100644 --- a/tests/test_createJson.m +++ b/tests/test_createJson.m @@ -1,3 +1,5 @@ +% (C) Copyright 2020 CPP_BIDS developers + function test_suite = test_createJson %#ok<*STOUT> try % assignment of 'localfunctions' is necessary in Matlab >= 2016 test_functions = localfunctions(); %#ok<*NASGU> diff --git a/tests/test_createQuestionList.m b/tests/test_createQuestionList.m index fce8587c..f8be1412 100644 --- a/tests/test_createQuestionList.m +++ b/tests/test_createQuestionList.m @@ -1,3 +1,5 @@ +% (C) Copyright 2020 CPP_BIDS developers + function test_suite = test_createQuestionList %#ok<*STOUT> try % assignment of 'localfunctions' is necessary in Matlab >= 2016 test_functions = localfunctions(); %#ok<*NASGU> diff --git a/tests/test_createValidName.m b/tests/test_createValidName.m index d191c0ac..7486468a 100644 --- a/tests/test_createValidName.m +++ b/tests/test_createValidName.m @@ -1,3 +1,5 @@ +% (C) Copyright 2020 CPP_BIDS developers + function test_suite = test_createValidName %#ok<*STOUT> try % assignment of 'localfunctions' is necessary in Matlab >= 2016 test_functions = localfunctions(); %#ok<*NASGU> diff --git a/tests/test_getIsQuestionToAsk.m b/tests/test_getIsQuestionToAsk.m index a53b0892..94aaf0d1 100644 --- a/tests/test_getIsQuestionToAsk.m +++ b/tests/test_getIsQuestionToAsk.m @@ -1,3 +1,5 @@ +% (C) Copyright 2020 CPP_BIDS developers + function test_suite = test_getIsQuestionToAsk %#ok<*STOUT> try % assignment of 'localfunctions' is necessary in Matlab >= 2016 test_functions = localfunctions(); %#ok<*NASGU> diff --git a/tests/test_isPositiveInteger.m b/tests/test_isPositiveInteger.m index 9945ff5e..beaf0902 100644 --- a/tests/test_isPositiveInteger.m +++ b/tests/test_isPositiveInteger.m @@ -1,3 +1,5 @@ +% (C) Copyright 2020 CPP_BIDS developers + function test_suite = test_isPositiveInteger %#ok<*STOUT> try % assignment of 'localfunctions' is necessary in Matlab >= 2016 test_functions = localfunctions(); %#ok<*NASGU> diff --git a/tests/test_readAndFilterLogfile.m b/tests/test_readAndFilterLogfile.m index ab2c49c7..cba936a7 100644 --- a/tests/test_readAndFilterLogfile.m +++ b/tests/test_readAndFilterLogfile.m @@ -1,3 +1,5 @@ +% (C) Copyright 2020 CPP_BIDS developers + function test_suite = test_readAndFilterLogfile %#ok<*STOUT> try % assignment of 'localfunctions' is necessary in Matlab >= 2016 test_functions = localfunctions(); %#ok<*NASGU> diff --git a/tests/test_removeDateSuffix.m b/tests/test_removeDateSuffix.m index edb360af..e13f95a2 100644 --- a/tests/test_removeDateSuffix.m +++ b/tests/test_removeDateSuffix.m @@ -1,3 +1,5 @@ +% (C) Copyright 2020 CPP_BIDS developers + function test_suite = test_removeDateSuffix %#ok<*STOUT> try % assignment of 'localfunctions' is necessary in Matlab >= 2016 test_functions = localfunctions(); %#ok<*NASGU> diff --git a/tests/test_saveEventsFileInit.m b/tests/test_saveEventsFileInit.m index ff4aac42..059e2f85 100644 --- a/tests/test_saveEventsFileInit.m +++ b/tests/test_saveEventsFileInit.m @@ -1,3 +1,5 @@ +% (C) Copyright 2020 CPP_BIDS developers + function test_suite = test_saveEventsFileInit %#ok<*STOUT> try % assignment of 'localfunctions' is necessary in Matlab >= 2016 test_functions = localfunctions(); %#ok<*NASGU> diff --git a/tests/test_saveEventsFileOpen.m b/tests/test_saveEventsFileOpen.m index 6935ab92..91f0738c 100644 --- a/tests/test_saveEventsFileOpen.m +++ b/tests/test_saveEventsFileOpen.m @@ -1,3 +1,5 @@ +% (C) Copyright 2020 CPP_BIDS developers + function test_suite = test_saveEventsFileOpen %#ok<*STOUT> try % assignment of 'localfunctions' is necessary in Matlab >= 2016 test_functions = localfunctions(); %#ok<*NASGU> diff --git a/tests/test_saveEventsFileOpenMultiColumn.m b/tests/test_saveEventsFileOpenMultiColumn.m index 89864533..8b88cbc1 100644 --- a/tests/test_saveEventsFileOpenMultiColumn.m +++ b/tests/test_saveEventsFileOpenMultiColumn.m @@ -1,3 +1,5 @@ +% (C) Copyright 2020 CPP_BIDS developers + function test_suite = test_saveEventsFileOpenMultiColumn %#ok<*STOUT> try % assignment of 'localfunctions' is necessary in Matlab >= 2016 test_functions = localfunctions(); %#ok<*NASGU> diff --git a/tests/test_saveEventsFileSave.m b/tests/test_saveEventsFileSave.m index 971000bd..b2b504aa 100644 --- a/tests/test_saveEventsFileSave.m +++ b/tests/test_saveEventsFileSave.m @@ -1,3 +1,5 @@ +% (C) Copyright 2020 CPP_BIDS developers + function test_suite = test_saveEventsFileSave %#ok<*STOUT> try % assignment of 'localfunctions' is necessary in Matlab >= 2016 test_functions = localfunctions(); %#ok<*NASGU> diff --git a/tests/test_setDefaultFields.m b/tests/test_setDefaultFields.m index 39ca05d4..1a9d5dd4 100644 --- a/tests/test_setDefaultFields.m +++ b/tests/test_setDefaultFields.m @@ -1,3 +1,5 @@ +% (C) Copyright 2020 CPP_BIDS developers + function test_suite = test_setDefaultFields %#ok<*STOUT> try % assignment of 'localfunctions' is necessary in Matlab >= 2016 test_functions = localfunctions(); %#ok<*NASGU> diff --git a/tests/test_setDefaultResponses.m b/tests/test_setDefaultResponses.m index 90500326..a8df533c 100644 --- a/tests/test_setDefaultResponses.m +++ b/tests/test_setDefaultResponses.m @@ -1,3 +1,5 @@ +% (C) Copyright 2020 CPP_BIDS developers + function test_suite = test_setDefaultResponses %#ok<*STOUT> try % assignment of 'localfunctions' is necessary in Matlab >= 2016 test_functions = localfunctions(); %#ok<*NASGU> diff --git a/tests/test_transferInfoToBids.m b/tests/test_transferInfoToBids.m index 555331a0..d68b544c 100644 --- a/tests/test_transferInfoToBids.m +++ b/tests/test_transferInfoToBids.m @@ -1,3 +1,5 @@ +% (C) Copyright 2020 CPP_BIDS developers + function test_suite = test_transferInfoToBids %#ok<*STOUT> try % assignment of 'localfunctions' is necessary in Matlab >= 2016 test_functions = localfunctions(); %#ok<*NASGU> diff --git a/tests/test_utils.m b/tests/test_utils.m index d7f4d771..2dc86ee2 100644 --- a/tests/test_utils.m +++ b/tests/test_utils.m @@ -1,3 +1,5 @@ +% (C) Copyright 2020 CPP_BIDS developers + function test_suite = test_utils %#ok<*STOUT> try % assignment of 'localfunctions' is necessary in Matlab >= 2016 test_functions = localfunctions(); %#ok<*NASGU>