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
f362644e
Commit
f362644e
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
93e1f7df
Changes
1
Hide 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 @
f362644e
...
...
@@ -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,19 +79,21 @@ 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
);
assert
(
key
.
size
==
sizeof
expectk
);
int
kk
;
memcpy
(
&
kk
,
key
.
data
,
key
.
size
);
assert
(
val
.
size
==
sizeof
expectv
);
int
vv
;
memcpy
(
&
vv
,
val
.
data
,
val
.
size
);
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
);
if
(
r
==
0
)
{
assert
(
key
.
size
==
sizeof
expectk
);
int
kk
;
memcpy
(
&
kk
,
key
.
data
,
key
.
size
);
assert
(
val
.
size
==
sizeof
expectv
);
int
vv
;
memcpy
(
&
vv
,
val
.
data
,
val
.
size
);
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