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
c83a7663
Commit
c83a7663
authored
18 years ago
by
mats@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WL#3206 (Add unit tests):
More changes according to review comments.
parent
8d898d37
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
25 deletions
+24
-25
unittest/README.txt
unittest/README.txt
+14
-11
unittest/mysys/bitmap.t.c
unittest/mysys/bitmap.t.c
+8
-13
unittest/unit.pl
unittest/unit.pl
+2
-1
No files found.
unittest/README.txt
View file @
c83a7663
Unit tests directory structure
------------------------------
Unit test structure
This is the current structure of the unit tests. More directories
-------------------
will be added over time.
This is the current structure of the unit tests. All directories does
mytap Source for the MyTAP library
not currently exist, and more directories will be added over time.
mysys Tests for mysys components
bitmap.t.c Unit test for MY_BITMAP
base64.t.c Unit test for base64 encoding functions
examples Example unit tests
simple.t.c Example of a standard TAP unit test
skip.t.c Example where some test points are skipped
skip_all.t.c Example of a test where the entire test is skipped
todo.t.c Example where test contain test points that are TODO
no_plan.t.c Example of a test with no plan (avoid this)
+ mysys Tests for mysys components
+ examples Example unit tests
+ sql Unit tests for server code
+ rpl Unit tests for replication code
+ log Unit tests for logging
Executing unit tests
Executing unit tests
--------------------
--------------------
...
@@ -29,5 +34,3 @@ directory and add the following to the Makefile.am in that directory
...
@@ -29,5 +34,3 @@ directory and add the following to the Makefile.am in that directory
noinst_PROGRAMS = ... foo.t
noinst_PROGRAMS = ... foo.t
foo_t_c_SOURCES = foo.t.c
foo_t_c_SOURCES = foo.t.c
This diff is collapsed.
Click to expand it.
unittest/mysys/bitmap.t.c
View file @
c83a7663
...
@@ -24,15 +24,7 @@
...
@@ -24,15 +24,7 @@
#include <my_global.h>
#include <my_global.h>
#include <my_bitmap.h>
#include <my_bitmap.h>
static
void
bitmap_print
(
MY_BITMAP
*
map
)
#include <string.h>
{
uint32
*
to
=
map
->
bitmap
,
*
end
=
map
->
last_word_ptr
;
while
(
to
<=
end
)
{
fprintf
(
stderr
,
"0x%x "
,
*
to
++
);
}
fprintf
(
stderr
,
"
\n
"
);
}
uint
get_rand_bit
(
uint
bitsize
)
uint
get_rand_bit
(
uint
bitsize
)
{
{
...
@@ -85,7 +77,8 @@ bool test_flip_bit(MY_BITMAP *map, uint bitsize)
...
@@ -85,7 +77,8 @@ bool test_flip_bit(MY_BITMAP *map, uint bitsize)
return
TRUE
;
return
TRUE
;
}
}
bool
test_operators
(
MY_BITMAP
*
map
,
uint
bitsize
)
bool
test_operators
(
MY_BITMAP
*
map
__attribute__
((
unused
)),
uint
bitsize
__attribute__
((
unused
)))
{
{
return
FALSE
;
return
FALSE
;
}
}
...
@@ -266,7 +259,7 @@ bool test_count_bits_set(MY_BITMAP *map, uint bitsize)
...
@@ -266,7 +259,7 @@ bool test_count_bits_set(MY_BITMAP *map, uint bitsize)
bool
test_get_first_bit
(
MY_BITMAP
*
map
,
uint
bitsize
)
bool
test_get_first_bit
(
MY_BITMAP
*
map
,
uint
bitsize
)
{
{
uint
i
,
j
,
test_bit
;
uint
i
,
test_bit
;
uint
no_loops
=
bitsize
>
128
?
128
:
bitsize
;
uint
no_loops
=
bitsize
>
128
?
128
:
bitsize
;
for
(
i
=
0
;
i
<
no_loops
;
i
++
)
for
(
i
=
0
;
i
<
no_loops
;
i
++
)
{
{
...
@@ -385,8 +378,10 @@ bool do_test(uint bitsize)
...
@@ -385,8 +378,10 @@ bool do_test(uint bitsize)
int
main
()
int
main
()
{
{
int
i
;
int
i
;
plan
(
4095
);
int
const
min_size
=
1
;
for
(
i
=
1
;
i
<
4096
;
i
++
)
int
const
max_size
=
1024
;
plan
(
max_size
-
min_size
);
for
(
i
=
min_size
;
i
<
max_size
;
i
++
)
ok
(
do_test
(
i
)
==
0
,
"bitmap size %d"
,
i
);
ok
(
do_test
(
i
)
==
0
,
"bitmap size %d"
,
i
);
return
exit_status
();
return
exit_status
();
}
}
This diff is collapsed.
Click to expand it.
unittest/unit.pl
View file @
c83a7663
...
@@ -100,7 +100,8 @@ sub run_cmd (@) {
...
@@ -100,7 +100,8 @@ sub run_cmd (@) {
# we are replacing the straps under the feet of Test::Harness,
# we are replacing the straps under the feet of Test::Harness,
# we need to do some basic initializations in the new straps.
# we need to do some basic initializations in the new straps.
$
Test::Harness::
Strap
=
MySQL::
Straps
->
new
;
$
Test::Harness::
Strap
=
MySQL::
Straps
->
new
;
$
Test::Harness::
Strap
->
{
callback
}
=
\&
Test::Harness::
strap_callback
;
$
Test::Harness::
Strap
->
{
callback
}
=
\&
Test::Harness::
strap_callback
if
defined
&
Test::Harness::
strap_callback
;
runtests
@files
;
runtests
@files
;
}
}
...
...
This diff is collapsed.
Click to expand it.
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