File: ngraph-test

package info (click to toggle)
ngraph-gtk 6.09.10-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 13,036 kB
  • sloc: ansic: 113,697; sh: 5,833; ruby: 1,824; makefile: 590; cpp: 373; xml: 208; sed: 39; awk: 11
file content (29 lines) | stat: -rwxr-xr-x 1,045 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/ngraph -i
ERROR=0
show_result() {
    if [ "$2" = "$3" ]
    then
	echo "OK. ($1)"
    else
	echo "error. ($1)  '$2'  '$3'"
	ERROR=1
    fi
}

new string

string::@=" a b  b   b   c d  e f BCD"

show_result "strip"    "${string::strip}"           "a b  b   b   c d  e f BCD"
show_result "upcase"   "${string::upcase}"          " A B  B   B   C D  E F BCD"
show_result "downcase" "${string::downcase}"        " a b  b   b   c d  e f bcd"
show_result "reverse"  "${string::reverse}"         "DCB f e  d c   b   b  b a "
show_result "slice"    "${string::slice:'6 9'}"     "b   b   c"
show_result "slice"    "${string::slice:'21 4'}"    "f BC"
show_result "index"    "${string::index:'D 25'}"   "25"
show_result "index"    "${string::index:'a 1'}"     "1"
show_result "rindex"   "${string::rindex:'a 1'}"    "1"
show_result "rindex"   "${string::rindex:'b 20'}"   "10"
show_result "match"    "${string::match:'f.B'}"    "true"
show_result "match"    "${string::match:'a[^b]+c'}" "false"
exit $ERROR