isvector.tst for rationals and lists 71/21271/2
Samuel GOUGEON [Thu, 30 Jan 2020 23:58:05 +0000 (00:58 +0100)]
Change-Id: I58bb3f3563ff804308ce8614f54b8f5ce7f894bf

scilab/modules/elementary_functions/tests/unit_tests/isvector.tst

index 3e392e2..499edc3 100644 (file)
@@ -40,8 +40,22 @@ s(2).r = %e; assert_checktrue(isvector(s));
 clear
 s(1,1,2).r = %e; assert_checktrue(isvector(s));
 
-// Rationals : isvector always crashes
-//assert_checkfalse(isvector(1/%s));         // questionnable
-//assert_checktrue(isvector((1:3)./%s));
-//assert_checktrue(isvector((1:3)'./%s));
-//assert_checktrue(isvector(cat(3,1,2,3)./%s));
+// Rationals
+assert_checkfalse(isvector(1/%s));         // questionnable
+assert_checktrue(isvector((1:3)./%s));
+assert_checktrue(isvector((1:3)'./%s));
+assert_checktrue(isvector(cat(3,1,2,3)./%s));
+
+// Lists
+assert_checkfalse(isvector(list()));
+assert_checkfalse(isvector(list(1)));
+assert_checkfalse(isvector(list(1,2)));
+assert_checkfalse(isvector(list([1,2])));
+assert_checkfalse(isvector(list([1,2]')));
+
+// Mlist
+m = mlist(["test" "a"],1:3);
+msg1 = _("Function not defined for given argument type(s),\n");
+msg2 = _("  check arguments or define function %s for overloading.\n");
+msg = sprintf("%s%s", msg1, msg2);
+assert_checkerror("isvector(m)", msprintf(msg, "%test_isvector"));