mirror of
https://github.com/mikecarper/MeshCore.git
synced 2026-10-23 21:33:53 +00:00
Isolate channel admission test shim from contact frame fixture
This commit is contained in:
1 parent
978732f685
commit
3d53861813
2 files changed
+5
-4
No files matched your search
+3
-3
@@ -56,10 +56,10 @@ static void initializeContacts(ChannelFixture& f) {
|
||||
f.host.channels.push_back(defaults);
|
||||
}
|
||||
|
||||
class MyMesh {
|
||||
class ChannelAdmission {
|
||||
DataStore* _store;
|
||||
public:
|
||||
explicit MyMesh(DataStore& store) : _store(&store) {}
|
||||
explicit ChannelAdmission(DataStore& store) : _store(&store) {}
|
||||
bool canMutateContacts() const;
|
||||
};
|
||||
#include "channel_admission_under_test.h"
|
||||
@@ -99,7 +99,7 @@ static void channel_faults_do_not_poison_contacts() {
|
||||
#if defined(NRF52_PLATFORM)
|
||||
fail_channel_metadata = false;
|
||||
#endif
|
||||
MyMesh admission(f.store);
|
||||
ChannelAdmission admission(f.store);
|
||||
uint8_t path[64];
|
||||
if (fault == 8) {
|
||||
assert(f.store.hasIncompleteContactLoad() && !admission.canMutateContacts());
|
||||
|
||||
@@ -62,7 +62,8 @@ static void* allocateChannelSnapshot(size_t size) {
|
||||
implementation += method(store, "bool DataStore::formatFileSystem()") + "\n"
|
||||
(work / "store_under_test.h").write_text(implementation)
|
||||
(work / "channel_admission_under_test.h").write_text(
|
||||
method(mesh, "bool MyMesh::canMutateContacts() const"))
|
||||
method(mesh, "bool MyMesh::canMutateContacts() const").replace(
|
||||
"MyMesh::canMutateContacts", "ChannelAdmission::canMutateContacts", 1))
|
||||
|
||||
fixture = (ROOT / ("test/fixtures/contact_cache/test_contact_cache.cpp" if is_cached
|
||||
else "test/fixtures/companion_uncached_storage/test.cpp"))
|
||||
|
||||
Reference in new issue
Block a user