summaryrefslogtreecommitdiff
path: root/src/libsystemd-bus/test-bus-signature.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-03-31 16:16:37 +0200
committerLennart Poettering <lennart@poettering.net>2013-03-31 16:16:37 +0200
commit392d5b378ceae5e1fd7c91ca545fcf4cd105744a (patch)
treee231fe77155323de76b535cd509ee5677f1bf28f /src/libsystemd-bus/test-bus-signature.c
parent11c4c2492083325531aeb3eeb9b041c929677890 (diff)
bus: parse matches locally and allow registration of callbacks for them
This includes code to parse and split up match strings which will also be useful to calculate bloom filter masks when the time comes.
Diffstat (limited to 'src/libsystemd-bus/test-bus-signature.c')
-rw-r--r--src/libsystemd-bus/test-bus-signature.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/libsystemd-bus/test-bus-signature.c b/src/libsystemd-bus/test-bus-signature.c
index 5bc4310e7c..cab0daa77e 100644
--- a/src/libsystemd-bus/test-bus-signature.c
+++ b/src/libsystemd-bus/test-bus-signature.c
@@ -24,6 +24,7 @@
#include "log.h"
#include "bus-signature.h"
+#include "bus-internal.h"
int main(int argc, char *argv[]) {
@@ -81,5 +82,35 @@ int main(int argc, char *argv[]) {
assert_se(signature_is_valid("(((((((((((((((((((((((((((((((())))))))))))))))))))))))))))))))", false));
assert_se(!signature_is_valid("((((((((((((((((((((((((((((((((()))))))))))))))))))))))))))))))))", false));
+ assert_se(namespace_complex_pattern("", ""));
+ assert_se(namespace_complex_pattern("foobar", "foobar"));
+ assert_se(namespace_complex_pattern("foobar.waldo", "foobar.waldo"));
+ assert_se(namespace_complex_pattern("foobar.", "foobar.waldo"));
+ assert_se(namespace_complex_pattern("foobar.waldo", "foobar."));
+ assert_se(!namespace_complex_pattern("foobar.waldo", "foobar"));
+ assert_se(!namespace_complex_pattern("foobar", "foobar.waldo"));
+ assert_se(!namespace_complex_pattern("", "foo"));
+ assert_se(!namespace_complex_pattern("foo", ""));
+ assert_se(!namespace_complex_pattern("foo.", ""));
+
+ assert_se(path_complex_pattern("", ""));
+ assert_se(path_complex_pattern("", "/"));
+ assert_se(path_complex_pattern("/", ""));
+ assert_se(path_complex_pattern("/", "/"));
+ assert_se(path_complex_pattern("/foobar/", "/"));
+ assert_se(path_complex_pattern("/foobar/", "/foobar"));
+ assert_se(path_complex_pattern("/foobar", "/foobar"));
+ assert_se(path_complex_pattern("/foobar", "/foobar/"));
+ assert_se(!path_complex_pattern("/foobar", "/foobar/waldo"));
+ assert_se(path_complex_pattern("/foobar/", "/foobar/waldo"));
+
+ assert_se(namespace_simple_pattern("", ""));
+ assert_se(namespace_simple_pattern("foobar", "foobar"));
+ assert_se(namespace_simple_pattern("foobar.waldo", "foobar.waldo"));
+ assert_se(namespace_simple_pattern("foobar", "foobar.waldo"));
+ assert_se(!namespace_simple_pattern("foobar.waldo", "foobar"));
+ assert_se(!namespace_simple_pattern("", "foo"));
+ assert_se(!namespace_simple_pattern("foo", ""));
+
return 0;
}