summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2017-09-16 16:41:37 -0400
committerTavian Barnes <tavianator@tavianator.com>2017-09-16 16:57:01 -0400
commit511d6fe676056a72f58daa7307267603f42003f3 (patch)
tree54323107abe5fc9b750c18dbf67262f0e353d87b
parent69a5f09e1fa0cd85bf5cd90342856ef175b40a25 (diff)
downloadbfs-511d6fe676056a72f58daa7307267603f42003f3.tar.xz
tests: Add tests that trigger some optimizations
-rwxr-xr-xtests.sh40
-rw-r--r--tests/test_comma_reachability.out1
-rw-r--r--tests/test_data_flow_depth.out8
-rw-r--r--tests/test_data_flow_type.out0
-rw-r--r--tests/test_de_morgan_and.out10
-rw-r--r--tests/test_de_morgan_not.out6
-rw-r--r--tests/test_de_morgan_or.out18
-rw-r--r--tests/test_double_negation.out3
-rw-r--r--tests/test_not_reachability.out1
9 files changed, 87 insertions, 0 deletions
diff --git a/tests.sh b/tests.sh
index bd94583..983d3b3 100755
--- a/tests.sh
+++ b/tests.sh
@@ -208,6 +208,12 @@ posix_tests=(
test_a
test_o
test_deep
+ test_double_negation
+ test_not_reachability
+ test_de_morgan_not
+ test_de_morgan_and
+ test_de_morgan_or
+ test_data_flow_type
)
bsd_tests=(
@@ -270,6 +276,7 @@ bsd_tests=(
test_nouser
test_exit
test_printx
+ test_data_flow_depth
)
gnu_tests=(
@@ -367,6 +374,7 @@ gnu_tests=(
test_precedence
test_and_purity
test_or_purity
+ test_comma_reachability
)
bfs_tests=(
@@ -1365,6 +1373,38 @@ function test_or_purity() {
bfs_diff basic -name '*' -o -print
}
+function test_double_negation() {
+ bfs_diff basic \! \! -name 'foo'
+}
+
+function test_not_reachability() {
+ bfs_diff basic -print \! -quit -print
+}
+
+function test_comma_reachability() {
+ bfs_diff basic -print -quit , -print
+}
+
+function test_de_morgan_not() {
+ bfs_diff basic \! \( -name 'foo' -o \! -type f \)
+}
+
+function test_de_morgan_and() {
+ bfs_diff basic \( \! -name 'foo' -a \! -type f \)
+}
+
+function test_de_morgan_or() {
+ bfs_diff basic \( \! -name 'foo' -o \! -type f \)
+}
+
+function test_data_flow_depth() {
+ bfs_diff basic -depth +1 -depth -4
+}
+
+function test_data_flow_type() {
+ bfs_diff basic \! \( -type f -o \! -type f \)
+}
+
if [ -t 1 -a ! "$VERBOSE" ]; then
in_place=yes
fi
diff --git a/tests/test_comma_reachability.out b/tests/test_comma_reachability.out
new file mode 100644
index 0000000..15a13db
--- /dev/null
+++ b/tests/test_comma_reachability.out
@@ -0,0 +1 @@
+basic
diff --git a/tests/test_data_flow_depth.out b/tests/test_data_flow_depth.out
new file mode 100644
index 0000000..350b489
--- /dev/null
+++ b/tests/test_data_flow_depth.out
@@ -0,0 +1,8 @@
+basic/c/d
+basic/e/f
+basic/g/h
+basic/j/foo
+basic/k/foo
+basic/l/foo
+basic/k/foo/bar
+basic/l/foo/bar
diff --git a/tests/test_data_flow_type.out b/tests/test_data_flow_type.out
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests/test_data_flow_type.out
diff --git a/tests/test_de_morgan_and.out b/tests/test_de_morgan_and.out
new file mode 100644
index 0000000..723790f
--- /dev/null
+++ b/tests/test_de_morgan_and.out
@@ -0,0 +1,10 @@
+basic
+basic/c
+basic/e
+basic/g
+basic/i
+basic/j
+basic/k
+basic/l
+basic/g/h
+basic/l/foo/bar
diff --git a/tests/test_de_morgan_not.out b/tests/test_de_morgan_not.out
new file mode 100644
index 0000000..5916da3
--- /dev/null
+++ b/tests/test_de_morgan_not.out
@@ -0,0 +1,6 @@
+basic/a
+basic/b
+basic/c/d
+basic/e/f
+basic/k/foo/bar
+basic/l/foo/bar/baz
diff --git a/tests/test_de_morgan_or.out b/tests/test_de_morgan_or.out
new file mode 100644
index 0000000..697f6b8
--- /dev/null
+++ b/tests/test_de_morgan_or.out
@@ -0,0 +1,18 @@
+basic
+basic/a
+basic/b
+basic/c
+basic/e
+basic/g
+basic/i
+basic/j
+basic/k
+basic/l
+basic/c/d
+basic/e/f
+basic/g/h
+basic/k/foo
+basic/l/foo
+basic/k/foo/bar
+basic/l/foo/bar
+basic/l/foo/bar/baz
diff --git a/tests/test_double_negation.out b/tests/test_double_negation.out
new file mode 100644
index 0000000..e9d47b1
--- /dev/null
+++ b/tests/test_double_negation.out
@@ -0,0 +1,3 @@
+basic/j/foo
+basic/k/foo
+basic/l/foo
diff --git a/tests/test_not_reachability.out b/tests/test_not_reachability.out
new file mode 100644
index 0000000..15a13db
--- /dev/null
+++ b/tests/test_not_reachability.out
@@ -0,0 +1 @@
+basic