test-bus-match.c revision eb01ba5de14859d7a94835ab9299de40132d549a
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
/***
This file is part of systemd.
Copyright 2013 Lennart Poettering
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
systemd is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <assert.h>
#include "log.h"
#include "util.h"
#include "macro.h"
#include "bus-match.h"
#include "bus-message.h"
static bool mask[32];
return 0;
}
static bool mask_contains(unsigned a[], unsigned n) {
unsigned i, j;
for (i = 0; i < ELEMENTSOF(mask); i++) {
bool found = false;
for (j = 0; j < n; j++)
if (a[j] == i) {
found = true;
break;
}
return false;
}
return true;
}
struct bus_match_node root;
enum bus_match_node_type i;
assert_se(bus_match_add(&root, "arg2='wal\\'do',sender='foo',type='signal',interface='bar',", filter, INT_TO_PTR(1), NULL) >= 0);
assert_se(bus_match_add(&root, "arg2='wal\\'do2',sender='foo',type='signal',interface='bar',", filter, INT_TO_PTR(2), NULL) >= 0);
assert_se(bus_match_add(&root, "arg3='test',sender='foo',type='signal',interface='bar',", filter, INT_TO_PTR(3), NULL) >= 0);
assert_se(bus_match_add(&root, "arg3='test',sender='foo',type='method_call',interface='bar',", filter, INT_TO_PTR(4), NULL) >= 0);
assert_se(bus_match_add(&root, "member='waldo',path='/foo/bar'", filter, INT_TO_PTR(8), NULL) >= 0);
assert_se(bus_match_add(&root, "member='waldo',arg2path='/prefix/'", filter, INT_TO_PTR(13), NULL) >= 0);
assert_se(bus_match_add(&root, "member='waldo',path='/foo/bar',arg3namespace='prefix'", filter, INT_TO_PTR(14), NULL) >= 0);
bus_match_dump(&root, 0);
assert_se(bus_match_remove(&root, "arg2path='/prefix/',member='waldo'", filter, INT_TO_PTR(13)) > 0);
bus_match_dump(&root, 0);
for (i = 0; i < _BUS_MATCH_NODE_TYPE_MAX; i++) {
char buf[32];
const char *x;
if (i >= BUS_MATCH_MESSAGE_TYPE)
}
return 0;
}