xref: /aosp_15_r20/external/pigweed/pw_uart/uart_test.cc (revision 61c4878ac05f98d0ceed94b57d316916de578985)
1 // Copyright 2023 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/uart.h"
16 
17 #include "gtest/gtest.h"
18 #include "pw_status/status.h"
19 #include "pw_status/status_with_size.h"
20 
21 namespace pw::uart {
22 namespace {
23 
24 class UartStub : public Uart {
25  public:
UartStub()26   UartStub() {}
27   ~UartStub() override = default;
28 
29  private:
DoEnable(bool)30   Status DoEnable(bool) override { return OkStatus(); }
DoTryReadFor(ByteSpan,size_t,std::optional<chrono::SystemClock::duration>)31   StatusWithSize DoTryReadFor(
32       ByteSpan, size_t, std::optional<chrono::SystemClock::duration>) override {
33     return StatusWithSize(0);
34   }
DoTryWriteFor(ConstByteSpan,std::optional<chrono::SystemClock::duration>)35   StatusWithSize DoTryWriteFor(
36       ConstByteSpan, std::optional<chrono::SystemClock::duration>) override {
37     return StatusWithSize(0);
38   }
39 
DoSetBaudRate(uint32_t)40   Status DoSetBaudRate(uint32_t) override { return OkStatus(); }
DoSetFlowControl(bool)41   Status DoSetFlowControl(bool) override { return OkStatus(); }
DoConservativeReadAvailable()42   size_t DoConservativeReadAvailable() override { return 0; }
DoFlushOutput()43   Status DoFlushOutput() override { return OkStatus(); }
DoClearPendingReceiveBytes()44   Status DoClearPendingReceiveBytes() override { return OkStatus(); }
45 };
46 
47 class UartTest : public ::testing::Test {
48  public:
UartTest()49   UartTest() : stub_() {}
50 
51  private:
52   UartStub stub_;
53 };
54 
TEST_F(UartTest,CompilationSucceeds)55 TEST_F(UartTest, CompilationSucceeds) { EXPECT_TRUE(true); }
56 
57 }  // namespace
58 }  // namespace pw::uart
59