summaryrefslogtreecommitdiffstats
path: root/tests/ts/libsmartcols
diff options
context:
space:
mode:
authorKarel Zak2016-09-13 13:08:02 +0200
committerKarel Zak2016-09-13 13:08:02 +0200
commitfa4691833a2758ee3defc31645a502c117624369 (patch)
treef6c2e2300aa8cdc7468b00c4e129bcd3c0bc3387 /tests/ts/libsmartcols
parentlibsmartcols: fix WRAPNL on strings without \n (diff)
downloadkernel-qcow2-util-linux-fa4691833a2758ee3defc31645a502c117624369.tar.gz
kernel-qcow2-util-linux-fa4691833a2758ee3defc31645a502c117624369.tar.xz
kernel-qcow2-util-linux-fa4691833a2758ee3defc31645a502c117624369.zip
libsmartcols: add application to test library features
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'tests/ts/libsmartcols')
-rw-r--r--tests/ts/libsmartcols/files/col-name3
-rw-r--r--tests/ts/libsmartcols/files/col-number3
-rw-r--r--tests/ts/libsmartcols/files/col-string3
-rw-r--r--tests/ts/libsmartcols/files/col-wrap3
-rw-r--r--tests/ts/libsmartcols/files/col-wrapnl3
-rw-r--r--tests/ts/libsmartcols/files/data-number10
-rw-r--r--tests/ts/libsmartcols/files/data-string10
-rw-r--r--tests/ts/libsmartcols/files/data-string-long10
-rw-r--r--tests/ts/libsmartcols/files/data-string-nl10
-rwxr-xr-xtests/ts/libsmartcols/fromfile50
10 files changed, 105 insertions, 0 deletions
diff --git a/tests/ts/libsmartcols/files/col-name b/tests/ts/libsmartcols/files/col-name
new file mode 100644
index 000000000..0a98f29cf
--- /dev/null
+++ b/tests/ts/libsmartcols/files/col-name
@@ -0,0 +1,3 @@
+NAME
+0
+none
diff --git a/tests/ts/libsmartcols/files/col-number b/tests/ts/libsmartcols/files/col-number
new file mode 100644
index 000000000..5ef733f97
--- /dev/null
+++ b/tests/ts/libsmartcols/files/col-number
@@ -0,0 +1,3 @@
+NUM
+3
+right
diff --git a/tests/ts/libsmartcols/files/col-string b/tests/ts/libsmartcols/files/col-string
new file mode 100644
index 000000000..7e2904b9f
--- /dev/null
+++ b/tests/ts/libsmartcols/files/col-string
@@ -0,0 +1,3 @@
+STRINGS
+0
+none
diff --git a/tests/ts/libsmartcols/files/col-wrap b/tests/ts/libsmartcols/files/col-wrap
new file mode 100644
index 000000000..dc4ca340e
--- /dev/null
+++ b/tests/ts/libsmartcols/files/col-wrap
@@ -0,0 +1,3 @@
+WRAP
+0
+wrap
diff --git a/tests/ts/libsmartcols/files/col-wrapnl b/tests/ts/libsmartcols/files/col-wrapnl
new file mode 100644
index 000000000..0a18fd146
--- /dev/null
+++ b/tests/ts/libsmartcols/files/col-wrapnl
@@ -0,0 +1,3 @@
+WRAPNL
+0
+wrapnl
diff --git a/tests/ts/libsmartcols/files/data-number b/tests/ts/libsmartcols/files/data-number
new file mode 100644
index 000000000..562d75061
--- /dev/null
+++ b/tests/ts/libsmartcols/files/data-number
@@ -0,0 +1,10 @@
+0
+100
+21
+3
+411
+5111
+678993321
+7666666
+8765
+987456
diff --git a/tests/ts/libsmartcols/files/data-string b/tests/ts/libsmartcols/files/data-string
new file mode 100644
index 000000000..dff6e9c80
--- /dev/null
+++ b/tests/ts/libsmartcols/files/data-string
@@ -0,0 +1,10 @@
+aaaa
+bbb
+ccccc
+dddddd
+ee
+ffff
+gggggg
+hhh
+iiiiii
+jj
diff --git a/tests/ts/libsmartcols/files/data-string-long b/tests/ts/libsmartcols/files/data-string-long
new file mode 100644
index 000000000..1b5683aa4
--- /dev/null
+++ b/tests/ts/libsmartcols/files/data-string-long
@@ -0,0 +1,10 @@
+qqqqqqqqqqqqqqqqqX
+dddddddddddddX
+ffffffffffffffffffffffffffffffffffffffffX
+ssssssssssX
+ddddddddddddddddddddddddddX
+jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjX
+mmmmmmmmmmmmmmmmmmmX
+lllllllllllllllllllllllllllllllllllllX
+yyyyyyyyyyyyyyyyyyyyyyyyyyyyX
+pppppppppX
diff --git a/tests/ts/libsmartcols/files/data-string-nl b/tests/ts/libsmartcols/files/data-string-nl
new file mode 100644
index 000000000..7822e57bc
--- /dev/null
+++ b/tests/ts/libsmartcols/files/data-string-nl
@@ -0,0 +1,10 @@
+aaa
+bbbbb
+cccc\nCCCC
+dddddddd\nDDDD\nDD
+hello\nbaby
+aaa\nbbb\nccc\nddd
+eee
+fffff
+g\nhhhhh
+ppppppppp
diff --git a/tests/ts/libsmartcols/fromfile b/tests/ts/libsmartcols/fromfile
new file mode 100755
index 000000000..456ca4367
--- /dev/null
+++ b/tests/ts/libsmartcols/fromfile
@@ -0,0 +1,50 @@
+#!/bin/bash
+#
+# This file is part of util-linux.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+#
+
+TS_TOPDIR="${0%/*}/../.."
+TS_DESC="fromfile"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+
+TESTPROG="$TS_HELPER_LIBSMARTCOLS_FROMFILE"
+ts_check_test_command "$TESTPROG"
+
+
+ts_init_subtest "right"
+$TESTPROG --nlines 10 \
+ --column $TS_SELF/files/col-name \
+ --column $TS_SELF/files/col-number \
+ --column $TS_SELF/files/col-string \
+ $TS_SELF/files/data-string \
+ $TS_SELF/files/data-number \
+ $TS_SELF/files/data-string-long \
+ >> $TS_OUTPUT 2>&1
+ts_finalize_subtest
+
+ts_init_subtest "wrapnl"
+$TESTPROG --nlines 10 \
+ --column $TS_SELF/files/col-name \
+ --column $TS_SELF/files/col-number \
+ --column $TS_SELF/files/col-wrapnl \
+ $TS_SELF/files/data-string \
+ $TS_SELF/files/data-number \
+ $TS_SELF/files/data-string-nl \
+ >> $TS_OUTPUT 2>&1
+ts_finalize_subtest
+
+ts_log "...done."
+ts_finalize