Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
03fa3c84
Commit
03fa3c84
authored
Nov 19, 2007
by
Rich Prohaska
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bdb port
git-svn-id:
file:///svn/tokudb@660
c7de825b-a66e-492c-adef-691d508d4ae1
parent
7e6b32a6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
20 deletions
+35
-20
src/tests/test_db_dup.c
src/tests/test_db_dup.c
+35
-20
No files found.
src/tests/test_db_dup.c
View file @
03fa3c84
...
...
@@ -123,7 +123,10 @@ void test_insert(int n, int dup_mode) {
return
memcmp
(
a
,
b
,
sizeof
(
int
));
}
qsort
(
sortvalues
,
n
,
sizeof
sortvalues
[
0
],
mycmp
);
#if USE_BDB
for
(
i
=
1
;
i
<
n
;
i
++
)
if
(
sortvalues
[
i
-
1
]
==
sortvalues
[
i
])
printf
(
"dup %d
\n
"
,
i
);
#endif
/* insert n-1 unique keys {0, 1, n-1} - {n/2} */
for
(
i
=
0
;
i
<
n
;
i
++
)
{
if
(
i
==
n
/
2
)
...
...
@@ -141,6 +144,18 @@ void test_insert(int n, int dup_mode) {
int
v
=
values
[
i
];
DBT
key
,
val
;
r
=
db
->
put
(
db
,
null_txn
,
dbt_init
(
&
key
,
&
k
,
sizeof
k
),
dbt_init
(
&
val
,
&
v
,
sizeof
v
),
0
);
#if USE_BDB
if
(
r
!=
0
)
{
void
find_dup_val
(
int
v
,
int
m
)
{
int
i
;
printf
(
"dup values[%d]=%d: "
,
m
,
v
);
for
(
i
=
0
;
i
<
m
;
i
++
)
if
(
values
[
i
]
==
v
)
printf
(
"%d "
,
i
);
printf
(
"
\n
"
);
}
find_dup_val
(
values
[
i
],
i
);
}
#endif
assert
(
r
==
0
);
}
...
...
@@ -193,7 +208,7 @@ void test_insert(int n, int dup_mode) {
assert
(
r
==
0
);
}
/* verify dup keys are buffered in order in
non-leaf nodes */
/* verify dup keys are buffered in order in non-leaf nodes */
void
test_nonleaf_insert
(
int
n
,
int
dup_mode
)
{
printf
(
"test_nonleaf_insert:%d %d
\n
"
,
n
,
dup_mode
);
...
...
@@ -1005,40 +1020,40 @@ int main() {
/* test flags */
test_dup_flags
(
DB_DUP
);
test_dup_flags
(
DB_DUP
+
DB_DUPSORT
);
/*
test simple insert
*/
/*
nodup tests
*/
for
(
i
=
1
;
i
<=
(
1
<<
16
);
i
*=
2
)
{
test_insert
(
i
,
0
);
test_insert
(
i
,
DB_DUP
);
test_insert
(
i
,
DB_DUP
+
DB_DUPSORT
);
test_nonleaf_insert
(
i
,
0
);
}
/*
test buffered insert
*/
/*
dup tests
*/
for
(
i
=
1
;
i
<=
(
1
<<
16
);
i
*=
2
)
{
test_nonleaf_insert
(
i
,
0
);
test_insert
(
i
,
DB_DUP
);
test_dup_delete
(
i
,
DB_DUP
);
test_nonleaf_insert
(
i
,
DB_DUP
);
test_nonleaf_insert
(
i
,
DB_DUP
+
DB_DUPSORT
);
test_dup_delete_insert
(
i
,
DB_DUP
);
test_walk_empty
(
i
,
DB_DUP
);
}
/* test dup delete */
/* dup search */
for
(
i
=
1
;
i
<=
(
1
<<
16
);
i
*=
2
)
{
test_dup_delete
(
i
,
DB_DUP
);
test_dup_delete
(
i
,
DB_DUP
+
DB_DUPSORT
);
test_ici_search
(
i
,
DB_DUP
);
test_icdi_search
(
i
,
DB_DUP
);
test_i0i1ci0_search
(
i
,
DB_DUP
);
}
/*
test dup delete insert
*/
/*
dupsort tests
*/
for
(
i
=
1
;
i
<=
(
1
<<
16
);
i
*=
2
)
{
test_dup_delete_insert
(
i
,
DB_DUP
);
test_insert
(
i
,
DB_DUP
+
DB_DUPSORT
);
test_dup_delete
(
i
,
DB_DUP
+
DB_DUPSORT
);
test_nonleaf_insert
(
i
,
DB_DUP
+
DB_DUPSORT
);
test_dup_delete_insert
(
i
,
DB_DUP
+
DB_DUPSORT
);
test_walk_empty
(
i
,
DB_DUP
);
test_walk_empty
(
i
,
DB_DUP
+
DB_DUPSORT
);
test_all_dup_delete_insert
(
i
);
}
/* test dup search */
for
(
i
=
1
;
i
<=
(
1
<<
16
);
i
*=
2
)
{
test_ici_search
(
i
,
DB_DUP
);
test_icdi_search
(
i
,
DB_DUP
);
test_i0i1ci0_search
(
i
,
DB_DUP
);
test_all_dup_delete_insert
(
i
);
}
return
0
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment