* Bug #10816 fixed - Allow the usage of the '$' keyword in the part function.
[scilab.git] / scilab / modules / string / tests / unit_tests / part.dia.ref
index 8c4190e..a81913e 100644 (file)
@@ -43,3 +43,20 @@ if or(part(['abc';'x'],[1,2])<>['ab';'x ']) then bugmes();quit;end
 if or(part(['abc';'x'],[1;1])<>['aa';'xx']) then bugmes();quit;end
 if or(part(['abc';'x'],[1;2])<>['ab';'x ']) then bugmes();quit;end
 //===============================
+a=part(['a','abc','abcd'],[1]);
+assert_checkequal(a,['a','a','a']);
+a=part(['a','abc','abcd'],[1,1]);
+assert_checkequal(a,['aa','aa','aa']);
+a=part(['a','abc','abcd'],[1,1,2]);
+assert_checkequal(a,['aa ','aab','aab']);
+N = 10; a=part('-',ones(1:N));
+assert_checkequal(a,"----------");
+N = 6; pat = '- ';
+a=part(pat, ones(1:N).*.(1:length(pat)));
+assert_checkequal(a,"- - - - - - ");
+a=part(['a string'  'another longer one'], $-2:$ );
+assert_checkequal(a,["ing","one"]);
+a=part('Hello world', $:-1:1);
+assert_checkequal(a,"dlrow olleH");
+a=part('Hello world', [ $ 5:6 ]);
+assert_checkequal(a,"do ");