From 2641e5f0a4d77786e03762424e153025bf08f462 Mon Sep 17 00:00:00 2001 From: Samuel GOUGEON Date: Mon, 4 Jan 2021 00:28:57 +0100 Subject: [PATCH] * Bug 16626 fixed: == and <> between libraries restored http://bugzilla.scilab.org/16626 Change-Id: If355c53584c4def06158ce43a42ccf5db539716e --- scilab/CHANGES.md | 1 + .../ast/tests/unit_tests/comparisonequal.tst | 34 +++++++++++--------- .../ast/tests/unit_tests/comparisonnonequal.tst | 33 ++++++++++--------- scilab/modules/functions/macros/%f_n_f.sci | 13 ++++++++ scilab/modules/functions/macros/%f_o_f.sci | 15 +++++++++ 5 files changed, 66 insertions(+), 30 deletions(-) create mode 100644 scilab/modules/functions/macros/%f_n_f.sci create mode 100644 scilab/modules/functions/macros/%f_o_f.sci diff --git a/scilab/CHANGES.md b/scilab/CHANGES.md index afbe737..f367c66 100644 --- a/scilab/CHANGES.md +++ b/scilab/CHANGES.md @@ -423,6 +423,7 @@ Bug Fixes * [#16622](https://bugzilla.scilab.org/16622): `inv` could no longer be overloaded for hypermatrices of decimal or complex numbers. * [#16623](https://bugzilla.scilab.org/16623): `rand(2,2,2)^2` yielded a wrong result instead of trying to call the `%s_p_s` overload for input hypermatrices. * [#16624](https://bugzilla.scilab.org/16624): `fullfile` badly handled any forced final file separator when building a directory's path. +* [#16626](https://bugzilla.scilab.org/16626): == and <> between libraries were no longer defined. * [#16629](https://bugzilla.scilab.org/16629): `interp1`'s documentation did not tell the spline edges conditions ; extrapolation modes were poorly explained. ; the description of the result's size was completely wrong ; x as an option was not documented. A wrong extrapolation value could silently return a wrong result. There was some dead code like `if varargin(5)==%nan`. A bugged error message yielded its own error. When x is implicit, the argument index in error messages could be wrong. `periodic` and `edgevalue` extrapolation modes were not available. `linear` extrapolation was not available for splines. When `xp` is an hypermatrix with `size(xp,1)==1`, the size of the result was irregular/wrong. * [#16644](https://bugzilla.scilab.org/16644): `input("message:")` yielded a wrong error message about `mprintf` in case of non-interpretable input. * [#16654](https://bugzilla.scilab.org/16654): `interp` was leaking memory. diff --git a/scilab/modules/ast/tests/unit_tests/comparisonequal.tst b/scilab/modules/ast/tests/unit_tests/comparisonequal.tst index 7c3b651..cc998c5 100644 --- a/scilab/modules/ast/tests/unit_tests/comparisonequal.tst +++ b/scilab/modules/ast/tests/unit_tests/comparisonequal.tst @@ -1019,6 +1019,7 @@ assert_checkequal(B == e, %f); assert_checkequal(B == ec, %f); assert_checkequal(B == p, %f); assert_checkequal(B == pc, %f); + assert_checkequal(B == P, %f); assert_checkequal(B == PC, %f); assert_checkequal(B == SP, %f); @@ -1077,16 +1078,6 @@ assert_checkequal(["a" "b"] == ["a" ; "b"],%f); assert_checkequal(["a" "b" "c"] == ["a" "b"],%f); assert_checkequal(["a" "b"; "a" "b"] == ["a" "b"],%f); -//macro -deff("[x]=myplus(y,z)","x=y+z"); - -deff("[x]=mymacro(y,z)",["a=3*y+1"; "x=a*z+y"]); - -assert_checkequal(myplus == myplus,%t); -assert_checkequal(myplus == mymacro,%f); -assert_checkequal(myplus == [],%f); -assert_checkequal(myplus == 2,%f); - //struct test_st=struct("double",1,"string","test","int8",int8(2),"struct",struct("valeur",0)); test_st2=struct("double",1,"string","test","int16",int8(2),"struct",1); @@ -1099,11 +1090,6 @@ assert_checkequal([test_st4 test_st8] == [test_st test_st], [%f %f]); assert_checkequal([test_st, test_st4;test_st4,test_st8] == [test_st, test_st; test_st,test_st], [%t, %f; %f , %f]); assert_checkequal(test_st == [], %f); -//function -assert_checkequal(acosd == acosd, %t); -assert_checkequal(acosd == [], %f); -assert_checkequal(acosd == 2, %f); - //polynom res = horner(1/(1-%s),1/(1-%s)); @@ -1137,3 +1123,21 @@ h5close(h5); ludel(ptr); xmlDelete(xml); mdelete(h5File); + +//macro +deff("[x]=myplus(y,z)","x=y+z"); + +deff("[x]=mymacro(y,z)",["a=3*y+1"; "x=a*z+y"]); + +assert_checkequal(myplus == myplus,%t); +assert_checkequal(myplus == mymacro,%f); +assert_checkequal(myplus == [],%f); +assert_checkequal(myplus == 2,%f); + +//function +assert_checkequal(acosd == acosd, %t); +assert_checkequal(acosd == [], %f); +assert_checkequal(acosd == 2, %f); + +// libraries +assert_checkequal(iolib == iolib, %t); diff --git a/scilab/modules/ast/tests/unit_tests/comparisonnonequal.tst b/scilab/modules/ast/tests/unit_tests/comparisonnonequal.tst index b808675..b1bcdf4 100644 --- a/scilab/modules/ast/tests/unit_tests/comparisonnonequal.tst +++ b/scilab/modules/ast/tests/unit_tests/comparisonnonequal.tst @@ -1077,16 +1077,6 @@ assert_checkequal(["a" "b"] <> ["a" ; "b"],%t); assert_checkequal(["a" "b" "c"] <> ["a" "b"],%t); assert_checkequal(["a" "b"; "a" "b"] <> ["a" "b"],%t); -//macro -deff("[x]=myplus(y,z)","x=y+z"); - -deff("[x]=mymacro(y,z)",["a=3*y+1"; "x=a*z+y"]); - -assert_checkequal(myplus <> myplus,%f); -assert_checkequal(myplus <> mymacro,%t); -assert_checkequal(myplus <> [],%t); -assert_checkequal(myplus <> 2,%t); - //struct test_st=struct("double",1,"string","test","int8",int8(2),"struct",struct("valeur",0)); test_st2=struct("double",1,"string","test","int16",int8(2),"struct",1); @@ -1099,11 +1089,6 @@ assert_checkequal([test_st4 test_st8] <> [test_st test_st], [%t,%t]); assert_checkequal([test_st, test_st4;test_st4,test_st8] <> [test_st, test_st; test_st,test_st], [%f,%t;%t,%t]); assert_checkequal(test_st <> [], %t); -//function -assert_checkequal(acosd <> acosd, %f); -assert_checkequal(acosd <> [], %t); -assert_checkequal(acosd <> 2, %t); - //polynom res = horner(1/(1-%s),1/(1-%s)); @@ -1137,3 +1122,21 @@ h5close(h5); ludel(ptr); xmlDelete(xml); mdelete(h5File); + +//macro +deff("[x]=myplus(y,z)","x=y+z"); + +deff("[x]=mymacro(y,z)",["a=3*y+1"; "x=a*z+y"]); + +assert_checkequal(myplus <> myplus,%f); +assert_checkequal(myplus <> mymacro,%t); +assert_checkequal(myplus <> [],%t); +assert_checkequal(myplus <> 2,%t); + +//function +assert_checkequal(acosd <> acosd, %f); +assert_checkequal(acosd <> [], %t); +assert_checkequal(acosd <> 2, %t); + +// libraries +assert_checktrue(iolib <> corelib); diff --git a/scilab/modules/functions/macros/%f_n_f.sci b/scilab/modules/functions/macros/%f_n_f.sci new file mode 100644 index 0000000..e490163 --- /dev/null +++ b/scilab/modules/functions/macros/%f_n_f.sci @@ -0,0 +1,13 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2021 - Samuel GOUGEON +// +// This file is hereby licensed under the terms of the GNU GPL v2.0, +// pursuant to article 5.3.4 of the CeCILL v.2.1. +// This file was originally licensed under the terms of the CeCILL v2.1, +// and continues to be available under such terms. +// For more information, see the COPYING file which you should have received +// along with this program. + +function y = %f_n_f(L1, L2) + y = ~%f_o_f(L1, L2) +endfunction diff --git a/scilab/modules/functions/macros/%f_o_f.sci b/scilab/modules/functions/macros/%f_o_f.sci new file mode 100644 index 0000000..b2b2a69 --- /dev/null +++ b/scilab/modules/functions/macros/%f_o_f.sci @@ -0,0 +1,15 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2021 - Samuel GOUGEON +// +// This file is hereby licensed under the terms of the GNU GPL v2.0, +// pursuant to article 5.3.4 of the CeCILL v.2.1. +// This file was originally licensed under the terms of the CeCILL v2.1, +// and continues to be available under such terms. +// For more information, see the COPYING file which you should have received +// along with this program. + +function y = %f_o_f(L1, L2) + path1 = string(L1)(1) + path2 = string(L2)(1) + y = path1 == path2 +endfunction -- 1.7.9.5