feat: 全量同步 254 个常用的 Arduino 扩展库文件

This commit is contained in:
yczpf2019
2026-01-24 16:05:38 +08:00
parent c665ba662b
commit 397b9a23a3
6878 changed files with 2732224 additions and 1 deletions

View File

@@ -0,0 +1,43 @@
#define CATCH_CONFIG_MAIN
#include "catch2/catch.hpp"
#include <Arduino.h>
#include "catch_utils.hpp"
#include "painlessmesh/callback.hpp"
using namespace painlessmesh;
logger::LogClass Log;
SCENARIO("CallbackMap should hold multiple callbacks by ID") {
GIVEN("A callback map with added callbacks") {
auto cbl = callback::PackageCallbackList<int>();
auto i = 0;
auto j = 0;
cbl.onPackage(1, [&i](int z) { ++i; });
cbl.onPackage(1, [&j](int z) { ++j; });
WHEN("We call execute") {
auto cnt = cbl.execute(1, 0);
REQUIRE(cnt == 2);
THEN("The callbacks are called") {
REQUIRE(i == 1);
REQUIRE(j == 1);
}
}
WHEN("We call execute on another event") {
auto cnt = cbl.execute(2, 0);
REQUIRE(cnt == 0);
THEN("The callbacks are not called") {
REQUIRE(i == 0);
REQUIRE(j == 0);
}
}
}
}