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
52b60202
Commit
52b60202
authored
Nov 30, 2007
by
Bradley C. Kuszmaul
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make a test for #101. Addresses #101.
git-svn-id:
file:///svn/tokudb@856
c7de825b-a66e-492c-adef-691d508d4ae1
parent
17da9fee
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
0 deletions
+45
-0
src/tests/test_get_zeroed_dbt.c
src/tests/test_get_zeroed_dbt.c
+45
-0
No files found.
src/tests/test_get_zeroed_dbt.c
0 → 100644
View file @
52b60202
/* Test to see if DB->get works on a zeroed DBT. */
#include <db.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <sys/stat.h>
#include "test.h"
DBT
*
dbt_init
(
DBT
*
dbt
,
void
*
data
,
u_int32_t
size
)
{
memset
(
dbt
,
0
,
sizeof
*
dbt
);
dbt
->
data
=
data
;
dbt
->
size
=
size
;
return
dbt
;
}
void
test_get
(
int
dup_mode
)
{
DB_ENV
*
const
null_env
=
0
;
DB_TXN
*
const
null_txn
=
0
;
DB
*
db
;
DBT
key
,
data
;
int
fnamelen
=
sizeof
(
DIR
)
+
30
;
char
fname
[
fnamelen
];
int
r
;
snprintf
(
fname
,
fnamelen
,
"%s/test%d.db"
,
DIR
,
dup_mode
);
r
=
db_create
(
&
db
,
null_env
,
0
);
assert
(
r
==
0
);
r
=
db
->
set_flags
(
db
,
dup_mode
);
assert
(
r
==
0
);
r
=
db
->
open
(
db
,
null_txn
,
fname
,
"main"
,
DB_BTREE
,
DB_CREATE
,
0666
);
assert
(
r
==
0
);
dbt_init
(
&
key
,
"a"
,
2
);
r
=
db
->
put
(
db
,
null_txn
,
&
key
,
dbt_init
(
&
data
,
"b"
,
2
),
0
);
assert
(
r
==
0
);
memset
(
&
data
,
0
,
sizeof
(
data
));
r
=
db
->
get
(
db
,
null_txn
,
&
key
,
&
data
,
0
);
assert
(
r
==
0
);
assert
(
strcmp
(
data
.
data
,
"b"
)
==
0
);
}
int
main
(
int
argc
,
const
char
*
argv
[])
{
parse_args
(
argc
,
argv
);
system
(
"rm -rf "
DIR
);
mkdir
(
DIR
,
0777
);
test_get
(
0
);
test_get
(
DB_DUP
+
DB_DUPSORT
);
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