mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
[ntcore] Use int for options instead of double
Periodic time is stored in milliseconds.
This commit is contained in:
@@ -27,7 +27,7 @@ namespace nt {
|
||||
|
||||
::testing::Matcher<const PubSubOptions&> IsPubSubOptions(
|
||||
const PubSubOptions& good) {
|
||||
return AllOf(Field("periodic", &PubSubOptions::periodic, good.periodic),
|
||||
return AllOf(Field("periodic", &PubSubOptions::periodicMs, good.periodicMs),
|
||||
Field("pollStorageSize", &PubSubOptions::pollStorageSize,
|
||||
good.pollStorageSize),
|
||||
Field("logging", &PubSubOptions::sendAll, good.sendAll),
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace nt {
|
||||
bool PubSubOptionsMatcher::MatchAndExplain(
|
||||
const PubSubOptions& val, ::testing::MatchResultListener* listener) const {
|
||||
bool match = true;
|
||||
if (val.periodic != good.periodic) {
|
||||
if (val.periodicMs != good.periodicMs) {
|
||||
*listener << "periodic mismatch ";
|
||||
match = false;
|
||||
}
|
||||
|
||||
@@ -161,7 +161,7 @@ void PrintTo(const Value& value, std::ostream* os) {
|
||||
}
|
||||
|
||||
void PrintTo(const PubSubOptions& options, std::ostream* os) {
|
||||
*os << "PubSubOptions{periodic=" << options.periodic
|
||||
*os << "PubSubOptions{periodicMs=" << options.periodicMs
|
||||
<< ", pollStorageSize=" << options.pollStorageSize
|
||||
<< ", logging=" << options.sendAll
|
||||
<< ", keepDuplicates=" << options.keepDuplicates << '}';
|
||||
|
||||
@@ -86,7 +86,7 @@ TEST_F(WireEncoderTextTest, SubscribeSendAll) {
|
||||
|
||||
TEST_F(WireEncoderTextTest, SubscribePeriodic) {
|
||||
PubSubOptions options;
|
||||
options.periodic = 0.5;
|
||||
options.periodicMs = 500u;
|
||||
net::WireEncodeSubscribe(os, 5, std::span<const std::string_view>{{"a", "b"}},
|
||||
options);
|
||||
ASSERT_EQ(os.str(),
|
||||
@@ -98,7 +98,7 @@ TEST_F(WireEncoderTextTest, SubscribePeriodic) {
|
||||
TEST_F(WireEncoderTextTest, SubscribeAllOptions) {
|
||||
PubSubOptions options;
|
||||
options.sendAll = true;
|
||||
options.periodic = 0.5;
|
||||
options.periodicMs = 500u;
|
||||
net::WireEncodeSubscribe(os, 5, std::span<const std::string_view>{{"a", "b"}},
|
||||
options);
|
||||
ASSERT_EQ(os.str(),
|
||||
|
||||
Reference in New Issue
Block a user