F´ Flight Software - C/C++ Documentation NASA-v1.6.0
A framework for building embedded system applications to NASA flight quality standards.
Loading...
Searching...
No Matches
PortTest.hpp
Go to the documentation of this file.
1// ======================================================================
2// \title PortTest.hpp
3// \author T. Chieu
4// \brief hpp file for PortTest class
5//
6// \copyright
7// Copyright (C) 2009-2023 California Institute of Technology.
8// ALL RIGHTS RESERVED. United States Government Sponsorship
9// acknowledged.
10//
11// ======================================================================
12
13#ifndef FPP_TEST_PORT_TEST_HPP
14#define FPP_TEST_PORT_TEST_HPP
15
16#include "test/ut/Tester.hpp"
17#include "FppTest/component/active/TypedPortIndexEnumAc.hpp"
18
19#include "gtest/gtest.h"
20
21// Typed port tests (sync and guarded)
22template <typename PortType>
23class TypedPortTest : public ::testing::Test {
24protected:
27};
28
30
32 this->tester.testSyncPortInvoke(TypedPortIndex::TYPED, this->port);
33 this->tester.testSyncPortCheck(this->port);
34}
35
37 this->tester.testGuardedPortInvoke(TypedPortIndex::TYPED, this->port);
38 this->tester.testGuardedPortCheck(this->port);
39}
40
42 SyncPort,
43 GuardedPort
44);
45
46// Typed async port tests
47template <typename PortType>
48class TypedAsyncPortTest : public ::testing::Test {
49protected:
52};
53
55
57 this->tester.testAsyncPortInvoke(TypedPortIndex::TYPED, this->port);
58 this->tester.doDispatch();
59 this->tester.testAsyncPortCheck(this->port);
60}
61
63 AsyncPort
64);
65
66// Serial port tests (sync and guarded)
67template <typename PortType>
68class SerialPortTest : public ::testing::Test {
69protected:
72};
73
75
77 this->tester.testSyncPortInvoke(TypedPortIndex::SERIAL, this->port);
78 this->tester.testSyncPortCheckSerial(this->port);
79}
80
81TYPED_TEST_P(SerialPortTest, FromSerialSync) {
82 this->tester.testSyncPortInvokeSerial(TypedPortIndex::SERIAL, this->port);
83 this->tester.testSyncPortCheck(this->port);
84}
85
86TYPED_TEST_P(SerialPortTest, ToSerialGuarded) {
87 this->tester.testGuardedPortInvoke(TypedPortIndex::SERIAL, this->port);
88 this->tester.testGuardedPortCheckSerial(this->port);
89}
90
91TYPED_TEST_P(SerialPortTest, FromSerialGuarded) {
92 this->tester.testGuardedPortInvokeSerial(TypedPortIndex::SERIAL, this->port);
93 this->tester.testGuardedPortCheck(this->port);
94}
95
97 ToSerialSync,
98 FromSerialSync,
99 ToSerialGuarded,
100 FromSerialGuarded
101);
102
103// Serial async port tests
104template <typename PortType>
105class SerialAsyncPortTest : public ::testing::Test {
106protected:
109};
110
112
114 this->tester.testAsyncPortInvoke(TypedPortIndex::SERIAL, this->port);
115 this->tester.doDispatch();
116 this->tester.testAsyncPortCheckSerial(this->port);
117}
118
120 this->tester.testAsyncPortInvokeSerial(TypedPortIndex::SERIAL, this->port);
121 this->tester.testAsyncPortCheck(this->port);
122}
123
125 ToSerialAsync,
126 FromSerialAsync
127);
128
129#endif
REGISTER_TYPED_TEST_SUITE_P(TypedPortTest, SyncPort, GuardedPort)
TYPED_TEST_P(TypedPortTest, SyncPort)
Definition PortTest.hpp:31
TYPED_TEST_SUITE_P(TypedPortTest)
PortType port
Definition PortTest.hpp:71
Tester tester
Definition PortTest.hpp:25
PortType port
Definition PortTest.hpp:26