Avoid repeated channel alias parsing in constrained companions
This commit is contained in:
1 parent
eb7c307583
commit
3385f2acaa
5 files changed
+25
-9
No files matched your search
@@ -94,6 +94,16 @@ static void grammar() {
|
||||
assert(!companionChannelRadio2Preset(name));
|
||||
}
|
||||
assert(!companionChannelRadio2Preset(nullptr));
|
||||
for (const char* prefix : {"", "#", "r2-", "#r2-", "mt-", "#mt-", "r2-r2-", "#r2-mt-"}) {
|
||||
for (const char* tail : {"", "r", "r2", "#", "mediamesh", "mediamesh-range",
|
||||
"MediaMesh", "mediamesh-extra", "mediamesh,32"}) {
|
||||
char name[64]; snprintf(name, sizeof(name), "%s%s", prefix, tail);
|
||||
const auto alias = parseCompanionChannelAlias(name);
|
||||
const char* expected = alias.kind == CompanionChannelKind::Radio2
|
||||
&& mesh::cli::radio2PresetTuple(alias.tail) ? alias.tail : nullptr;
|
||||
assert(companionChannelRadio2Preset(name) == expected);
|
||||
}
|
||||
}
|
||||
puts("PASS grammar");
|
||||
}
|
||||
static void canonical() {
|
||||
|
||||
@@ -127,7 +127,8 @@ class Nrf52FlashTrimTest(unittest.TestCase):
|
||||
companion = Node(ROOT / "examples/companion_radio/MyMesh.cpp")
|
||||
result, flags = TRIM.compile_shared_companion_replies(env, companion)
|
||||
self.assertIs(result, companion)
|
||||
self.assertEqual(flags["CCFLAGS"], ["-Os", "-flto", "-fno-builtin-strcpy"])
|
||||
self.assertEqual(flags["CCFLAGS"], ["-Os", "-flto", "-fno-builtin-strcpy",
|
||||
"-fno-builtin-strncpy"])
|
||||
self.assertEqual(env["CCFLAGS"], ["-Os", "-flto"])
|
||||
for path in ("examples/simple_repeater/MyMesh.cpp", "test/fixtures/MyMesh.cpp",
|
||||
"src/helpers/CommonCLI.cpp", "src/helpers/RadioProfileCLI.cpp"):
|
||||
|
||||
Reference in new issue
Block a user