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
387523dc
Commit
387523dc
authored
Sep 18, 2013
by
John Esmet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refs #70 Add a test to the range buffer that verifies the buf grows
properly after a small append into a large append
parent
ae87b251
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
0 deletions
+33
-0
locktree/tests/range_buffer_test.cc
locktree/tests/range_buffer_test.cc
+33
-0
No files found.
locktree/tests/range_buffer_test.cc
View file @
387523dc
...
...
@@ -205,11 +205,44 @@ static void test_mixed(void) {
buffer
.
destroy
();
}
static
void
test_small_and_large_points
(
void
)
{
range_buffer
buffer
;
buffer
.
create
();
buffer
.
destroy
();
// Test a bug where a small append would cause
// the range buffer to not grow properly for
// a subsequent large append.
const
size_t
small_size
=
32
;
const
size_t
large_size
=
16
*
1024
;
char
*
small_buf
=
toku_xmalloc
(
small_size
);
char
*
large_buf
=
toku_xmalloc
(
large_size
);
DBT
small_dbt
,
large_dbt
;
memset
(
&
small_dbt
,
0
,
sizeof
(
DBT
));
memset
(
&
large_dbt
,
0
,
sizeof
(
DBT
));
small_dbt
.
data
=
small_buf
;
small_dbt
.
size
=
small_size
;
large_dbt
.
data
=
large_buf
;
large_dbt
.
size
=
large_size
;
// Append a small dbt, the buf should be able to fit it.
buffer
.
append
(
&
small_dbt
,
&
small_dbt
);
invariant
(
buffer
.
m_buf_size
>=
small_dbt
.
size
);
// Append a large dbt, the buf should be able to fit it.
buffer
.
append
(
&
small_dbt
,
&
small_dbt
);
invariant
(
buffer
.
m_buf_size
>=
(
small_dbt
.
size
+
large_dbt
.
size
));
toku_free
(
small_buf
);
toku_free
(
large_buf
);
buffer
.
destroy
();
}
}
/* namespace toku */
int
main
(
void
)
{
toku
::
test_points
();
toku
::
test_ranges
();
toku
::
test_mixed
();
toku
::
test_small_and_large_points
();
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