diff options
author | Ryan Ofsky <ryan@ofsky.org> | 2023-11-20 15:49:55 -0500 |
---|---|---|
committer | Ryan Ofsky <ryan@ofsky.org> | 2023-11-28 12:35:50 -0500 |
commit | 6acec6b9ff02b91de132bb1575d75908a8a2d27b (patch) | |
tree | 386e62fb027e0d3ca0d4d2e491e82f8916594825 /src/test | |
parent | 0cc74fce72e0c79849109ee5d7afe707991b3512 (diff) |
multiprocess: Add type conversion code for UniValue types
Extend IPC unit test to cover this and verify the serialization happens
correctly.
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/ipc_test.capnp | 1 | ||||
-rw-r--r-- | src/test/ipc_test.cpp | 6 | ||||
-rw-r--r-- | src/test/ipc_test.h | 2 |
3 files changed, 9 insertions, 0 deletions
diff --git a/src/test/ipc_test.capnp b/src/test/ipc_test.capnp index 7b970e2aff..55a3dc2683 100644 --- a/src/test/ipc_test.capnp +++ b/src/test/ipc_test.capnp @@ -14,4 +14,5 @@ $Proxy.includeTypes("ipc/capnp/common-types.h"); interface FooInterface $Proxy.wrap("FooImplementation") { add @0 (a :Int32, b :Int32) -> (result :Int32); passOutPoint @1 (arg :Data) -> (result :Data); + passUniValue @2 (arg :Text) -> (result :Text); } diff --git a/src/test/ipc_test.cpp b/src/test/ipc_test.cpp index f835859705..ce4edaceb0 100644 --- a/src/test/ipc_test.cpp +++ b/src/test/ipc_test.cpp @@ -55,6 +55,12 @@ void IpcTest() COutPoint txout2{foo->passOutPoint(txout1)}; BOOST_CHECK(txout1 == txout2); + UniValue uni1{UniValue::VOBJ}; + uni1.pushKV("i", 1); + uni1.pushKV("s", "two"); + UniValue uni2{foo->passUniValue(uni1)}; + BOOST_CHECK_EQUAL(uni1.write(), uni2.write()); + // Test cleanup: disconnect pipe and join thread disconnect_client(); thread.join(); diff --git a/src/test/ipc_test.h b/src/test/ipc_test.h index f100ae8c5d..bcfcc2125c 100644 --- a/src/test/ipc_test.h +++ b/src/test/ipc_test.h @@ -6,12 +6,14 @@ #define BITCOIN_TEST_IPC_TEST_H #include <primitives/transaction.h> +#include <univalue.h> class FooImplementation { public: int add(int a, int b) { return a + b; } COutPoint passOutPoint(COutPoint o) { return o; } + UniValue passUniValue(UniValue v) { return v; } }; void IpcTest(); |