xref: /aosp_15_r20/external/pigweed/pw_uart/stream_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_uart/stream.h"
16 
17 #include "gtest/gtest.h"
18 
19 namespace pw::uart {
20 namespace {
21 
22 class UartStub : public Uart {
23  private:
DoEnable(bool)24   Status DoEnable(bool) override { return OkStatus(); }
DoTryReadFor(ByteSpan,size_t,std::optional<chrono::SystemClock::duration>)25   StatusWithSize DoTryReadFor(
26       ByteSpan, size_t, std::optional<chrono::SystemClock::duration>) override {
27     return StatusWithSize(0);
28   }
DoTryWriteFor(ConstByteSpan,std::optional<chrono::SystemClock::duration>)29   StatusWithSize DoTryWriteFor(
30       ConstByteSpan, std::optional<chrono::SystemClock::duration>) override {
31     return StatusWithSize(0);
32   }
33 
DoSetBaudRate(uint32_t)34   Status DoSetBaudRate(uint32_t) override { return OkStatus(); }
DoSetFlowControl(bool)35   Status DoSetFlowControl(bool) override { return OkStatus(); }
DoConservativeReadAvailable()36   size_t DoConservativeReadAvailable() override { return 0; }
DoFlushOutput()37   Status DoFlushOutput() override { return OkStatus(); }
DoClearPendingReceiveBytes()38   Status DoClearPendingReceiveBytes() override { return OkStatus(); }
39 };
40 
41 class UartStreamTest : public ::testing::Test {
42  public:
UartStreamTest()43   UartStreamTest() : stream_(uart_) {}
44 
45  private:
46   UartStub uart_;
47   UartStream stream_;
48 };
49 
TEST_F(UartStreamTest,CompilationSucceeds)50 TEST_F(UartStreamTest, CompilationSucceeds) { EXPECT_TRUE(true); }
51 
52 }  // namespace
53 }  // namespace pw::uart
54