From 0345245e860375a32c9a437c4a9d9cae807134e9 Mon Sep 17 00:00:00 2001 From: Shashank Date: Mon, 29 May 2017 12:40:26 +0530 Subject: CMSCOPE changed --- .../boolean/tests/nonreg_tests/bug_10904.dia.ref | 42 ++++++++++++++++ modules/boolean/tests/nonreg_tests/bug_10904.tst | 57 ++++++++++++++++++++++ .../boolean/tests/nonreg_tests/bug_2799.dia.ref | 19 ++++++++ modules/boolean/tests/nonreg_tests/bug_2799.tst | 22 +++++++++ .../boolean/tests/nonreg_tests/bug_3006.dia.ref | 26 ++++++++++ modules/boolean/tests/nonreg_tests/bug_3006.tst | 32 ++++++++++++ .../boolean/tests/nonreg_tests/bug_4466.dia.ref | 16 ++++++ modules/boolean/tests/nonreg_tests/bug_4466.tst | 20 ++++++++ .../boolean/tests/nonreg_tests/bug_5042.dia.ref | 38 +++++++++++++++ modules/boolean/tests/nonreg_tests/bug_5042.tst | 48 ++++++++++++++++++ .../boolean/tests/nonreg_tests/bug_7666.dia.ref | 34 +++++++++++++ modules/boolean/tests/nonreg_tests/bug_7666.tst | 22 +++++++++ modules/boolean/tests/unit_tests/and.dia.ref | 30 ++++++++++++ modules/boolean/tests/unit_tests/and.tst | 35 +++++++++++++ modules/boolean/tests/unit_tests/bool2s.dia.ref | 19 ++++++++ modules/boolean/tests/unit_tests/bool2s.tst | 20 ++++++++ modules/boolean/tests/unit_tests/or.dia.ref | 30 ++++++++++++ modules/boolean/tests/unit_tests/or.tst | 35 +++++++++++++ 18 files changed, 545 insertions(+) create mode 100755 modules/boolean/tests/nonreg_tests/bug_10904.dia.ref create mode 100755 modules/boolean/tests/nonreg_tests/bug_10904.tst create mode 100755 modules/boolean/tests/nonreg_tests/bug_2799.dia.ref create mode 100755 modules/boolean/tests/nonreg_tests/bug_2799.tst create mode 100755 modules/boolean/tests/nonreg_tests/bug_3006.dia.ref create mode 100755 modules/boolean/tests/nonreg_tests/bug_3006.tst create mode 100755 modules/boolean/tests/nonreg_tests/bug_4466.dia.ref create mode 100755 modules/boolean/tests/nonreg_tests/bug_4466.tst create mode 100755 modules/boolean/tests/nonreg_tests/bug_5042.dia.ref create mode 100755 modules/boolean/tests/nonreg_tests/bug_5042.tst create mode 100755 modules/boolean/tests/nonreg_tests/bug_7666.dia.ref create mode 100755 modules/boolean/tests/nonreg_tests/bug_7666.tst create mode 100755 modules/boolean/tests/unit_tests/and.dia.ref create mode 100755 modules/boolean/tests/unit_tests/and.tst create mode 100755 modules/boolean/tests/unit_tests/bool2s.dia.ref create mode 100755 modules/boolean/tests/unit_tests/bool2s.tst create mode 100755 modules/boolean/tests/unit_tests/or.dia.ref create mode 100755 modules/boolean/tests/unit_tests/or.tst (limited to 'modules/boolean/tests') diff --git a/modules/boolean/tests/nonreg_tests/bug_10904.dia.ref b/modules/boolean/tests/nonreg_tests/bug_10904.dia.ref new file mode 100755 index 000000000..0f222c4a0 --- /dev/null +++ b/modules/boolean/tests/nonreg_tests/bug_10904.dia.ref @@ -0,0 +1,42 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) DIGITEO - 2012 - Allan CORNET +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// <-- CLI SHELL MODE --> +// <-- Non-regression test for bug 10904 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/10904 +// +// <-- Short Description --> +// error messages of and(), or() builtin were not standard. +a = 1; +b = 3; +c = 4; +d = 5; +// and +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d.\n"), "and", 2); +assert_checkerror("and(a == b, c == d)", msgerr); +msgerr = [msprintf(gettext("Function not defined for given argument type(s),\n")); + msprintf(gettext(" check arguments or define function %s for overloading.\n"),'%c_and')]; +assert_checkerror("and(""a"")", msgerr); +msgerr = msprintf(gettext("%s: Wrong size for input argument #%d.\n"), "and", 2); +assert_checkerror("and(%T, [1 2])", msgerr); +msgerr = msprintf(gettext("%s: Wrong value for input argument #%d.\n"), "and", 2); +assert_checkerror("and(%T, ''t'')", msgerr); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d.\n"), "and", 2); +assert_checkerror("and(%T, %i)", msgerr); +// or +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d.\n"), "or", 2); +assert_checkerror("or(a == b, c == d)", msgerr); +msgerr = [msprintf(gettext("Function not defined for given argument type(s),\n")); + msprintf(gettext(" check arguments or define function %s for overloading.\n"),'%c_or')]; +assert_checkerror("or(""a"")", msgerr); +msgerr = msprintf(gettext("%s: Wrong size for input argument #%d.\n"), "or", 2); +assert_checkerror("or(%T, [1 2])", msgerr); +msgerr = msprintf(gettext("%s: Wrong value for input argument #%d.\n"), "or", 2); +assert_checkerror("or(%T, ''t'')", msgerr); +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d.\n"), "or", 2); +assert_checkerror("or(%T, %i)", msgerr); diff --git a/modules/boolean/tests/nonreg_tests/bug_10904.tst b/modules/boolean/tests/nonreg_tests/bug_10904.tst new file mode 100755 index 000000000..b6287b431 --- /dev/null +++ b/modules/boolean/tests/nonreg_tests/bug_10904.tst @@ -0,0 +1,57 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) DIGITEO - 2012 - Allan CORNET +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +// <-- CLI SHELL MODE --> + +// <-- Non-regression test for bug 10904 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/10904 +// +// <-- Short Description --> +// error messages of and(), or() builtin were not standard. + +a = 1; +b = 3; +c = 4; +d = 5; +// and + + +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d.\n"), "and", 2); +assert_checkerror("and(a == b, c == d)", msgerr); + +msgerr = [msprintf(gettext("Function not defined for given argument type(s),\n")); + msprintf(gettext(" check arguments or define function %s for overloading.\n"),'%c_and')]; +assert_checkerror("and(""a"")", msgerr); + +msgerr = msprintf(gettext("%s: Wrong size for input argument #%d.\n"), "and", 2); +assert_checkerror("and(%T, [1 2])", msgerr); + +msgerr = msprintf(gettext("%s: Wrong value for input argument #%d.\n"), "and", 2); +assert_checkerror("and(%T, ''t'')", msgerr); + +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d.\n"), "and", 2); +assert_checkerror("and(%T, %i)", msgerr); + +// or + +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d.\n"), "or", 2); +assert_checkerror("or(a == b, c == d)", msgerr); + +msgerr = [msprintf(gettext("Function not defined for given argument type(s),\n")); + msprintf(gettext(" check arguments or define function %s for overloading.\n"),'%c_or')]; +assert_checkerror("or(""a"")", msgerr); + +msgerr = msprintf(gettext("%s: Wrong size for input argument #%d.\n"), "or", 2); +assert_checkerror("or(%T, [1 2])", msgerr); + +msgerr = msprintf(gettext("%s: Wrong value for input argument #%d.\n"), "or", 2); +assert_checkerror("or(%T, ''t'')", msgerr); + +msgerr = msprintf(gettext("%s: Wrong type for input argument #%d.\n"), "or", 2); +assert_checkerror("or(%T, %i)", msgerr); diff --git a/modules/boolean/tests/nonreg_tests/bug_2799.dia.ref b/modules/boolean/tests/nonreg_tests/bug_2799.dia.ref new file mode 100755 index 000000000..add16cdef --- /dev/null +++ b/modules/boolean/tests/nonreg_tests/bug_2799.dia.ref @@ -0,0 +1,19 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2006-2008 - INRIA -Serge Steer +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// <-- Non-regression test for bug 2799 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=2799 +// +// <-- Short Description --> +// Failure to assign boolean values to a sub-matrix when the matrix does +// not exist +// clear A;A(:,1) = [%t;%f]; +clear A;A(:,1) = [%t;%f]; +if or(A<>[%t;%f]) then bugmes();quit;end +clear A;A(1,:) = [%f;%t]; +if or(A<>[%f,%t]) then bugmes();quit;end diff --git a/modules/boolean/tests/nonreg_tests/bug_2799.tst b/modules/boolean/tests/nonreg_tests/bug_2799.tst new file mode 100755 index 000000000..9783a1058 --- /dev/null +++ b/modules/boolean/tests/nonreg_tests/bug_2799.tst @@ -0,0 +1,22 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2006-2008 - INRIA -Serge Steer +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +// <-- CLI SHELL MODE --> + +// <-- Non-regression test for bug 2799 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=2799 +// +// <-- Short Description --> +// Failure to assign boolean values to a sub-matrix when the matrix does +// not exist +// clear A;A(:,1) = [%t;%f]; +clear A;A(:,1) = [%t;%f]; +if or(A<>[%t;%f]) then pause,end +clear A;A(1,:) = [%f;%t]; +if or(A<>[%f,%t]) then pause,end diff --git a/modules/boolean/tests/nonreg_tests/bug_3006.dia.ref b/modules/boolean/tests/nonreg_tests/bug_3006.dia.ref new file mode 100755 index 000000000..b1b43637d --- /dev/null +++ b/modules/boolean/tests/nonreg_tests/bug_3006.dia.ref @@ -0,0 +1,26 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2007-2008 - INRIA - Serge STEER +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// <-- Non-regression test for bug 3006 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=3006 +// +// <-- Short Description --> +// submatrix assignment impossible when the matrix is indexed with a boolean array of falses +a=[%f %t;%t %t];a_ref=a; +a(1,[%f %f])=[]; +if or(a<>a_ref) then bugmes();quit;end +a([%f %f],1)=[]; +if or(a<>a_ref) then bugmes();quit;end +a([%f %f],[%f %f])=[]; +if or(a<>a_ref) then bugmes();quit;end +a(1,$:1)=[]; +if or(a<>a_ref) then bugmes();quit;end +a($:1,1)=[]; +if or(a<>a_ref) then bugmes();quit;end +a($:1,$:1)=[]; +if or(a<>a_ref) then bugmes();quit;end diff --git a/modules/boolean/tests/nonreg_tests/bug_3006.tst b/modules/boolean/tests/nonreg_tests/bug_3006.tst new file mode 100755 index 000000000..c928d58c3 --- /dev/null +++ b/modules/boolean/tests/nonreg_tests/bug_3006.tst @@ -0,0 +1,32 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2007-2008 - INRIA - Serge STEER +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +// <-- CLI SHELL MODE --> + +// <-- Non-regression test for bug 3006 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=3006 +// +// <-- Short Description --> +// submatrix assignment impossible when the matrix is indexed with a boolean array of falses + +a=[%f %t;%t %t];a_ref=a; + +a(1,[%f %f])=[]; +if or(a<>a_ref) then pause,end +a([%f %f],1)=[]; +if or(a<>a_ref) then pause,end +a([%f %f],[%f %f])=[]; +if or(a<>a_ref) then pause,end + +a(1,$:1)=[]; +if or(a<>a_ref) then pause,end +a($:1,1)=[]; +if or(a<>a_ref) then pause,end +a($:1,$:1)=[]; +if or(a<>a_ref) then pause,end diff --git a/modules/boolean/tests/nonreg_tests/bug_4466.dia.ref b/modules/boolean/tests/nonreg_tests/bug_4466.dia.ref new file mode 100755 index 000000000..b672dcd5f --- /dev/null +++ b/modules/boolean/tests/nonreg_tests/bug_4466.dia.ref @@ -0,0 +1,16 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009 - INRIA - Serge Steer +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// <-- CLI SHELL MODE --> +// <-- Non-regression test for bug 4466 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=4466 +// +// <-- Short Description --> +// The .' operator is undefined for character string and boolean data types. +M=[%t,%f]; +if or(M.'<>[%t;%f]) then bugmes();quit;end diff --git a/modules/boolean/tests/nonreg_tests/bug_4466.tst b/modules/boolean/tests/nonreg_tests/bug_4466.tst new file mode 100755 index 000000000..d60af01c7 --- /dev/null +++ b/modules/boolean/tests/nonreg_tests/bug_4466.tst @@ -0,0 +1,20 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009 - INRIA - Serge Steer +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +// <-- CLI SHELL MODE --> + +// <-- Non-regression test for bug 4466 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=4466 +// +// <-- Short Description --> +// The .' operator is undefined for character string and boolean data types. + +M=[%t,%f]; +if or(M.'<>[%t;%f]) then pause,end + diff --git a/modules/boolean/tests/nonreg_tests/bug_5042.dia.ref b/modules/boolean/tests/nonreg_tests/bug_5042.dia.ref new file mode 100755 index 000000000..45f6de7a9 --- /dev/null +++ b/modules/boolean/tests/nonreg_tests/bug_5042.dia.ref @@ -0,0 +1,38 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009 - DIGITEO - Allan CORNET +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// <-- CLI SHELL MODE --> +// <-- Non-regression test for bug 5042 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=5042 +// +// <-- Short Description --> +// (1|[1,0,1;1,1,0]) returns incorrect values. +ref_or = [%t, %t, %t;%t, %t, %t]; +res = (1|[1,0,1;1,1,0]); +if ~and(ref_or == res) then bugmes();quit;end +ref_or = [%t, %t, %t;%t, %t, %t]; +res = (1|[%t,%f,%t;%t,%t,%f]); +if ~and(ref_or == res) then bugmes();quit;end +ref_and = [%t %f %t; %t %t %f]; +res = (1&[1,0,1;1,1,0]); +if ~and(ref_and == res) then bugmes();quit;end +ref_and = [%t %f %t; %t %t %f]; +res = (1&[%t,%f,%t;%t,%t,%f]); +if ~and(ref_and == res) then bugmes();quit;end +ref_or = [%t, %t, %t;%t, %t, %t]; +res = ([1,0,1;1,1,0]|1); +if ~and(ref_or == res) then bugmes();quit;end +ref_and = [%t %f %t; %t %t %f]; +res = ([1,0,1;1,1,0]&1); +if ~and(ref_and == res) then bugmes();quit;end +ref_or = [%T %F %T;%T %T %F]; +res = ([1,0,1;1,1,0]|[1,0,1;1,1,0]); +if ~and(ref_or == res) then bugmes();quit;end +ref_and = [%T %F %T; %T %T %F]; +res = ([1,0,1;1,1,0]&[1,0,1;1,1,0]); +if ~and(ref_and == res) then bugmes();quit;end diff --git a/modules/boolean/tests/nonreg_tests/bug_5042.tst b/modules/boolean/tests/nonreg_tests/bug_5042.tst new file mode 100755 index 000000000..5336e940e --- /dev/null +++ b/modules/boolean/tests/nonreg_tests/bug_5042.tst @@ -0,0 +1,48 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009 - DIGITEO - Allan CORNET +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +// <-- CLI SHELL MODE --> + +// <-- Non-regression test for bug 5042 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=5042 +// +// <-- Short Description --> +// (1|[1,0,1;1,1,0]) returns incorrect values. + +ref_or = [%t, %t, %t;%t, %t, %t]; +res = (1|[1,0,1;1,1,0]); +if ~and(ref_or == res) then pause,end + +ref_or = [%t, %t, %t;%t, %t, %t]; +res = (1|[%t,%f,%t;%t,%t,%f]); +if ~and(ref_or == res) then pause,end + +ref_and = [%t %f %t; %t %t %f]; +res = (1&[1,0,1;1,1,0]); +if ~and(ref_and == res) then pause,end + +ref_and = [%t %f %t; %t %t %f]; +res = (1&[%t,%f,%t;%t,%t,%f]); +if ~and(ref_and == res) then pause,end + +ref_or = [%t, %t, %t;%t, %t, %t]; +res = ([1,0,1;1,1,0]|1); +if ~and(ref_or == res) then pause,end + +ref_and = [%t %f %t; %t %t %f]; +res = ([1,0,1;1,1,0]&1); +if ~and(ref_and == res) then pause,end + +ref_or = [%T %F %T;%T %T %F]; +res = ([1,0,1;1,1,0]|[1,0,1;1,1,0]); +if ~and(ref_or == res) then pause,end + +ref_and = [%T %F %T; %T %T %F]; +res = ([1,0,1;1,1,0]&[1,0,1;1,1,0]); +if ~and(ref_and == res) then pause,end diff --git a/modules/boolean/tests/nonreg_tests/bug_7666.dia.ref b/modules/boolean/tests/nonreg_tests/bug_7666.dia.ref new file mode 100755 index 000000000..366547ad1 --- /dev/null +++ b/modules/boolean/tests/nonreg_tests/bug_7666.dia.ref @@ -0,0 +1,34 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) DIGITEO - 2014 - Scilab Enterprises - Calixte DENIZET +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// <-- CLI SHELL MODE --> +// <-- Non-regression test for bug 7666 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/7666 +// +// <-- Short Description --> +// Inconstencies between and/or and &/| +assert_checkequal(or([0.6 -0.9]), 0.6 | -0.9) + ans = + + T +assert_checkequal(or([0.6 -1.1]), 0.6 | -1.1) + ans = + + T +assert_checkequal(and([0.6 -0.7]), 0.6 & -0.7) + ans = + + T +assert_checkequal(and([0.6 -1.1]), 0.6 & -1.1) + ans = + + T +assert_checkequal(and([2.1 -1.1]), 2.1 & -1.1) + ans = + + T diff --git a/modules/boolean/tests/nonreg_tests/bug_7666.tst b/modules/boolean/tests/nonreg_tests/bug_7666.tst new file mode 100755 index 000000000..eab4b866f --- /dev/null +++ b/modules/boolean/tests/nonreg_tests/bug_7666.tst @@ -0,0 +1,22 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) DIGITEO - 2014 - Scilab Enterprises - Calixte DENIZET +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +// <-- CLI SHELL MODE --> + +// <-- Non-regression test for bug 7666 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/7666 +// +// <-- Short Description --> +// Inconstencies between and/or and &/| + +assert_checkequal(or([0.6 -0.9]), 0.6 | -0.9) +assert_checkequal(or([0.6 -1.1]), 0.6 | -1.1) +assert_checkequal(and([0.6 -0.7]), 0.6 & -0.7) +assert_checkequal(and([0.6 -1.1]), 0.6 & -1.1) +assert_checkequal(and([2.1 -1.1]), 2.1 & -1.1) \ No newline at end of file diff --git a/modules/boolean/tests/unit_tests/and.dia.ref b/modules/boolean/tests/unit_tests/and.dia.ref new file mode 100755 index 000000000..038916c22 --- /dev/null +++ b/modules/boolean/tests/unit_tests/and.dia.ref @@ -0,0 +1,30 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) - 2012 - DIGITEO - Allan CORNET +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- CLI SHELL MODE --> +// +A = []; +assert_checkequal(and(A), %T); +A = %T(ones(1, 3)); +assert_checkequal(and(A), %T); +A = %F(ones(1, 3)); +assert_checkequal(and(A), %F); +A = %T(ones(1, 3)); +assert_checkequal(and(A, '*'), %T); +assert_checkequal(and(A, 'c'), %T); +assert_checkequal(and(A, 2), %T); +REF = [%T %T %T]; +assert_checkequal(and(A, 'r'), REF); +assert_checkequal(and(A, 1), REF); +B = (eye(3,3) == 0); +B(1, 1) = %T; +assert_checkequal(and(B), %F); +assert_checkequal(and(B, '*'), %F); +REF = [%T,%F, %F]; +assert_checkequal(and(B, 'r'), REF); +REF = [%T; %F; %F]; +assert_checkequal(and(B, 'c'), REF); diff --git a/modules/boolean/tests/unit_tests/and.tst b/modules/boolean/tests/unit_tests/and.tst new file mode 100755 index 000000000..296074011 --- /dev/null +++ b/modules/boolean/tests/unit_tests/and.tst @@ -0,0 +1,35 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) - 2012 - DIGITEO - Allan CORNET +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- CLI SHELL MODE --> +// +A = []; +assert_checkequal(and(A), %T); + +A = %T(ones(1, 3)); +assert_checkequal(and(A), %T); + +A = %F(ones(1, 3)); +assert_checkequal(and(A), %F); + +A = %T(ones(1, 3)); +assert_checkequal(and(A, '*'), %T); +assert_checkequal(and(A, 'c'), %T); +assert_checkequal(and(A, 2), %T); + +REF = [%T %T %T]; +assert_checkequal(and(A, 'r'), REF); +assert_checkequal(and(A, 1), REF); + +B = (eye(3,3) == 0); +B(1, 1) = %T; +assert_checkequal(and(B), %F); +assert_checkequal(and(B, '*'), %F); +REF = [%T,%F, %F]; +assert_checkequal(and(B, 'r'), REF); +REF = [%T; %F; %F]; +assert_checkequal(and(B, 'c'), REF); \ No newline at end of file diff --git a/modules/boolean/tests/unit_tests/bool2s.dia.ref b/modules/boolean/tests/unit_tests/bool2s.dia.ref new file mode 100755 index 000000000..ef8d4d3fa --- /dev/null +++ b/modules/boolean/tests/unit_tests/bool2s.dia.ref @@ -0,0 +1,19 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) - 2012 - S/E - Sylvestre Ledru +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- CLI SHELL MODE --> +// +a=bool2s(sparse([1 2 5 0 3 0 6 9])); +aref=sparse([1,1;1,2;1,3;1,5;1,7;1,8],[1;1;1;1;1;1],[1,8]); +assert_checkequal(a, aref); +b=bool2s(sparse([%t %f %t %t %f %t])); +bref=sparse([1,1;1,3;1,4;1,6],[1;1;1;1],[1,6]); +assert_checkequal(b, bref); +a=bool2s([%t %t %f %t]); +assert_checkequal(a, [1,1,0,1]); +b=bool2s([2.3 0 10 -1]); +assert_checkequal(b, [1,0,1,1]); diff --git a/modules/boolean/tests/unit_tests/bool2s.tst b/modules/boolean/tests/unit_tests/bool2s.tst new file mode 100755 index 000000000..7dece1468 --- /dev/null +++ b/modules/boolean/tests/unit_tests/bool2s.tst @@ -0,0 +1,20 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) - 2012 - S/E - Sylvestre Ledru +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- CLI SHELL MODE --> +// +a=bool2s(sparse([1 2 5 0 3 0 6 9])); +aref=sparse([1,1;1,2;1,3;1,5;1,7;1,8],[1;1;1;1;1;1],[1,8]); +assert_checkequal(a, aref); +b=bool2s(sparse([%t %f %t %t %f %t])); +bref=sparse([1,1;1,3;1,4;1,6],[1;1;1;1],[1,6]); +assert_checkequal(b, bref); + +a=bool2s([%t %t %f %t]); +assert_checkequal(a, [1,1,0,1]); +b=bool2s([2.3 0 10 -1]); +assert_checkequal(b, [1,0,1,1]); diff --git a/modules/boolean/tests/unit_tests/or.dia.ref b/modules/boolean/tests/unit_tests/or.dia.ref new file mode 100755 index 000000000..8553855ca --- /dev/null +++ b/modules/boolean/tests/unit_tests/or.dia.ref @@ -0,0 +1,30 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) - 2012 - DIGITEO - Allan CORNET +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- CLI SHELL MODE --> +// +A = []; +assert_checkequal(or(A), %F); +A = %T(ones(1, 3)); +assert_checkequal(or(A), %T); +A = %F(ones(1, 3)); +assert_checkequal(or(A), %F); +A = %T(ones(1, 3)); +assert_checkequal(or(A, '*'), %T); +assert_checkequal(or(A, 'c'), %T); +assert_checkequal(or(A, 2), %T); +REF = [%T %T %T]; +assert_checkequal(or(A, 'r'), REF); +assert_checkequal(or(A, 1), REF); +B = (eye(3,3) == 0); +B(1, 1) = %T; +assert_checkequal(or(B), %T); +assert_checkequal(or(B, '*'), %T); +REF = [%T,%T, %T]; +assert_checkequal(or(B, 'r'), REF); +REF = [%T; %T; %T]; +assert_checkequal(or(B, 'c'), REF); diff --git a/modules/boolean/tests/unit_tests/or.tst b/modules/boolean/tests/unit_tests/or.tst new file mode 100755 index 000000000..9f472a277 --- /dev/null +++ b/modules/boolean/tests/unit_tests/or.tst @@ -0,0 +1,35 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) - 2012 - DIGITEO - Allan CORNET +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- CLI SHELL MODE --> +// +A = []; +assert_checkequal(or(A), %F); + +A = %T(ones(1, 3)); +assert_checkequal(or(A), %T); + +A = %F(ones(1, 3)); +assert_checkequal(or(A), %F); + +A = %T(ones(1, 3)); +assert_checkequal(or(A, '*'), %T); +assert_checkequal(or(A, 'c'), %T); +assert_checkequal(or(A, 2), %T); + +REF = [%T %T %T]; +assert_checkequal(or(A, 'r'), REF); +assert_checkequal(or(A, 1), REF); + +B = (eye(3,3) == 0); +B(1, 1) = %T; +assert_checkequal(or(B), %T); +assert_checkequal(or(B, '*'), %T); +REF = [%T,%T, %T]; +assert_checkequal(or(B, 'r'), REF); +REF = [%T; %T; %T]; +assert_checkequal(or(B, 'c'), REF); \ No newline at end of file -- cgit