mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-21 01:01:43 +00:00
[ntcore] Cache GetEntry(name) values (#4531)
These are typically cached at higher levels anyway, but cache at lowest C++ layer as well for consistency with NT3.
This commit is contained in:
@@ -63,6 +63,14 @@ TEST_F(LocalStorageTest, GetEntryEmptyName) {
|
||||
EXPECT_EQ(storage.GetEntry(""), 0u);
|
||||
}
|
||||
|
||||
TEST_F(LocalStorageTest, GetEntryCached) {
|
||||
EXPECT_CALL(network, Subscribe(_, wpi::SpanEq({std::string{"tocache"}}),
|
||||
IsPubSubOptions({})));
|
||||
|
||||
auto entry1 = storage.GetEntry("tocache");
|
||||
EXPECT_EQ(entry1, storage.GetEntry("tocache"));
|
||||
}
|
||||
|
||||
TEST_F(LocalStorageTest, GetTopicName) {
|
||||
EXPECT_EQ(storage.GetTopicName(fooTopic), "foo");
|
||||
EXPECT_EQ(storage.GetTopicName(barTopic), "bar");
|
||||
|
||||
Reference in New Issue
Block a user