summaryrefslogtreecommitdiff
path: root/modules/polynomials/tests/unit_tests/lcmdiag.dia.ref
blob: cdf199b90335c9fdda5a2c8382a0f4a43ee446e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// =============================================================================
// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
// Copyright (C) 2013 - Scilab Enterprises - Paul Bignier
//
//  This file is distributed under the same license as the Scilab package.
// =============================================================================
// <-- CLI SHELL MODE -->
// <-- ENGLISH IMPOSED -->
// Run with test_run('polynomials', 'lcmdiag', ['no_check_error_output'])
// Normal behavior of the function
s = poly(0, 's');
H = [1/s, (s+2)/s/(s+1)^2; 1/(s^2*(s+2)), 2/(s+2)];
[N, D] = lcmdiag(H);
computed = N*D^(-1);
expected = H;
assert_checkalmostequal(coeff(computed.num), coeff(expected.num));
assert_checkalmostequal(coeff(computed.den), coeff(expected.den));
// Trying to call lcmdiag with wrong types
H = ["string"];
refMsg = msprintf(_("%s: Wrong type for argument #%d: Real Matrix of Polynomials expected.\n"), "lcmdiag", 1);
assert_checkerror("[N, D] = lcmdiag(H);", refMsg);
H = [1 2.3];
refMsg2 = msprintf(_("%s: Wrong type for argument #%d: Real Matrix of Polynomials expected.\n"), "lcmdiag", 1);
assert_checkerror("[N, D] = lcmdiag(H);", refMsg2);
H = [1/s, (s+2)/s/(s+1)^2; 1/(s^2*(s+2)), 2/(s+2)];
flag = [1 2.3];
refMsg3 = msprintf(_("%s: Wrong type for argument #%d: String expected.\n"), "lcmdiag", 2);
assert_checkerror("[N, D] = lcmdiag(H, flag);", refMsg3);
flag = "rows";
refMsg4 = msprintf(_("%s: Wrong value for argument #%d: %s or %s expected.\n"), "lcmdiag", 2, "row", "col");
assert_checkerror("[N, D] = lcmdiag(H, flag);", refMsg4);