mirror of
https://github.com/nasa/fpp.git
synced 2025-12-15 12:58:25 -06:00
Revise component unit test code gen
This commit is contained in:
parent
eb1484799b
commit
70d3e7ba2e
@ -153,8 +153,8 @@ case class ComponentHistory(
|
||||
guardedList (hasChannels) (lines("this->clearTlm();")),
|
||||
guardedList (hasDataProducts) (
|
||||
lines(
|
||||
"""|this->dpRequestHistory->clear();
|
||||
|this->dpSendHistory->clear();
|
||||
"""|this->productRequestHistory->clear();
|
||||
|this->productSendHistory->clear();
|
||||
|"""
|
||||
)
|
||||
),
|
||||
@ -306,7 +306,7 @@ case class ComponentHistory(
|
||||
)
|
||||
|
||||
private def getDpHistoryTypes: List[CppDoc.Class.Member] = {
|
||||
val dpRequest = guardedList(hasProductRequestPort) (
|
||||
val productRequest = guardedList(hasProductRequestPort) (
|
||||
Line.blank ::
|
||||
line("//! A type representing a data product request") ::
|
||||
wrapInScope(
|
||||
@ -319,7 +319,7 @@ case class ComponentHistory(
|
||||
"};"
|
||||
)
|
||||
)
|
||||
val dpSend =
|
||||
val productSend =
|
||||
Line.blank ::
|
||||
line("// A type representing a data product send") ::
|
||||
wrapInScope(
|
||||
@ -333,7 +333,7 @@ case class ComponentHistory(
|
||||
)
|
||||
List(
|
||||
linesClassMember(
|
||||
List.concat(dpRequest, dpSend),
|
||||
List.concat(productRequest, productSend),
|
||||
CppDoc.Lines.Hpp
|
||||
)
|
||||
)
|
||||
@ -347,12 +347,12 @@ case class ComponentHistory(
|
||||
guardedList (hasProductRequestPort) (
|
||||
lines(
|
||||
"""|//! The data product request history
|
||||
|History<DpRequest>* dpRequestHistory;"""
|
||||
|History<DpRequest>* productRequestHistory;"""
|
||||
)
|
||||
),
|
||||
lines(
|
||||
"""|//! The data product send history
|
||||
|History<DpSend>* dpSendHistory;
|
||||
|History<DpSend>* productSendHistory;
|
||||
|"""
|
||||
)
|
||||
),
|
||||
|
||||
@ -29,7 +29,8 @@ abstract class ComponentTestUtils(
|
||||
hasCommands ||
|
||||
hasParameters ||
|
||||
hasEvents ||
|
||||
hasCommands
|
||||
hasCommands ||
|
||||
hasDataProducts
|
||||
|
||||
val inputPorts: List[PortInstance] = List.concat(
|
||||
specialInputPorts,
|
||||
|
||||
@ -219,6 +219,16 @@ case class ComponentTesterBaseWriter(
|
||||
line(s"this->$historyName = new History<$entryName>(maxHistorySize);")
|
||||
})
|
||||
}
|
||||
lazy val productRequestHistory = lines(
|
||||
"""|// Initialize data product request history
|
||||
|this->productRequestHistory = new History<DpRequest>(maxHistorySize);
|
||||
|"""
|
||||
)
|
||||
lazy val productSendHistory = lines(
|
||||
"""|// Initialize data product send history
|
||||
|this->productSendHistory = new History<DpSend>(maxHistorySize);
|
||||
|"""
|
||||
)
|
||||
lazy val clearHistory = lines(
|
||||
"""|// Clear history
|
||||
|this->clearHistory();
|
||||
@ -230,6 +240,8 @@ case class ComponentTesterBaseWriter(
|
||||
guardedList (hasCommands) (commandHistory),
|
||||
guardedList (hasEvents) (eventHistories),
|
||||
guardedList (hasTelemetry) (tlmHistories),
|
||||
guardedList (hasProductRequestPort) (productRequestHistory),
|
||||
guardedList (hasDataProducts) (productSendHistory),
|
||||
guardedList (hasHistories) (clearHistory)
|
||||
)
|
||||
)
|
||||
@ -270,12 +282,24 @@ case class ComponentTesterBaseWriter(
|
||||
val historyName = tlmHistoryName(channel.getName)
|
||||
line(s"delete this->$historyName;")
|
||||
})
|
||||
lazy val destroyProductRequestHistory = lines(
|
||||
"""|// Destroy product request history
|
||||
|delete this->productRequestHistory;
|
||||
|"""
|
||||
)
|
||||
lazy val destroyProductSendHistory = lines(
|
||||
"""|// Destroy product send history
|
||||
|delete this->productSendHistory;
|
||||
|"""
|
||||
)
|
||||
intersperseBlankLines(
|
||||
List(
|
||||
guardedList (hasTypedOutputPorts) (destroyPortHistories),
|
||||
guardedList (hasCommands) (destroyCommandHistory),
|
||||
guardedList (hasEvents) (destroyEventHistories),
|
||||
guardedList (hasChannels) (destroyTlmHistories)
|
||||
guardedList (hasChannels) (destroyTlmHistories),
|
||||
guardedList (hasProductRequestPort) (destroyProductRequestHistory),
|
||||
guardedList (hasDataProducts) (destroyProductSendHistory)
|
||||
)
|
||||
)
|
||||
},
|
||||
|
||||
@ -1052,6 +1052,12 @@ namespace M {
|
||||
this->tlmHistory_ChannelU32OnChange = new History<TlmEntry_ChannelU32OnChange>(maxHistorySize);
|
||||
this->tlmHistory_ChannelEnumOnChange = new History<TlmEntry_ChannelEnumOnChange>(maxHistorySize);
|
||||
|
||||
// Initialize data product request history
|
||||
this->productRequestHistory = new History<DpRequest>(maxHistorySize);
|
||||
|
||||
// Initialize data product send history
|
||||
this->productSendHistory = new History<DpSend>(maxHistorySize);
|
||||
|
||||
// Clear history
|
||||
this->clearHistory();
|
||||
}
|
||||
@ -1088,6 +1094,12 @@ namespace M {
|
||||
delete this->tlmHistory_ChannelF64;
|
||||
delete this->tlmHistory_ChannelU32OnChange;
|
||||
delete this->tlmHistory_ChannelEnumOnChange;
|
||||
|
||||
// Destroy product request history
|
||||
delete this->productRequestHistory;
|
||||
|
||||
// Destroy product send history
|
||||
delete this->productSendHistory;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
@ -3459,8 +3471,8 @@ namespace M {
|
||||
#endif
|
||||
this->clearEvents();
|
||||
this->clearTlm();
|
||||
this->dpRequestHistory->clear();
|
||||
this->dpSendHistory->clear();
|
||||
this->productRequestHistory->clear();
|
||||
this->productSendHistory->clear();
|
||||
}
|
||||
|
||||
void ActiveTestTesterBase ::
|
||||
|
||||
@ -1577,9 +1577,9 @@ namespace M {
|
||||
History<TlmEntry_ChannelEnumOnChange>* tlmHistory_ChannelEnumOnChange;
|
||||
|
||||
//! The data product request history
|
||||
History<DpRequest>* dpRequestHistory;
|
||||
History<DpRequest>* productRequestHistory;
|
||||
//! The data product send history
|
||||
History<DpSend>* dpSendHistory;
|
||||
History<DpSend>* productSendHistory;
|
||||
|
||||
private:
|
||||
|
||||
|
||||
@ -875,6 +875,12 @@ PassiveTestTesterBase ::
|
||||
this->tlmHistory_ChannelU32OnChange = new History<TlmEntry_ChannelU32OnChange>(maxHistorySize);
|
||||
this->tlmHistory_ChannelEnumOnChange = new History<TlmEntry_ChannelEnumOnChange>(maxHistorySize);
|
||||
|
||||
// Initialize data product request history
|
||||
this->productRequestHistory = new History<DpRequest>(maxHistorySize);
|
||||
|
||||
// Initialize data product send history
|
||||
this->productSendHistory = new History<DpSend>(maxHistorySize);
|
||||
|
||||
// Clear history
|
||||
this->clearHistory();
|
||||
}
|
||||
@ -911,6 +917,12 @@ PassiveTestTesterBase ::
|
||||
delete this->tlmHistory_ChannelF64;
|
||||
delete this->tlmHistory_ChannelU32OnChange;
|
||||
delete this->tlmHistory_ChannelEnumOnChange;
|
||||
|
||||
// Destroy product request history
|
||||
delete this->productRequestHistory;
|
||||
|
||||
// Destroy product send history
|
||||
delete this->productSendHistory;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
@ -2931,8 +2943,8 @@ void PassiveTestTesterBase ::
|
||||
#endif
|
||||
this->clearEvents();
|
||||
this->clearTlm();
|
||||
this->dpRequestHistory->clear();
|
||||
this->dpSendHistory->clear();
|
||||
this->productRequestHistory->clear();
|
||||
this->productSendHistory->clear();
|
||||
}
|
||||
|
||||
void PassiveTestTesterBase ::
|
||||
|
||||
@ -1400,9 +1400,9 @@ class PassiveTestTesterBase :
|
||||
History<TlmEntry_ChannelEnumOnChange>* tlmHistory_ChannelEnumOnChange;
|
||||
|
||||
//! The data product request history
|
||||
History<DpRequest>* dpRequestHistory;
|
||||
History<DpRequest>* productRequestHistory;
|
||||
//! The data product send history
|
||||
History<DpSend>* dpSendHistory;
|
||||
History<DpSend>* productSendHistory;
|
||||
|
||||
private:
|
||||
|
||||
|
||||
@ -1050,6 +1050,12 @@ QueuedTestTesterBase ::
|
||||
this->tlmHistory_ChannelU32OnChange = new History<TlmEntry_ChannelU32OnChange>(maxHistorySize);
|
||||
this->tlmHistory_ChannelEnumOnChange = new History<TlmEntry_ChannelEnumOnChange>(maxHistorySize);
|
||||
|
||||
// Initialize data product request history
|
||||
this->productRequestHistory = new History<DpRequest>(maxHistorySize);
|
||||
|
||||
// Initialize data product send history
|
||||
this->productSendHistory = new History<DpSend>(maxHistorySize);
|
||||
|
||||
// Clear history
|
||||
this->clearHistory();
|
||||
}
|
||||
@ -1086,6 +1092,12 @@ QueuedTestTesterBase ::
|
||||
delete this->tlmHistory_ChannelF64;
|
||||
delete this->tlmHistory_ChannelU32OnChange;
|
||||
delete this->tlmHistory_ChannelEnumOnChange;
|
||||
|
||||
// Destroy product request history
|
||||
delete this->productRequestHistory;
|
||||
|
||||
// Destroy product send history
|
||||
delete this->productSendHistory;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
@ -3457,8 +3469,8 @@ void QueuedTestTesterBase ::
|
||||
#endif
|
||||
this->clearEvents();
|
||||
this->clearTlm();
|
||||
this->dpRequestHistory->clear();
|
||||
this->dpSendHistory->clear();
|
||||
this->productRequestHistory->clear();
|
||||
this->productSendHistory->clear();
|
||||
}
|
||||
|
||||
void QueuedTestTesterBase ::
|
||||
|
||||
@ -1575,9 +1575,9 @@ class QueuedTestTesterBase :
|
||||
History<TlmEntry_ChannelEnumOnChange>* tlmHistory_ChannelEnumOnChange;
|
||||
|
||||
//! The data product request history
|
||||
History<DpRequest>* dpRequestHistory;
|
||||
History<DpRequest>* productRequestHistory;
|
||||
//! The data product send history
|
||||
History<DpSend>* dpSendHistory;
|
||||
History<DpSend>* productSendHistory;
|
||||
|
||||
private:
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user