diff --git a/.github/workflows/moxunit.yml b/.github/workflows/moxunit.yml new file mode 100644 index 0000000..16a9ee9 --- /dev/null +++ b/.github/workflows/moxunit.yml @@ -0,0 +1,32 @@ +name: CI + +on: + push: + branches: + - master + pull_request: + branches: '*' + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + submodules: true + fetch-depth: 1 + - name: MOxUnit Action + uses: joergbrech/moxunit-action@v1.1 + with: + tests: tests + src: src + with_coverage: true + cover_xml_file: coverage.xml + - name: Code coverage + uses: codecov/codecov-action@v1 + with: + token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos + file: coverage.xml # optional + flags: unittests # optional + name: codecov-umbrella # optional + fail_ci_if_error: true # optional (default = false) diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..c05ae32 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,27 @@ +# Travis CI (https://travis-ci.org/) +# This will only work on your repo if you have an account on travis and you +# have set it up to run continuous integration on this this repo + +# Linux distribution (bionic beaver) +dist: bionic + +# Language and version +language: python +python: + - "3.6" # current default Python on Travis CI + +cache: + apt: true # only works with Pro version + +# Install the miss_hit linter +before_install: + - pip3 install miss_hit + +# Lists all the tasks we will do +jobs: + include: + - name: "miss_hit: checking code quality" + script: mh_metric . --ci + - name: "miss_hit: checking code style" + script: mh_style . + \ No newline at end of file diff --git a/initEnv.m b/initEnv.m index 2c26a50..cb51fd7 100644 --- a/initEnv.m +++ b/initEnv.m @@ -8,7 +8,7 @@ % - struct % - statistics % -% MATLAB > R2017a +% MATLAB >= R2015b % % 2 - Add project to the O/M path @@ -58,7 +58,9 @@ % If external dir is empty throw an exception % and ask user to update submodules. - if numel(dir('lib')) <= 2 % Means that the external is empty + libDirectory = fullfile(fileparts(mfilename('fullpath')), 'lib'); + + if numel(dir(libDirectory)) <= 2 % Means that the external is empty error(['Git submodules are not cloned!', ... 'Try this in your terminal:', ... ' git submodule update --recursive ']); diff --git a/subfun/expDesign.m b/subfun/expDesign.m index 029ba08..14a13b0 100644 --- a/subfun/expDesign.m +++ b/subfun/expDesign.m @@ -57,14 +57,7 @@ % Set variables here for a dummy test of this function if nargin < 1 || isempty(cfg) - % cfg.design.motionType = 'translation'; - cfg.design.motionType = 'translation'; - cfg.design.names = {'static'; 'motion'}; - cfg.design.nbRepetitions = 10; - cfg.design.nbEventsPerBlock = 12; - cfg.dot.speedPixPerFrame = 4; - cfg.target.maxNbPerBlock = 1; - displayFigs = 1; + error('give me something to work with') end fprintf('\n\nCreating design.\n\n') diff --git a/tests/test_exDesign.m b/tests/test_exDesign.m new file mode 100644 index 0000000..f5bdceb --- /dev/null +++ b/tests/test_exDesign.m @@ -0,0 +1,25 @@ +function test_suite = test_exDesign %#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_checkCfgDefault() + + initEnv(); + + % cfg.design.motionType = 'translation'; + cfg.design.motionType = 'translation'; + cfg.design.names = {'static'; 'motion'}; + cfg.design.nbRepetitions = 10; + cfg.design.nbEventsPerBlock = 12; + cfg.dot.speedPixPerFrame = 4; + cfg.target.maxNbPerBlock = 1; + displayFigs = 1; + + [cfg] = expDesign(cfg, displayFigs) + + +end \ No newline at end of file