summaryrefslogtreecommitdiffstats
path: root/testsuite/systemtap.string
diff options
context:
space:
mode:
authormmason <mmason>2007-01-23 18:03:50 +0000
committermmason <mmason>2007-01-23 18:03:50 +0000
commitdfd8bb34d4d06033c5062ef19f2e5a2f77d5f6c9 (patch)
tree327a715cfbf385c9d91775b9881fc499f2e0637a /testsuite/systemtap.string
parent6dd0aa5face6fc1091841a31ff86280b7e7da96d (diff)
downloadsystemtap-steved-dfd8bb34d4d06033c5062ef19f2e5a2f77d5f6c9.tar.gz
systemtap-steved-dfd8bb34d4d06033c5062ef19f2e5a2f77d5f6c9.tar.xz
systemtap-steved-dfd8bb34d4d06033c5062ef19f2e5a2f77d5f6c9.zip
Added new string functions tokenize() and strtol().
Diffstat (limited to 'testsuite/systemtap.string')
-rw-r--r--testsuite/systemtap.string/strtol.exp15
-rw-r--r--testsuite/systemtap.string/strtol.stp29
-rw-r--r--testsuite/systemtap.string/tokenize.exp26
-rw-r--r--testsuite/systemtap.string/tokenize.stp46
4 files changed, 116 insertions, 0 deletions
diff --git a/testsuite/systemtap.string/strtol.exp b/testsuite/systemtap.string/strtol.exp
new file mode 100644
index 00000000..12d63f0d
--- /dev/null
+++ b/testsuite/systemtap.string/strtol.exp
@@ -0,0 +1,15 @@
+set test "strtol"
+set ::result_string {1
+-1
+123456789
+-123456789
+0
+1
+0
+0
+1000
+4096
+512
+8
+0}
+stap_run2 $srcdir/$subdir/$test.stp
diff --git a/testsuite/systemtap.string/strtol.stp b/testsuite/systemtap.string/strtol.stp
new file mode 100644
index 00000000..dcd1fe71
--- /dev/null
+++ b/testsuite/systemtap.string/strtol.stp
@@ -0,0 +1,29 @@
+probe begin
+{
+ teststr1 = "1"
+ teststr2 = "-1"
+ teststr3 = "123456789"
+ teststr4 = "-123456789"
+ teststr5 = "abcdef"
+ teststr6 = "123456789abcdef"
+ teststr7 = " 1 2 3 4"
+ teststr8 = ""
+ teststr9 = "1000"
+ teststr6 = "1a2b3c4d5e6f7g8h9"
+
+ printf("%d\n", strtol(teststr1, 10))
+ printf("%d\n", strtol(teststr2, 10))
+ printf("%d\n", strtol(teststr3, 10))
+ printf("%d\n", strtol(teststr4, 10))
+ printf("%d\n", strtol(teststr5, 10))
+ printf("%d\n", strtol(teststr6, 10))
+ printf("%d\n", strtol(teststr7, 10))
+ printf("%d\n", strtol(teststr8, 10))
+ printf("%d\n", strtol(teststr9, 10))
+ printf("%d\n", strtol(teststr9, 16))
+ printf("%d\n", strtol(teststr9, 8))
+ printf("%d\n", strtol(teststr9, 2))
+ printf("%d\n", strtol(teststr10, 2))
+
+ exit()
+}
diff --git a/testsuite/systemtap.string/tokenize.exp b/testsuite/systemtap.string/tokenize.exp
new file mode 100644
index 00000000..697b7c7e
--- /dev/null
+++ b/testsuite/systemtap.string/tokenize.exp
@@ -0,0 +1,26 @@
+set test "tokenize"
+set ::result_string {one
+two
+three
+four
+five
+six
+seven
+eight
+nine
+ten
+one|two|three|four|five|six|seven|eight|nine|ten
+a
+b
+c
+d
+e
+f
+g
+1
+2
+3
+
+4
+this is a string with no delimiters}
+stap_run2 $srcdir/$subdir/$test.stp
diff --git a/testsuite/systemtap.string/tokenize.stp b/testsuite/systemtap.string/tokenize.stp
new file mode 100644
index 00000000..10703d90
--- /dev/null
+++ b/testsuite/systemtap.string/tokenize.stp
@@ -0,0 +1,46 @@
+probe begin
+{
+ teststr1 = "one|two|three|four|five|six|seven|eight|nine|ten"
+ teststr2 = "a,b,c,d,e,f,g"
+ teststr3 = "1,,2,3, ,4"
+ teststr4 = ""
+ teststr5 = "this is a string with no delimiters"
+
+ tok = tokenize(teststr1, "|")
+ while (tok != "") {
+ printf("%s\n", tok)
+ tok = tokenize("", "|")
+ }
+
+ tok = tokenize(teststr1, ",")
+ while (tok != "") {
+ printf("%s\n", tok)
+ tok = tokenize("", "|")
+ }
+
+ tok = tokenize(teststr2, ",")
+ while (tok != "") {
+ printf("%s\n", tok)
+ tok = tokenize("", ",")
+ }
+
+ tok = tokenize(teststr3, ",")
+ while (tok != "") {
+ printf("%s\n", tok)
+ tok = tokenize("", ",")
+ }
+
+ tok = tokenize(teststr4, ",")
+ while (tok != "") {
+ printf("%s\n", tok)
+ tok = tokenize("", ",")
+ }
+
+ tok = tokenize(teststr5, ",")
+ while (tok != "") {
+ printf("%s\n", tok)
+ tok = tokenize("", ",")
+ }
+
+ exit()
+}