From 977ac8bce989285eaabc76c4ed8571ce5fd6793a Mon Sep 17 00:00:00 2001 From: Claudius 'keldu' Holeksa Date: Mon, 22 Jul 2024 17:44:27 +0200 Subject: wip --- modules/remote/tests/remote_loopback.cpp | 39 ++++++++++++++++++++++---------- 1 file changed, 27 insertions(+), 12 deletions(-) (limited to 'modules/remote/tests/remote_loopback.cpp') diff --git a/modules/remote/tests/remote_loopback.cpp b/modules/remote/tests/remote_loopback.cpp index e78f646..2430029 100644 --- a/modules/remote/tests/remote_loopback.cpp +++ b/modules/remote/tests/remote_loopback.cpp @@ -21,20 +21,17 @@ using GroupedSchemas = saw::tmpl_group< SAW_TEST("Remote Loopback Data"){ using namespace saw; + event_loop loop; + wait_scope wait{loop}; + remote rmt; - auto eov = rmt.parse_address(); + auto eov = rmt.parse_address(0u); SAW_EXPECT(eov.is_value(), "Didn't parse correctly"); auto& val = eov.get_value(); - interface iface{ - [](data& foo){ - return foo.template cast_to(); - } - }; - - auto srv = data_server{}; - auto client = data_client{srv}; + auto srv = data_server{val}; + auto client = data_client{val}; data foo{421}; id sent_id = [&](){ @@ -43,9 +40,6 @@ SAW_TEST("Remote Loopback Data"){ return eov.get_value(); }(); - event_loop loop; - wait_scope wait{loop}; - { auto conv = client.receive(sent_id); auto eov = conv.take(); @@ -82,5 +76,26 @@ SAW_TEST("Remote Loopback Data"){ SAW_EXPECT(f_val, "Nullptr in find."); f_val->set(5u); } + { + auto conv = client.receive(alloc_id); + auto eov = conv.take(); + SAW_EXPECT(eov.is_value(), "Failed receive."); + SAW_EXPECT(eov.get_value().get() == 5u, "Wrong received value."); + } + + data> arr_meta{{128u}}; + + id> arr_alloc_id = [&](){ + auto eov = client.allocate>(arr_meta); + SAW_EXPECT(eov.is_value(), "Failed send."); + return eov.get_value(); + }(); + { + auto eov = client.find(arr_alloc_id); + SAW_EXPECT(eov.is_value(), "Failed find."); + auto& f_val = eov.get_value(); + SAW_EXPECT(f_val, "Nullptr in find."); + SAW_EXPECT(f_val->size() == arr_meta.at(0).get(), "Wrong initialized size."); + } } } -- cgit v1.2.3