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
bacd9f5b
Commit
bacd9f5b
authored
Dec 05, 2007
by
Rich Prohaska
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add boundary tests. addresses #121
git-svn-id:
file:///svn/tokudb@940
c7de825b-a66e-492c-adef-691d508d4ae1
parent
bab5a291
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
12 deletions
+19
-12
src/tests/test_dup_next.c
src/tests/test_dup_next.c
+19
-12
No files found.
src/tests/test_dup_next.c
View file @
bacd9f5b
...
...
@@ -6,6 +6,7 @@
#include <assert.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <sys/stat.h>
#include <arpa/inet.h>
#include <db.h>
...
...
@@ -78,10 +79,10 @@ void expect_cursor_set(DBC *cursor, int k, int expectv) {
assert
(
expectv
==
vv
);
}
void
expect_cursor_get
(
DBC
*
cursor
,
int
expectk
,
int
expectv
,
int
op
)
{
int
expect_cursor_get
(
DBC
*
cursor
,
int
expectk
,
int
expectv
,
int
op
)
{
DBT
key
,
val
;
int
r
=
cursor
->
c_get
(
cursor
,
dbt_init_zero
(
&
key
),
dbt_init_zero
(
&
val
),
op
);
assert
(
r
==
0
);
if
(
r
==
0
)
{
assert
(
key
.
size
==
sizeof
expectk
);
int
kk
;
memcpy
(
&
kk
,
key
.
data
,
key
.
size
);
...
...
@@ -91,6 +92,8 @@ void expect_cursor_get(DBC *cursor, int expectk, int expectv, int op) {
if
(
kk
!=
expectk
||
vv
!=
expectv
)
printf
(
"expect key %d got %d - %d %d
\n
"
,
htonl
(
expectk
),
htonl
(
kk
),
htonl
(
expectv
),
htonl
(
vv
));
assert
(
kk
==
expectk
);
assert
(
vv
==
expectv
);
}
return
r
;
}
void
test_dup_next
(
int
n
,
int
dup_mode
)
{
...
...
@@ -124,12 +127,16 @@ void test_dup_next(int n, int dup_mode) {
DBC
*
cursor
;
r
=
db
->
cursor
(
db
,
null_txn
,
&
cursor
,
0
);
assert
(
r
==
0
);
r
=
expect_cursor_get
(
cursor
,
htonl
(
1
),
htonl
(
0
),
DB_NEXT_DUP
);
assert
(
r
==
EINVAL
);
expect_cursor_set
(
cursor
,
htonl
(
1
),
htonl
(
0
));
for
(
i
=
1
;
i
<
n
;
i
++
)
{
expect_cursor_get
(
cursor
,
htonl
(
1
),
htonl
(
i
),
DB_NEXT_DUP
);
r
=
expect_cursor_get
(
cursor
,
htonl
(
1
),
htonl
(
i
),
DB_NEXT_DUP
);
assert
(
r
==
0
);
}
r
=
expect_cursor_get
(
cursor
,
htonl
(
1
),
htonl
(
i
),
DB_NEXT_DUP
);
assert
(
r
==
DB_NOTFOUND
);
r
=
cursor
->
c_close
(
cursor
);
assert
(
r
==
0
);
r
=
db
->
close
(
db
,
0
);
assert
(
r
==
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