summaryrefslogtreecommitdiffstats
path: root/testsuite/systemtap.string/tokenize.stp
diff options
context:
space:
mode:
authorJosh Stone <jistone@redhat.com>2009-06-17 18:23:39 -0700
committerJosh Stone <jistone@redhat.com>2009-06-17 18:23:39 -0700
commitd917e520b1bd36e2230312ab25c61e6161cdc372 (patch)
tree9385d51f54203f3576e85bbc3f172824d10436c7 /testsuite/systemtap.string/tokenize.stp
parent7f12f9a3f6aeb2452acedced5a54c66c4a19382b (diff)
downloadsystemtap-steved-d917e520b1bd36e2230312ab25c61e6161cdc372.tar.gz
systemtap-steved-d917e520b1bd36e2230312ab25c61e6161cdc372.tar.xz
systemtap-steved-d917e520b1bd36e2230312ab25c61e6161cdc372.zip
Refactor common code in the tokenize test
Diffstat (limited to 'testsuite/systemtap.string/tokenize.stp')
-rw-r--r--testsuite/systemtap.string/tokenize.stp71
1 files changed, 18 insertions, 53 deletions
diff --git a/testsuite/systemtap.string/tokenize.stp b/testsuite/systemtap.string/tokenize.stp
index 1b253c8d..ba95f63f 100644
--- a/testsuite/systemtap.string/tokenize.stp
+++ b/testsuite/systemtap.string/tokenize.stp
@@ -1,3 +1,14 @@
+function tokprint(str, delim)
+{
+ println("-")
+
+ tok = tokenize(str, delim)
+ while (tok != "") {
+ println(tok)
+ tok = tokenize("", delim)
+ }
+}
+
probe begin
{
teststr1 = "one|two|three|four|five|six|seven|eight|nine|ten"
@@ -7,59 +18,13 @@ probe begin
teststr5 = "this is a string with no delimiters"
teststr6 = "this is a string, which has two delimiters"
- tok = tokenize(teststr1, "|")
- while (tok != "") {
- println(tok)
- tok = tokenize("", "|")
- }
-
- println("-")
-
- tok = tokenize(teststr1, ",")
- while (tok != "") {
- println(tok)
- tok = tokenize("", "|")
- }
-
- println("-")
-
- tok = tokenize(teststr2, ",")
- while (tok != "") {
- println(tok)
- tok = tokenize("", ",")
- }
-
- println("-")
-
- tok = tokenize(teststr3, ",")
- while (tok != "") {
- println(tok)
- tok = tokenize("", ",")
- }
-
- println("-")
-
- tok = tokenize(teststr4, ",")
- while (tok != "") {
- println(tok)
- tok = tokenize("", ",")
- }
-
- println("-")
-
- tok = tokenize(teststr5, ",")
- while (tok != "") {
- println(tok)
- tok = tokenize("", ",")
- }
-
- println("-")
-
- tok = tokenize(teststr6, ", ")
- while (tok != "") {
- println(tok)
- tok = tokenize("", ", ")
- }
+ tokprint(teststr1, "|")
+ tokprint(teststr1, ",")
+ tokprint(teststr2, ",")
+ tokprint(teststr3, ",")
+ tokprint(teststr4, ",")
+ tokprint(teststr5, ",")
+ tokprint(teststr6, ", ")
exit()
}