MySQL 5.6.14 Source Code Document
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
MySQL 5.6.14 Source Code Document
replication of field metadata works.
ndbapi_simple.cpp
ndbapi_async.cpp
ndbapi_async1.cpp
ndbapi_retries.cpp
ndbapi_simple_index.cpp
ndbapi_scan.cpp
ndbapi_event.cpp
Adaptive Send Algorithm
MySQL Cluster Concepts
basic.cpp
common.hpp
br_test.cpp
ptr_binding_test.cpp
The Performance Schema main page
Performance schema: instrumentation interface page.
Performance schema: the aggregates page.
Todo List
Deprecated List
Modules
Namespaces
Classes
Files
File List
client
cmake
cmd-line-utils
dbug
extra
include
libevent
libmysql
libmysqld
libservices
mysql-test
mysys
mysys_ssl
packaging
plugin
regex
scripts
sql
sql-common
storage
archive
blackhole
csv
example
federated
heap
innobase
myisam
myisammrg
ndb
clusterj
include
ndbapi-examples
src
common
debugger
logger
mgmcommon
portlib
transporter
util
testConfigValues
testProperties
testSimpleProperties
BaseString.cpp
basestring_vsnprintf.c
Bitmask.cpp
ConfigValues.cpp
File.cpp
HashMap.cpp
InputStream.cpp
md5_hash.cpp
ndb_init.cpp
ndb_opts.c
ndb_rand.c
ndb_show_compat.cpp
NdbOut.cpp
NdbPack.cpp
NdbSqlUtil.cpp
ndbzio.c
OutputStream.cpp
parse_mask.hpp
Parser.cpp
Properties.cpp
random.c
require.c
SimpleProperties.cpp
socket_io.cpp
SocketAuthenticator.cpp
SocketClient.cpp
SocketServer.cpp
SparseBitmask.cpp
strdup.c
uucode.c
Vector.cpp
version.cpp
cw
kernel
mgmapi
mgmclient
mgmsrv
ndbapi
ndbjtie
dummy.cpp
test
tools
perfschema
strings
support-files
tests
unittest
vio
zlib
File Members
Examples
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
SparseBitmask.cpp
1
/*
2
Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
3
4
This program is free software; you can redistribute it and/or modify
5
it under the terms of the GNU General Public License as published by
6
the Free Software Foundation; version 2 of the License.
7
8
This program is distributed in the hope that it will be useful,
9
but WITHOUT ANY WARRANTY; without even the implied warranty of
10
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
GNU General Public License for more details.
12
13
You should have received a copy of the GNU General Public License
14
along with this program; if not, write to the Free Software
15
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
16
*/
17
18
#include <util/SparseBitmask.hpp>
19
20
#ifdef TEST_SPARSEBITMASK
21
#include <util/NdbTap.hpp>
22
23
#include "parse_mask.hpp"
24
25
TAPTEST(
SparseBitmask
)
26
{
27
SparseBitmask
b;
28
OK(b.isclear());
29
for
(
unsigned
i
= 0;
i
< 100;
i
++)
30
{
31
if
(
i
> 60)
32
continue
;
33
switch
(
i
)
34
{
35
case
2:
case
3:
case
5:
case
7:
case
11:
case
13:
case
17:
case
19:
case
23:
36
case
29:
case
31:
case
37:
case
41:
case
43:
37
break
;
38
default
:
39
b.set(
i
);
40
}
41
}
42
43
unsigned
found = 0;
44
for
(
unsigned
i
= 0;
i
< 100;
i
++)
45
{
46
if
(b.get(
i
))
47
found++;
48
}
49
OK(found == b.count());
50
OK(found == 47);
51
52
// Set already set bit again
53
b.set(6);
54
OK(found == b.count());
55
56
/*
57
parse_mask
58
*/
59
SparseBitmask
mask(256);
60
OK(parse_mask(
"1,2,5-7"
, mask) == 5);
61
62
// Check all specified bits set
63
OK(mask.get(1));
64
OK(mask.get(2));
65
OK(mask.get(5));
66
OK(mask.get(6));
67
OK(mask.get(7));
68
69
// Check some random bits not set
70
OK(!mask.get(0));
71
OK(!mask.get(4));
72
OK(!mask.get(3));
73
OK(!mask.get(8));
74
OK(!mask.get(22));
75
76
// Parse some more...
77
OK(parse_mask(
"1-256"
, mask));
78
79
// Parse invalid spec(s)
80
OK(parse_mask(
"xx"
, mask) == -1);
81
OK(parse_mask(
"5-"
, mask) == -1);
82
OK(parse_mask(
"-5"
, mask) == -1);
83
OK(parse_mask(
"1,-5"
, mask) == -1);
84
85
// Parse too large spec
86
OK(parse_mask(
"257"
, mask) == -2);
87
OK(parse_mask(
"1-256,257"
, mask) == -2);
88
89
90
return
1;
// OK
91
}
92
93
#endif
storage
ndb
src
common
util
SparseBitmask.cpp
Generated on Sat Nov 9 2013 01:27:04 for MySQL 5.6.14 Source Code Document by
1.8.1.2