r7560: added tests for extended bitop search functions
authorAndrew Tridgell <tridge@samba.org>
Tue, 14 Jun 2005 02:34:13 +0000 (02:34 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:18:08 +0000 (13:18 -0500)
(This used to be commit 7b58b3a9c53952f606eb75f5e916e0cf994b2d06)

source4/lib/ldb/tests/test-extended.sh [new file with mode: 0755]
source4/lib/ldb/tests/test-tdb.sh

diff --git a/source4/lib/ldb/tests/test-extended.sh b/source4/lib/ldb/tests/test-extended.sh
new file mode 100755 (executable)
index 0000000..246b55f
--- /dev/null
@@ -0,0 +1,49 @@
+#!/bin/sh
+
+rm -f $LDB_URL
+
+cat <<EOF | bin/ldbadd - || exit 1
+dn: testrec1
+i1: 1
+i2: 0
+i3: 1234
+i4: 0x7003004
+
+dn: testrec2
+i1: 0x800000
+
+dn: testrec3
+i1: 0x101010101
+i1: 7
+EOF
+
+checkcount() {
+    count=$1
+    expression="$2"
+    n=`bin/ldbsearch "$expression" | grep ^dn | wc -l`
+    if [ $n != $count ]; then
+       echo "Got $n but expected $count for $expression"
+       bin/ldbsearch "$expression"
+       exit 1
+    fi
+    echo "OK: $count $expression"
+}
+
+checkcount 1 '(i3=1234)'
+checkcount 0 '(i3=12345)'
+
+checkcount 2 '(i1:1.2.840.113556.1.4.803:=1)'
+checkcount 1 '(i1:1.2.840.113556.1.4.803:=3)'
+checkcount 1 '(i1:1.2.840.113556.1.4.803:=7)'
+checkcount 0 '(i1:1.2.840.113556.1.4.803:=15)'
+checkcount 1 '(i1:1.2.840.113556.1.4.803:=0x800000)'
+checkcount 1 '(i1:1.2.840.113556.1.4.803:=8388608)'
+
+checkcount 2 '(i1:1.2.840.113556.1.4.804:=1)'
+checkcount 2 '(i1:1.2.840.113556.1.4.804:=3)'
+checkcount 2 '(i1:1.2.840.113556.1.4.804:=7)'
+checkcount 2 '(i1:1.2.840.113556.1.4.804:=15)'
+checkcount 1 '(i1:1.2.840.113556.1.4.804:=0x800000)'
+checkcount 1 '(i1:1.2.840.113556.1.4.804:=8388608)'
+
+rm -f $LDB_URL
index 69b30a50b4fe5f8d184abecc1a30dc1283ebccf8..9c2f9cd7ba9edbcf0da7c8519536dc196d7531e5 100755 (executable)
@@ -7,3 +7,4 @@ rm -f tdbtest.ldb
 
 . tests/test-generic.sh
 
+. tests/test-extended.sh