# HG changeset patch # User Rik # Date 1544490404 28800 # Node ID 95633ec174cf6574d884c3b9a3a08e9a676d83b0 # Parent b8f23ab958e84620e2aac72556610f17c6892703 rat.m: Add input validation to detect and fail on complex inputs (bug #55198) emit an error. Add FIXME note that this test should be removed when support for complex numbers is added in bug #55198. Add BIST test to verify input validation. diff -r b8f23ab958e8 -r 95633ec174cf scripts/general/rat.m --- a/scripts/general/rat.m Mon Dec 10 16:58:22 2018 -0800 +++ b/scripts/general/rat.m Mon Dec 10 17:06:44 2018 -0800 @@ -67,6 +67,12 @@ error ("rat: X must be a single or double array"); endif + ## FIXME: This test should be removed when complex support is added. + ## See bug #55198. + if (iscomplex (x)) + error ("rat: X must be a real, not complex, array"); + endif + y = x(:); ## Replace Inf with 0 while calculating ratios. @@ -214,6 +220,7 @@ %!error rat () %!error rat (1, 2, 3) %!error rat (int8 (3)) +%!error rat (1+1i) %!error rat (1, "a") %!error rat (1, [1 2]) %!error rat (1, -1)