Add PlatformIO project setup, local libraries, and PCB Gerber files
- Add platformio.ini for ESP32 DevKit (Arduino framework, espressif32 6.10.0) - Vendor ArduinoJson, MPU6050_tockn, SCServo, Simple_FOC, and WebSockets so a fresh clone builds without downloading dependencies - Add .gitignore rules for PlatformIO/IDE build artifacts - Add controller PCB Gerber and drill files
This commit is contained in:
1 parent
19a012ec8e
commit
324d114386
690 files changed
+109617
No files matched your search
@@ -0,0 +1,51 @@
|
||||
// ArduinoJson - https://arduinojson.org
|
||||
// Copyright © 2014-2023, Benoit BLANCHON
|
||||
// MIT License
|
||||
|
||||
#include <ArduinoJson.h>
|
||||
#include <catch.hpp>
|
||||
|
||||
class CustomWriter {
|
||||
public:
|
||||
CustomWriter() {}
|
||||
CustomWriter(const CustomWriter&) = delete;
|
||||
CustomWriter& operator=(const CustomWriter&) = delete;
|
||||
|
||||
size_t write(uint8_t c) {
|
||||
_str.append(1, static_cast<char>(c));
|
||||
return 1;
|
||||
}
|
||||
|
||||
size_t write(const uint8_t* s, size_t n) {
|
||||
_str.append(reinterpret_cast<const char*>(s), n);
|
||||
return n;
|
||||
}
|
||||
|
||||
const std::string& str() const {
|
||||
return _str;
|
||||
}
|
||||
|
||||
private:
|
||||
std::string _str;
|
||||
};
|
||||
|
||||
TEST_CASE("CustomWriter") {
|
||||
DynamicJsonDocument doc(4096);
|
||||
JsonArray array = doc.to<JsonArray>();
|
||||
array.add(4);
|
||||
array.add(2);
|
||||
|
||||
SECTION("serializeJson()") {
|
||||
CustomWriter writer;
|
||||
serializeJson(array, writer);
|
||||
|
||||
REQUIRE("[4,2]" == writer.str());
|
||||
}
|
||||
|
||||
SECTION("serializeJsonPretty") {
|
||||
CustomWriter writer;
|
||||
serializeJsonPretty(array, writer);
|
||||
|
||||
REQUIRE("[\r\n 4,\r\n 2\r\n]" == writer.str());
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user