summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorPatrick Williams <patrick@stwcx.xyz>2016-10-18 07:47:29 -0500
committerPatrick Williams <patrick@stwcx.xyz>2016-10-20 16:35:51 -0500
commit9e3b51e34470c9d13649602e4a31bb61568f93ed (patch)
treea168fa42a6176bc932392c48f635b424d6597f94 /test
parent0966ce8c06feeab490f23024f18f120cd6225843 (diff)
downloadsdbusplus-9e3b51e34470c9d13649602e4a31bb61568f93ed.tar.gz
sdbusplus-9e3b51e34470c9d13649602e4a31bb61568f93ed.zip
message: write testcase to confirm bool and double
Change-Id: I631046f3e6d46c299f5907ad811656be3d66ea60 Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Diffstat (limited to 'test')
-rw-r--r--test/message/append.cpp25
-rw-r--r--test/message/read.cpp25
2 files changed, 50 insertions, 0 deletions
diff --git a/test/message/append.cpp b/test/message/append.cpp
index 4f85b74..84dcc28 100644
--- a/test/message/append.cpp
+++ b/test/message/append.cpp
@@ -142,6 +142,31 @@ void runTests()
b.call_noreply(m);
}
+ // Test double and bool.
+ {
+ auto m = newMethodCall__test(b);
+ bool t = true;
+ m.append(t, true, false, 1.1);
+ verifyTypeString = "bbbd";
+
+ struct verify
+ {
+ static void op(sd_bus_message* m)
+ {
+ bool t1, t2, f1;
+ double d;
+ sd_bus_message_read(m, "bbbd", &t1, &t2, &f1, &d);
+ assert(t1);
+ assert(t2);
+ assert(!f1);
+ assert(d == 1.1);
+ }
+ };
+ verifyCallback = &verify::op;
+
+ b.call_noreply(m);
+ }
+
// Test r-value string.
{
auto m = newMethodCall__test(b);
diff --git a/test/message/read.cpp b/test/message/read.cpp
index 496e6ca..6472907 100644
--- a/test/message/read.cpp
+++ b/test/message/read.cpp
@@ -144,6 +144,31 @@ void runTests()
b.call_noreply(m);
}
+ // Test double and bool.
+ {
+ auto m = newMethodCall__test(b);
+ bool t = true;
+ m.append(t, true, false, 1.1);
+ verifyTypeString = "bbbd";
+
+ struct verify
+ {
+ static void op(sdbusplus::message::message& m)
+ {
+ bool t1, t2, f1;
+ double d;
+ m.read(t1, t2, f1, d);
+ assert(t1);
+ assert(t2);
+ assert(!f1);
+ assert(d == 1.1);
+ }
+ };
+ verifyCallback = &verify::op;
+
+ b.call_noreply(m);
+ }
+
// Test r-value string.
{
auto m = newMethodCall__test(b);
OpenPOWER on IntegriCloud