xref: /aosp_15_r20/external/pigweed/pw_system/async_packet_io_test.cc (revision 61c4878ac05f98d0ceed94b57d316916de578985)
1 // Copyright 2024 The Pigweed Authors
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); you may not
4 // use this file except in compliance with the License. You may obtain a copy of
5 // the License at
6 //
7 //     https://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11 // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12 // License for the specific language governing permissions and limitations under
13 // the License.
14 
15 #include "pw_system/internal/async_packet_io.h"
16 
17 #include <cstddef>
18 
19 #include "pw_allocator/testing.h"
20 #include "pw_channel/loopback_channel.h"
21 #include "pw_multibuf/simple_allocator_for_test.h"
22 #include "pw_rpc/server.h"
23 #include "pw_unit_test/framework.h"
24 
25 namespace {
26 
27 constexpr size_t kArbitrarySize = 2048;
28 
TEST(AsyncPacketIo,Instantiate)29 TEST(AsyncPacketIo, Instantiate) {
30   pw::multibuf::test::SimpleAllocatorForTest mb_alloc;
31   pw::channel::LoopbackByteChannel channel(mb_alloc);
32   pw::allocator::test::AllocatorForTest<kArbitrarySize> alloc;
33   std::byte buffer[256];
34   pw::rpc::Channel rpc_channel[1];
35   pw::rpc::Server rpc_server(rpc_channel);
36 
37   pw::system::internal::PacketIO packet_io(
38       channel.channel(), buffer, alloc, rpc_server);
39 }
40 
41 }  // namespace
42