From b27959ab526460666f99b10290c5e9320ef9c6b1 Mon Sep 17 00:00:00 2001 From: Thomas Lambert <t.lambert@uliege.be> Date: Fri, 8 Apr 2022 11:11:25 +0200 Subject: [PATCH] test(extendpolar): add option tests --- tests/test_extendpolar.m | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/tests/test_extendpolar.m b/tests/test_extendpolar.m index 608aaa9..1eebcb6 100644 --- a/tests/test_extendpolar.m +++ b/tests/test_extendpolar.m @@ -126,6 +126,46 @@ verifyError(testCase, @() af_tools.extendpolar(DummyCd), 'MATLAB:nonExistentFiel end +function test_invalidOptions(testCase) +% Error if invalid option name or missing parameter value + +Dummy = dummysinglepolar(); +wrongName = 'wrongoption'; + +verifyError(testCase, @() af_tools.extendpolar(Dummy, wrongName), 'MATLAB:InputParser:ParamMissingValue') +verifyError(testCase, @() af_tools.extendpolar(Dummy, wrongName, true), 'MATLAB:InputParser:UnmatchedParameter') +verifyError(testCase, @() af_tools.extendpolar(Dummy, 'method', 'Viterna', wrongName), 'MATLAB:InputParser:ParamMissingValue') +verifyError(testCase, @() af_tools.extendpolar(Dummy, 'method', 'Viterna', wrongName, true), 'MATLAB:InputParser:UnmatchedParameter') + +end + + +function test_invalidOptionsVal(testCase) +% Error if valid option name but invalid value + +Dummy = dummysinglepolar(); +empty = []; +scal = 0; +char = 'test'; +Struct = struct; +vect = 1:10; + +verifyError(testCase, @() af_tools.extendpolar(Dummy, 'method', empty), 'MATLAB:extendpolar:unrecognizedStringChoice') +verifyError(testCase, @() af_tools.extendpolar(Dummy, 'method', scal), 'MATLAB:extendpolar:unrecognizedStringChoice') +verifyError(testCase, @() af_tools.extendpolar(Dummy, 'method', char), 'MATLAB:extendpolar:unrecognizedStringChoice') +verifyError(testCase, @() af_tools.extendpolar(Dummy, 'method', Struct), 'MATLAB:extendpolar:unrecognizedStringChoice') +verifyError(testCase, @() af_tools.extendpolar(Dummy, 'method', vect), 'MATLAB:extendpolar:unrecognizedStringChoice') + +verifyError(testCase, @() af_tools.extendpolar(Dummy, 'limit', empty), 'MATLAB:extendpolar:unrecognizedStringChoice') +verifyError(testCase, @() af_tools.extendpolar(Dummy, 'limit', scal), 'MATLAB:extendpolar:unrecognizedStringChoice') +verifyError(testCase, @() af_tools.extendpolar(Dummy, 'limit', char), 'MATLAB:extendpolar:unrecognizedStringChoice') +verifyError(testCase, @() af_tools.extendpolar(Dummy, 'limit', Struct), 'MATLAB:extendpolar:unrecognizedStringChoice') +verifyError(testCase, @() af_tools.extendpolar(Dummy, 'limit', vect), 'MATLAB:extendpolar:unrecognizedStringChoice') + +end + + + % ------------------------------------------------------------------------------ function test_noStall(testCase) % Error if impossible to find the stall -- GitLab