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
b1b286de
Commit
b1b286de
authored
Aug 27, 2007
by
Rich Prohaska
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add empty tree test cases
git-svn-id:
file:///svn/tokudb@215
c7de825b-a66e-492c-adef-691d508d4ae1
parent
ee92fa88
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
32 deletions
+36
-32
newbrt/brt-test.c
newbrt/brt-test.c
+36
-32
No files found.
newbrt/brt-test.c
View file @
b1b286de
...
...
@@ -811,33 +811,24 @@ static void test_wrongendian_compare (int wrong_p, unsigned int N) {
int
test_cursor_debug
=
0
;
void
assert_
tree_first
(
BRT
brt
,
long
long
firstv
)
{
void
assert_
cursor_notfound
(
BRT
brt
,
int
position
)
{
BRT_CURSOR
cursor
;
int
r
;
DBT
kbt
,
vbt
;
long
long
v
;
r
=
brt_cursor
(
brt
,
&
cursor
);
assert
(
r
==
0
);
if
(
test_cursor_debug
)
printf
(
"first key: "
);
init_dbt
(
&
kbt
);
kbt
.
flags
=
DB_DBT_MALLOC
;
init_dbt
(
&
vbt
);
vbt
.
flags
=
DB_DBT_MALLOC
;
r
=
brt_c_get
(
cursor
,
&
kbt
,
&
vbt
,
DB_FIRST
);
assert
(
r
==
0
);
if
(
test_cursor_debug
)
printf
(
"%s "
,
(
char
*
)
kbt
.
data
);
assert
(
vbt
.
size
==
sizeof
v
);
memcpy
(
&
v
,
vbt
.
data
,
vbt
.
size
);
assert
(
v
==
firstv
);
toku_free
(
kbt
.
data
);
toku_free
(
vbt
.
data
);
if
(
test_cursor_debug
)
printf
(
"
\n
"
);
r
=
brt_c_get
(
cursor
,
&
kbt
,
&
vbt
,
position
);
assert
(
r
==
DB_NOTFOUND
);
r
=
brt_cursor_close
(
cursor
);
assert
(
r
==
0
);
}
void
assert_
tree_last
(
BRT
brt
,
long
long
lastv
)
{
void
assert_
cursor_value
(
BRT
brt
,
int
position
,
long
long
value
)
{
BRT_CURSOR
cursor
;
int
r
;
DBT
kbt
,
vbt
;
...
...
@@ -846,15 +837,15 @@ void assert_tree_last(BRT brt, long long lastv) {
r
=
brt_cursor
(
brt
,
&
cursor
);
assert
(
r
==
0
);
if
(
test_cursor_debug
)
printf
(
"
last key:
"
);
if
(
test_cursor_debug
)
printf
(
"
key:
"
);
init_dbt
(
&
kbt
);
kbt
.
flags
=
DB_DBT_MALLOC
;
init_dbt
(
&
vbt
);
vbt
.
flags
=
DB_DBT_MALLOC
;
r
=
brt_c_get
(
cursor
,
&
kbt
,
&
vbt
,
DB_LAST
);
r
=
brt_c_get
(
cursor
,
&
kbt
,
&
vbt
,
position
);
assert
(
r
==
0
);
if
(
test_cursor_debug
)
printf
(
"%s "
,
(
char
*
)
kbt
.
data
);
assert
(
vbt
.
size
==
sizeof
v
);
memcpy
(
&
v
,
vbt
.
data
,
vbt
.
size
);
assert
(
v
==
lastv
);
assert
(
v
==
value
);
toku_free
(
kbt
.
data
);
toku_free
(
vbt
.
data
);
if
(
test_cursor_debug
)
printf
(
"
\n
"
);
...
...
@@ -863,7 +854,7 @@ void assert_tree_last(BRT brt, long long lastv) {
assert
(
r
==
0
);
}
void
assert_
tree
_first_last
(
BRT
brt
,
long
long
firstv
,
long
long
lastv
)
{
void
assert_
cursor
_first_last
(
BRT
brt
,
long
long
firstv
,
long
long
lastv
)
{
BRT_CURSOR
cursor
;
int
r
;
DBT
kbt
,
vbt
;
...
...
@@ -932,7 +923,10 @@ void test_brt_cursor_first(int n) {
assert
(
r
==
0
);
}
assert_tree_first
(
brt
,
0
);
if
(
n
==
0
)
assert_cursor_notfound
(
brt
,
DB_FIRST
);
else
assert_cursor_value
(
brt
,
DB_FIRST
,
0
);
r
=
close_brt
(
brt
);
assert
(
r
==
0
);
...
...
@@ -971,7 +965,10 @@ void test_brt_cursor_last(int n) {
assert
(
r
==
0
);
}
assert_tree_last
(
brt
,
n
-
1
);
if
(
n
==
0
)
assert_cursor_notfound
(
brt
,
DB_LAST
);
else
assert_cursor_value
(
brt
,
DB_LAST
,
n
-
1
);
r
=
close_brt
(
brt
);
assert
(
r
==
0
);
...
...
@@ -1010,7 +1007,11 @@ void test_brt_cursor_first_last(int n) {
assert
(
r
==
0
);
}
assert_tree_first_last
(
brt
,
0
,
n
-
1
);
if
(
n
==
0
)
{
assert_cursor_notfound
(
brt
,
DB_FIRST
);
assert_cursor_notfound
(
brt
,
DB_LAST
);
}
else
assert_cursor_first_last
(
brt
,
0
,
n
-
1
);
r
=
close_brt
(
brt
);
assert
(
r
==
0
);
...
...
@@ -1049,7 +1050,10 @@ void test_brt_cursor_rfirst(int n) {
assert
(
r
==
0
);
}
assert_tree_first
(
brt
,
0
);
if
(
n
==
0
)
assert_cursor_notfound
(
brt
,
DB_FIRST
);
else
assert_cursor_value
(
brt
,
DB_FIRST
,
0
);
r
=
close_brt
(
brt
);
assert
(
r
==
0
);
...
...
@@ -1058,7 +1062,7 @@ void test_brt_cursor_rfirst(int n) {
assert
(
r
==
0
);
}
void
assert_
tree
_walk
(
BRT
brt
,
int
n
)
{
void
assert_
cursor
_walk
(
BRT
brt
,
int
n
)
{
BRT_CURSOR
cursor
;
int
i
;
int
r
;
...
...
@@ -1121,7 +1125,7 @@ void test_brt_cursor_walk(int n) {
}
/* walk the tree */
assert_
tree
_walk
(
brt
,
n
);
assert_
cursor
_walk
(
brt
,
n
);
r
=
close_brt
(
brt
);
assert
(
r
==
0
);
...
...
@@ -1130,7 +1134,7 @@ void test_brt_cursor_walk(int n) {
assert
(
r
==
0
);
}
void
assert_
tree
_walk_inorder
(
BRT
brt
,
int
n
)
{
void
assert_
cursor
_walk_inorder
(
BRT
brt
,
int
n
)
{
BRT_CURSOR
cursor
;
int
i
;
int
r
;
...
...
@@ -1208,7 +1212,7 @@ void test_brt_cursor_rand(int n) {
}
/* walk the tree */
assert_
tree
_walk_inorder
(
brt
,
n
);
assert_
cursor
_walk_inorder
(
brt
,
n
);
r
=
close_brt
(
brt
);
assert
(
r
==
0
);
...
...
@@ -1301,25 +1305,25 @@ void test_brt_cursor_split(int n) {
void
test_brt_cursor
()
{
int
n
;
if
(
1
)
for
(
n
=
10
0
;
n
<
10000
;
n
+=
100
)
{
if
(
1
)
for
(
n
=
0
;
n
<
10000
;
n
+=
100
)
{
test_brt_cursor_last
(
n
);
memory_check_all_free
();
}
if
(
1
)
for
(
n
=
10
0
;
n
<
10000
;
n
+=
100
)
{
if
(
1
)
for
(
n
=
0
;
n
<
10000
;
n
+=
100
)
{
test_brt_cursor_first
(
n
);
memory_check_all_free
();
}
if
(
1
)
for
(
n
=
10
0
;
n
<
10000
;
n
+=
100
)
{
if
(
1
)
for
(
n
=
0
;
n
<
10000
;
n
+=
100
)
{
test_brt_cursor_rfirst
(
n
);
memory_check_all_free
();
}
if
(
1
)
for
(
n
=
10
0
;
n
<
10000
;
n
+=
100
)
{
if
(
1
)
for
(
n
=
0
;
n
<
10000
;
n
+=
100
)
{
test_brt_cursor_first_last
(
n
);
memory_check_all_free
();
}
if
(
1
)
for
(
n
=
10
0
;
n
<
10000
;
n
+=
100
)
{
if
(
1
)
for
(
n
=
0
;
n
<
10000
;
n
+=
100
)
{
test_brt_cursor_walk
(
n
);
memory_check_all_free
();
}
if
(
1
)
for
(
n
=
10
0
;
n
<
10000
;
n
+=
100
)
{
if
(
1
)
for
(
n
=
0
;
n
<
10000
;
n
+=
100
)
{
test_brt_cursor_split
(
n
);
memory_check_all_free
();
}
if
(
1
)
for
(
n
=
10
0
;
n
<
10000
;
n
+=
100
)
{
if
(
1
)
for
(
n
=
0
;
n
<
10000
;
n
+=
100
)
{
test_brt_cursor_rand
(
n
);
memory_check_all_free
();
}
}
...
...
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