Mercurial > hg > octave-nkf
changeset 2738:a243d3410229
[project @ 1997-02-25 06:56:52 by jwe]
line wrap: on
line diff
new file mode 100644 --- /dev/null +++ b/test/octave.test/string/bin2dec-1.m @@ -0,0 +1,1 @@ +bin2dec ("1110") == 14
new file mode 100644 --- /dev/null +++ b/test/octave.test/string/bin2dec-2.m @@ -0,0 +1,1 @@ +bin2dec ()
new file mode 100644 --- /dev/null +++ b/test/octave.test/string/bin2dec-3.m @@ -0,0 +1,1 @@ +bin2dec ("str", 1)
new file mode 100644 --- /dev/null +++ b/test/octave.test/string/blanks-1.m @@ -0,0 +1,1 @@ +strcmp (blanks (3), " ")
new file mode 100644 --- /dev/null +++ b/test/octave.test/string/blanks-2.m @@ -0,0 +1,1 @@ +blanks ()
new file mode 100644 --- /dev/null +++ b/test/octave.test/string/blanks-3.m @@ -0,0 +1,1 @@ +blanks (1, 2)
new file mode 100644 --- /dev/null +++ b/test/octave.test/string/deblank-1.m @@ -0,0 +1,1 @@ +strcmp (deblank (" f o o "), " f o o")
new file mode 100644 --- /dev/null +++ b/test/octave.test/string/deblank-2.m @@ -0,0 +1,1 @@ +deblank ()
new file mode 100644 --- /dev/null +++ b/test/octave.test/string/deblank-3.m @@ -0,0 +1,1 @@ +deblank ("foo", "bar")
new file mode 100644 --- /dev/null +++ b/test/octave.test/string/deblank-4.m @@ -0,0 +1,1 @@ +deblank (1)
new file mode 100644 --- /dev/null +++ b/test/octave.test/string/dec2bin-1.m @@ -0,0 +1,1 @@ +strcmp (dec2bin (14), "1110")
new file mode 100644 --- /dev/null +++ b/test/octave.test/string/dec2bin-2.m @@ -0,0 +1,1 @@ +dec2bin ()
new file mode 100644 --- /dev/null +++ b/test/octave.test/string/dec2bin-3.m @@ -0,0 +1,1 @@ +dec2bin (1, 2)
new file mode 100644 --- /dev/null +++ b/test/octave.test/string/dec2hex-1.m @@ -0,0 +1,1 @@ +strcmp (dec2hex (2748), "abc")
new file mode 100644 --- /dev/null +++ b/test/octave.test/string/dec2hex-2.m @@ -0,0 +1,1 @@ +dec2hex ()
new file mode 100644 --- /dev/null +++ b/test/octave.test/string/dec2hex-3.m @@ -0,0 +1,1 @@ +dec2hex (1, 2)
new file mode 100644 --- /dev/null +++ b/test/octave.test/string/findstr-1.m @@ -0,0 +1,3 @@ +(findstr ("ababab", "a") == [1, 3, 5] + && findstr ("ababab", "aba") == [1, 3, 5] + && findstr ("ababab", "aba", 0) == [1, 5])
new file mode 100644 --- /dev/null +++ b/test/octave.test/string/findstr-2.m @@ -0,0 +1,1 @@ +findstr ()
new file mode 100644 --- /dev/null +++ b/test/octave.test/string/findstr-3.m @@ -0,0 +1,1 @@ +findstr ("foo", "bar", 3, 4)
new file mode 100644 --- /dev/null +++ b/test/octave.test/string/hex2dec-1.m @@ -0,0 +1,1 @@ +hex2dec ("12b") == 299 && hex2dec ("12B") == 299
new file mode 100644 --- /dev/null +++ b/test/octave.test/string/hex2dec-2.m @@ -0,0 +1,1 @@ +hex2dec ()
new file mode 100644 --- /dev/null +++ b/test/octave.test/string/hex2dec-3.m @@ -0,0 +1,1 @@ +hex2dec ("str", 1)
new file mode 100644 --- /dev/null +++ b/test/octave.test/string/index-1.m @@ -0,0 +1,1 @@ +index ("foobarbaz", "b") == 4 && index ("foobarbaz", "z") == 9
new file mode 100644 --- /dev/null +++ b/test/octave.test/string/index-2.m @@ -0,0 +1,1 @@ +index ()
new file mode 100644 --- /dev/null +++ b/test/octave.test/string/index-3.m @@ -0,0 +1,1 @@ +index ("foo", "bar", 3)
new file mode 100644 --- /dev/null +++ b/test/octave.test/string/int2str-1.m @@ -0,0 +1,1 @@ +strcmp (int2str (-123), "-123") && strcmp (int2str (1.2), "1")
new file mode 100644 --- /dev/null +++ b/test/octave.test/string/int2str-2.m @@ -0,0 +1,1 @@ +int2str () \ No newline at end of file
new file mode 100644 --- /dev/null +++ b/test/octave.test/string/int2str-3.m @@ -0,0 +1,1 @@ +int2str (1, 2)
--- a/test/octave.test/string/iscntrl-1.m +++ b/test/octave.test/string/iscntrl-1.m @@ -3,5 +3,6 @@ result = zeros (1, 128); result (1:32) = 1; +result (128) = 1; all (iscntrl (charset) == result)
new file mode 100644 --- /dev/null +++ b/test/octave.test/string/isprint-1.m @@ -0,0 +1,7 @@ +charset = setstr (0:127); + +result = zeros (1, 128); + +result (33:127) = 1; + +all (isprint (charset) == result)
new file mode 100644 --- /dev/null +++ b/test/octave.test/string/num2str-1.m @@ -0,0 +1,1 @@ +strcmp (num2str (123), "123") && strcmp (num2str (1.23), "1.23")
new file mode 100644 --- /dev/null +++ b/test/octave.test/string/num2str-2.m @@ -0,0 +1,1 @@ +num2str ()
new file mode 100644 --- /dev/null +++ b/test/octave.test/string/num2str-3.m @@ -0,0 +1,1 @@ +num2str (1, 2)
new file mode 100644 --- /dev/null +++ b/test/octave.test/string/rindex-1.m @@ -0,0 +1,1 @@ +rindex ("foobarbaz", "b") == 6 && rindex ("foobarbaz", "o") == 3
new file mode 100644 --- /dev/null +++ b/test/octave.test/string/rindex-2.m @@ -0,0 +1,1 @@ +rindex ()
new file mode 100644 --- /dev/null +++ b/test/octave.test/string/rindex-3.m @@ -0,0 +1,1 @@ +rindex ("foo", "bar", 3)
new file mode 100644 --- /dev/null +++ b/test/octave.test/string/setstr-1.m @@ -0,0 +1,1 @@ +strcmp (setstr ([65, 83, 67, 73, 73]), "ASCII")
new file mode 100644 --- /dev/null +++ b/test/octave.test/string/setstr-2.m @@ -0,0 +1,1 @@ +setstr ()
new file mode 100644 --- /dev/null +++ b/test/octave.test/string/setstr-3.m @@ -0,0 +1,1 @@ +setstr (2, 1)
new file mode 100644 --- /dev/null +++ b/test/octave.test/string/split-1.m @@ -0,0 +1,1 @@ +all (all (split ("Test string", "t") == ["Tes "; " s "; "ring"]))
new file mode 100644 --- /dev/null +++ b/test/octave.test/string/split-2.m @@ -0,0 +1,1 @@ +split ()
new file mode 100644 --- /dev/null +++ b/test/octave.test/string/split-3.m @@ -0,0 +1,1 @@ +split ("foo", "bar", 3)
new file mode 100644 --- /dev/null +++ b/test/octave.test/string/str2mat-1.m @@ -0,0 +1,1 @@ +strcmp (str2mat ("a", "bb", "ccc"), ["a "; "bb "; "ccc"])
new file mode 100644 --- /dev/null +++ b/test/octave.test/string/str2mat-2.m @@ -0,0 +1,1 @@ +str2mat ()
new file mode 100644 --- /dev/null +++ b/test/octave.test/string/str2mat-3.m @@ -0,0 +1,1 @@ +str2mat (1, 2, 3)
new file mode 100644 --- /dev/null +++ b/test/octave.test/string/str2num-1.m @@ -0,0 +1,1 @@ +str2num ("-1.3e2") == -130 && str2num ("[1, 2; 3, 4]") == [1, 2; 3, 4]
new file mode 100644 --- /dev/null +++ b/test/octave.test/string/str2num-2.m @@ -0,0 +1,1 @@ +str2num ()
new file mode 100644 --- /dev/null +++ b/test/octave.test/string/str2num-3.m @@ -0,0 +1,1 @@ +str2num ("string", 1)
new file mode 100644 --- /dev/null +++ b/test/octave.test/string/strcat-1.m @@ -0,0 +1,2 @@ +(strcmp (strcat ("foo", "bar"), "foobar") + && strcmp (strcat (["a"; "bb"], ["foo"; "bar"]), ["a foo"; "bbbar"]))
new file mode 100644 --- /dev/null +++ b/test/octave.test/string/strcat-2.m @@ -0,0 +1,1 @@ +strcat ()
new file mode 100644 --- /dev/null +++ b/test/octave.test/string/strcat-3.m @@ -0,0 +1,1 @@ +strcat (1, 2)
new file mode 100644 --- /dev/null +++ b/test/octave.test/string/strcat-4.m @@ -0,0 +1,1 @@ +strcat ("err")
new file mode 100644 --- /dev/null +++ b/test/octave.test/string/strcmp-1.m @@ -0,0 +1,1 @@ +strcmp ("foobar", "foobar") && strcmp ("fooba", "foobar") == 0
new file mode 100644 --- /dev/null +++ b/test/octave.test/string/strcmp-2.m @@ -0,0 +1,1 @@ +strcmp ()
new file mode 100644 --- /dev/null +++ b/test/octave.test/string/strcmp-3.m @@ -0,0 +1,1 @@ +strcmp ("foo", "bar", 3)
--- a/test/octave.test/string/string.exp +++ b/test/octave.test/string/string.exp @@ -98,30 +98,289 @@ set prog_output "\n... isstr:.*" do_test isstr-11.m -# blanks -# int2str -# num2str -# setstr -# strcat -# str2mat -# deblank -# findstr -# index -# rindex -# split -# strcmp -# strrep -# substr -# bin2dec -# dec2bin -# dec2hex -# hex2dec -# str2num -# undo_string_escapes +set test blanks-1 +set prog_output "ans = 1" +do_test blanks-1.m + +set test blanks-2 +set prog_output "usage:.*" +do_test blanks-2.m + +set test blanks-3 +set prog_output "usage:.*" +do_test blanks-3.m + +set test int2str-1 +set prog_output "ans = 1" +do_test int2str-1.m + +set test int2str-2 +set prog_output "usage:.*" +do_test int2str-2.m + +set test int2str-3 +set prog_output "usage:.*" +do_test int2str-3.m + +set test num2str-1 +set prog_output "ans = 1" +do_test num2str-1.m + +set test num2str-2 +set prog_output "usage:.*" +do_test num2str-2.m + +set test num2str-3 +set prog_output "usage:.*" +do_test num2str-3.m + +set test setstr-1 +set prog_output "ans = 1" +do_test setstr-1.m + +set test setstr-2 +set prog_output "\n... setstr:.*" +do_test setstr-2.m + +set test setstr-3 +set prog_output "\n... setstr:.*" +do_test setstr-3.m + +set test strcat- +set prog_output "" +do_test strcat-.m + +set test strcat-2 +set prog_output "usage:.*" +do_test strcat-2.m + +set test strcat-3 +set prog_output "error:.*" +do_test strcat-3.m + +set test strcat-4 +set prog_output "usage:.*" +do_test strcat-4.m + +set test str2mat-1 +set prog_output "ans = 1" +do_test str2mat-1.m + +set test str2mat-2 +set prog_output "usage:.*" +do_test str2mat-2.m + +set test str2mat-3 +set prog_output "error:.*" +do_test str2mat-3.m + +set test deblank-1 +set prog_output "ans = 1" +do_test deblank-1.m + +set test deblank-2 +set prog_output "usage:.*" +do_test deblank-2.m + +set test deblank-3 +set prog_output "usage:.*" +do_test deblank-3.m + +set test deblank-4 +set prog_output "error:.*" +do_test deblank-4.m + +set test findstr-1 +set prog_output "ans = 1" +do_test findstr-1.m + +set test findstr-2 +set prog_output "usage:.*" +do_test findstr-2.m + +set test findstr-3 +set prog_output "usage:.*" +do_test findstr-3.m + +set test index-1 +set prog_output "ans = 1" +do_test index-1.m + +set test index-2 +set prog_output "usage:.*" +do_test index-2.m + +set test index-3 +set prog_output "usage:.*" +do_test index-3.m + +set test rindex-1 +set prog_output "ans = 1" +do_test rindex-1.m + +set test rindex-2 +set prog_output "usage:.*" +do_test rindex-2.m + +set test rindex-3 +set prog_output "usage:.*" +do_test rindex-3.m + +set test split-1 +set prog_output "ans = 1" +do_test split-1.m + +set test split-2 +set prog_output "usage:.*" +do_test split-2.m + +set test split-3 +set prog_output "usage:.*" +do_test split-3.m -# toascii -# tolower -# toupper +set test strrep-1 +set prog_output "ans = 1" +do_test strrep-1.m + +set test strrep-2 +set prog_output "usage:.*" +do_test strrep-2.m + +set test strrep-3 +set prog_output "usage:.*" +do_test strrep-3.m + +set test substr-1 +set prog_output "ans = 1" +do_test substr-1.m + +set test substr-2 +set prog_output "usage:.*" +do_test substr-2.m + +set test substr-3 +set prog_output "usage:.*" +do_test substr-3.m + +set test strcmp-1 +set prog_output "ans = 1" +do_test strcmp-1.m + +set test strcmp-2 +set prog_output "usage:.*" +do_test strcmp-2.m + +set test strcmp-3 +set prog_output "usage:.*" +do_test strcmp-3.m + +set test bin2dec-1 +set prog_output "ans = 1" +do_test bin2dec-1.m + +set test bin2dec-2 +set prog_output "usage:.*" +do_test bin2dec-2.m + +set test bin2dec-3 +set prog_output "usage:.*" +do_test bin2dec-3.m + +set test dec2bin-1 +set prog_output "ans = 1" +do_test dec2bin-1.m + +set test dec2bin-2 +set prog_output "usage:.*" +do_test dec2bin-2.m + +set test dec2bin-3 +set prog_output "usage:.*" +do_test dec2bin-3.m + +set test dec2hex-1 +set prog_output "ans = 1" +do_test dec2hex-1.m + +set test dec2hex-2 +set prog_output "usage:.*" +do_test dec2hex-2.m + +set test dec2hex-3 +set prog_output "usage:.*" +do_test dec2hex-3.m + +set test hex2dec-1 +set prog_output "ans = 1" +do_test hex2dec-1.m + +set test hex2dec-2 +set prog_output "usage:.*" +do_test hex2dec-2.m + +set test hex2dec-3 +set prog_output "usage:.*" +do_test hex2dec-3.m + +set test str2num-1 +set prog_output "ans = 1" +do_test str2num-1.m + +set test str2num-2 +set prog_output "usage:.*" +do_test str2num-2.m + +set test str2num-3 +set prog_output "usage:.*" +do_test str2num-3.m + +set test undo_string_escapes-1 +set prog_output "ans = 1" +do_test undo_string_escapes-1.m + +set test undo_string_escapes-2 +set prog_output "\n... undo_string_escapes:.*" +do_test undo_string_escapes-2.m + +set test undo_string_escapes-3 +set prog_output "\n... undo_string_escapes:.*" +do_test undo_string_escapes-3.m + +set test toascii-1 +set prog_output "ans = 1" +do_test toascii-1.m + +set test toascii-3 +set prog_output "error:.*" +do_test toascii-3.m + +set test toascii-3 +set prog_output "error:.*" +do_test toascii-3.m + +set test tolower-1 +set prog_output "ans = 1" +do_test tolower-1.m + +set test tolower-3 +set prog_output "error:.*" +do_test tolower-3.m + +set test tolower-3 +set prog_output "error:.*" +do_test tolower-3.m + +set test toupper-1 +set prog_output "ans = 1" +do_test toupper-1.m + +set test toupper-3 +set prog_output "error:.*" +do_test toupper-3.m + +set test toupper-3 +set prog_output "error:.*" +do_test toupper-3.m set test isalnum-1 set prog_output "ans = 1" @@ -256,13 +515,13 @@ do_test isupper-3.m set test isxdigit-1 -set prog_output ""ans = 1 +set prog_output "ans = 1" do_test isxdigit-1.m set test isxdigit-2 -set prog_output ""error:.* +set prog_output "error:.*" do_test isxdigit-2.m set test isxdigit-3 -set prog_output ""error:.* +set prog_output "error:.*" do_test isxdigit-3.m
new file mode 100644 --- /dev/null +++ b/test/octave.test/string/strrep-1.m @@ -0,0 +1,2 @@ +strcmp (strrep ("This is a test string", "is", "&%$"), + "Th&%$ &%$ a test string")
new file mode 100644 --- /dev/null +++ b/test/octave.test/string/strrep-2.m @@ -0,0 +1,1 @@ +strrep ()
new file mode 100644 --- /dev/null +++ b/test/octave.test/string/strrep-3.m @@ -0,0 +1,1 @@ +strrep ("foo", "bar", 3, 4)
new file mode 100644 --- /dev/null +++ b/test/octave.test/string/substr-1.m @@ -0,0 +1,1 @@ +strcmp (substr ("This is a test string", 6, 9), "is a test")
new file mode 100644 --- /dev/null +++ b/test/octave.test/string/substr-2.m @@ -0,0 +1,1 @@ +substr ()
new file mode 100644 --- /dev/null +++ b/test/octave.test/string/substr-3.m @@ -0,0 +1,1 @@ +substr ("foo", 2, 3, 4)
new file mode 100644 --- /dev/null +++ b/test/octave.test/string/toascii-1.m @@ -0,0 +1,5 @@ +charset = setstr (0:127); + +result = 0:127; + +all (toascii (charset) == result)
new file mode 100644 --- /dev/null +++ b/test/octave.test/string/toascii-2.m @@ -0,0 +1,1 @@ +toascii ()
new file mode 100644 --- /dev/null +++ b/test/octave.test/string/toascii-3.m @@ -0,0 +1,1 @@ +toascii (1, 2)
new file mode 100644 --- /dev/null +++ b/test/octave.test/string/tolower-1.m @@ -0,0 +1,8 @@ +charset = setstr (0:127); + +result = charset; + +result ((toascii("A"):toascii("Z"))+1) \ + = result ((toascii("a"):toascii("z"))+1); + +all (tolower (charset) == result)
new file mode 100644 --- /dev/null +++ b/test/octave.test/string/tolower-2.m @@ -0,0 +1,1 @@ +tolower ()
new file mode 100644 --- /dev/null +++ b/test/octave.test/string/tolower-3.m @@ -0,0 +1,1 @@ +tolower (1, 2)
new file mode 100644 --- /dev/null +++ b/test/octave.test/string/toupper-1.m @@ -0,0 +1,8 @@ +charset = setstr (0:127); + +result = charset; + +result ((toascii("a"):toascii("z"))+1) \ + = result ((toascii("A"):toascii("Z"))+1); + +all (toupper (charset) == result)
new file mode 100644 --- /dev/null +++ b/test/octave.test/string/toupper-2.m @@ -0,0 +1,1 @@ +toupper ()
new file mode 100644 --- /dev/null +++ b/test/octave.test/string/toupper-3.m @@ -0,0 +1,1 @@ +toupper (1, 2)
new file mode 100644 --- /dev/null +++ b/test/octave.test/string/undo_string_escapes-1.m @@ -0,0 +1,2 @@ +strcmp (undo_string_escapes ("abc\a\b\n\r\t\v\f123"), + "abc\\a\\b\\n\\r\\t\\v\\f123")