Bản mẫu:Str mid/testcases
Đây là trang các trường hợp kiểm thử bản mẫu sandbox của Bản mẫu:Str mid. để cập nhật các thí dụ. Nếu có nhiều thí dụ sử dụng một bản mẫu phức tạp, các thí dụ về cuối trang có thể bị hỏng vì các hạn chế của MediaWiki, xem chú thích HTML "Báo cáo hạn chế NewPP" trong trang được kết xuất. Bạn cũng có thể sử dụng Đặc biệt:Bung bản mẫu để kiểm tra các kết quả sử dụng bản mẫu. Bạn có thể xem thử trang này trong các hình dạng khác qua các liên kết này: |
- {{Str mid/core}}
- {{Str mid/sandbox}}
input params 2,3,4
sửaRegular
sửa- abc;1;26: Abcdefghijklmnopqrstuvwxyz
- abc;10;5: jklmn
- abc;10;;: jklmnopqrstuvwxyz
- abc;;6;: Abcdef
- abc;6;200: fghijklmnopqrstuvwxyz
- abc;6;200: fghijklmnopqrstuvwxyz
Use param 4 (index j) not sublength
sửa- abc;10;15: jklmno
- abc;10; jklmnopqrstuvwxyz
- abc;;6: Abcdef
blank params
sửa- blank string
- :
- ;5:
- ;;5:
- ;;;5:
- ;6;7;8:
- blank for numbers
- abc: Abcdefghijklmnopqrstuvwxyz
- abc;: Abcdefghijklmnopqrstuvwxyz
- abc;;: Abcdefghijklmnopqrstuvwxyz
- abc;;;: Abcdefghijklmnopqrstuvwxyz
- abc;2=: Abcdefghijklmnopqrstuvwxyz
- abc;2=;3=: Abcdefghijklmnopqrstuvwxyz
- abc;2=;3=;4=: Abcdefghijklmnopqrstuvwxyz
- abc;;3=: Abcdefghijklmnopqrstuvwxyz
- abc;;;4=: Abcdefghijklmnopqrstuvwxyz
- abc;2=;;4=: Abcdefghijklmnopqrstuvwxyz
i < 0
sửa- abc;-10;: qrstuvwxyz
- abc;-10;7: qrstuvw
i < 0, using j
sửa- abc;-10;;20: qrst
- abc;-10;;-7: qrst
- abc;-10;;-10: q
- abc;-10;;7: String Module Error: String subset indices out of order
sublen<0
sửa- abc;2=5;3=-3: cde
- abc;2=7;3=-3: efg
- abc;;3=-3;j=10: jklmnopqrstuvwxyz
- abc;;3=3;j=10: Abcdefghij
- abc;2=7;3=-3: efg
- abc;;3=-3: z TODO apply logic: from the end
- abc;;3=-10;4=30: z (check this: j=30 or j=26?)
Zeros
sửa- abc;0: String Module Error: String subset index out of range
- abc;5;0:
- abc;5;;0: String Module Error: String subset index out of range
- abc;0;0;0:
- abc;2=;: Abcdefghijklmnopqrstuvwxyz
- abc;2=5;3=0:
- abc;2=5;j=0: String Module Error: String subset index out of range
Input errors
sửa- abc;2=2;3=3;7: Lỗi sử dụng {{Str mid}}: các chỉ số i=2 và j=7 không trùng khớp được yêu cầu độ dài chuỗi con 3
- abc;;2=foo; Abcdefghijklmnopqrstuvwxyz
- abc;3=foo; Lỗi biểu thức: Từ “foo” không rõ ràng
- abc;2=foo;3=bar; Lỗi biểu thức: Từ “bar” không rõ ràng
Index errors
sửa- Triangular calculation check
- abc;6;7;8: Lỗi sử dụng {{Str mid}}: các chỉ số i=6 và j=8 không trùng khớp được yêu cầu độ dài chuỗi con 7
- abc;6;7;8: Lỗi sử dụng {{Str mid}}: các chỉ số i=6 và j=8 không trùng khớp được yêu cầu độ dài chuỗi con 7
- ;6;1;8: Lỗi sử dụng {{Str mid}}: các chỉ số i=6 và j=8 không trùng khớp được yêu cầu độ dài chuỗi con 1
- other
- abc;0: String Module Error: String subset index out of range
- abc;3;0:
- abc;0;;15: String Module Error: String subset index out of range
- abc;10;;7: String Module Error: String subset indices out of order
- abc;-5;26: String Module Error: String subset indices out of order
- abc;-1;5: String Module Error: String subset indices out of order
Error message suppression
sửa- abc;0;10; ignore errors=false: String Module Error: String subset index out of range
- abc;0;10; ignore errors=true:
- abc;0;5: ignore errors=false; ignore errors=false: String Module Error: String subset index out of range
- abc;0;5:ignore errors=true: