From 818782382a94b8576f07329c6ee0494a5add6e06 Mon Sep 17 00:00:00 2001 From: Chad Attermann Date: Wed, 21 Jan 2026 12:38:13 -0700 Subject: [PATCH] Enhance Bytes, fix for Lins, test/example updates - Added convenience methods to Bytes class - Fix for logic error in Link class compliments of @cobraPA - Added unit tests - Updated example apps --- .../link/.vscode => .vscode}/extensions.json | 0 .vscode/settings.json | 91 ++++++++++++++++++ .../common/lora_interface/LoRaInterface.cpp | 5 +- examples/{link => link_native}/.gitignore | 0 examples/link_native/.vscode/extensions.json | 10 ++ .../.vscode/settings.json | 0 examples/{link => link_native}/main.cpp | 1 - examples/{link => link_native}/platformio.ini | 60 +++--------- examples/lora_announce/main.cpp | 4 +- examples/lora_announce/platformio.ini | 93 +++++++------------ examples/udp_announce/main.cpp | 4 +- examples/udp_announce/platformio.ini | 60 ++++-------- platformio.ini | 3 +- src/Bytes.h | 25 +++++ src/Link.cpp | 2 +- src/main.cpp | 3 + test/test_msgpack/test_main.cpp | 57 ++++++++++++ test/test_persistence/test_main.cpp | 3 +- test/test_rns_loopback/test_main.cpp | 10 +- 19 files changed, 275 insertions(+), 156 deletions(-) rename {examples/link/.vscode => .vscode}/extensions.json (100%) create mode 100644 .vscode/settings.json rename examples/{link => link_native}/.gitignore (100%) create mode 100644 examples/link_native/.vscode/extensions.json rename examples/{link => link_native}/.vscode/settings.json (100%) rename examples/{link => link_native}/main.cpp (99%) rename examples/{link => link_native}/platformio.ini (62%) diff --git a/examples/link/.vscode/extensions.json b/.vscode/extensions.json similarity index 100% rename from examples/link/.vscode/extensions.json rename to .vscode/extensions.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..e52a324 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,91 @@ +{ + "cmake.configureOnOpen": false, + "files.associations": { + "system_error": "cpp", + "array": "cpp", + "atomic": "cpp", + "*.tcc": "cpp", + "cctype": "cpp", + "clocale": "cpp", + "cmath": "cpp", + "cstdarg": "cpp", + "cstddef": "cpp", + "cstdint": "cpp", + "cstdio": "cpp", + "cstdlib": "cpp", + "cstring": "cpp", + "ctime": "cpp", + "cwchar": "cpp", + "cwctype": "cpp", + "deque": "cpp", + "unordered_map": "cpp", + "unordered_set": "cpp", + "vector": "cpp", + "exception": "cpp", + "algorithm": "cpp", + "functional": "cpp", + "iterator": "cpp", + "map": "cpp", + "memory": "cpp", + "memory_resource": "cpp", + "numeric": "cpp", + "optional": "cpp", + "random": "cpp", + "string": "cpp", + "string_view": "cpp", + "tuple": "cpp", + "type_traits": "cpp", + "utility": "cpp", + "fstream": "cpp", + "initializer_list": "cpp", + "iomanip": "cpp", + "iosfwd": "cpp", + "istream": "cpp", + "limits": "cpp", + "new": "cpp", + "ostream": "cpp", + "sstream": "cpp", + "stdexcept": "cpp", + "streambuf": "cpp", + "cinttypes": "cpp", + "typeinfo": "cpp", + "set": "cpp", + "__functional_base": "cpp", + "__bit_reference": "cpp", + "__config": "cpp", + "__debug": "cpp", + "__errc": "cpp", + "__hash_table": "cpp", + "__locale": "cpp", + "__mutex_base": "cpp", + "__node_handle": "cpp", + "__nullptr": "cpp", + "__split_buffer": "cpp", + "__string": "cpp", + "__threading_support": "cpp", + "__tree": "cpp", + "__tuple": "cpp", + "bit": "cpp", + "bitset": "cpp", + "chrono": "cpp", + "complex": "cpp", + "ios": "cpp", + "iostream": "cpp", + "list": "cpp", + "locale": "cpp", + "mutex": "cpp", + "ratio": "cpp", + "*.ipp": "cpp", + "cfenv": "cpp", + "strstream": "cpp", + "typeindex": "cpp", + "variant": "cpp", + "__verbose_abort": "cpp", + "charconv": "cpp", + "shared_mutex": "cpp", + "source_location": "cpp", + "execution": "cpp", + "forward_list": "cpp", + "queue": "cpp" + } +} \ No newline at end of file diff --git a/examples/common/lora_interface/LoRaInterface.cpp b/examples/common/lora_interface/LoRaInterface.cpp index 5ec8b5d..79a0a28 100644 --- a/examples/common/lora_interface/LoRaInterface.cpp +++ b/examples/common/lora_interface/LoRaInterface.cpp @@ -40,7 +40,8 @@ bool LoRaInterface::start() { INFO("LoRa initializing..."); #ifdef ARDUINO - SPI.begin(RADIO_SCLK_PIN, RADIO_MISO_PIN, RADIO_MOSI_PIN); + //SPI.begin(RADIO_SCLK_PIN, RADIO_MISO_PIN, RADIO_MOSI_PIN); + SPI.begin(); delay(1500); LoRa.setPins(RADIO_CS_PIN, RADIO_RST_PIN, RADIO_DIO0_PIN); @@ -58,7 +59,7 @@ bool LoRaInterface::start() { LoRa.setTxPower(power); INFO("LoRa init succeeded."); - TRACE("LoRa bandwidth is " + std::to_string(Utilities::OS::round(bitrate()/1000.0, 2)) + " Kbps"); + TRACE("LoRa bandwidth is " + std::to_string(Utilities::OS::round(_bitrate/1000.0, 2)) + " Kbps"); #endif _online = true; diff --git a/examples/link/.gitignore b/examples/link_native/.gitignore similarity index 100% rename from examples/link/.gitignore rename to examples/link_native/.gitignore diff --git a/examples/link_native/.vscode/extensions.json b/examples/link_native/.vscode/extensions.json new file mode 100644 index 0000000..080e70d --- /dev/null +++ b/examples/link_native/.vscode/extensions.json @@ -0,0 +1,10 @@ +{ + // See http://go.microsoft.com/fwlink/?LinkId=827846 + // for the documentation about the extensions.json format + "recommendations": [ + "platformio.platformio-ide" + ], + "unwantedRecommendations": [ + "ms-vscode.cpptools-extension-pack" + ] +} diff --git a/examples/link/.vscode/settings.json b/examples/link_native/.vscode/settings.json similarity index 100% rename from examples/link/.vscode/settings.json rename to examples/link_native/.vscode/settings.json diff --git a/examples/link/main.cpp b/examples/link_native/main.cpp similarity index 99% rename from examples/link/main.cpp rename to examples/link_native/main.cpp index 76abcd0..e62304b 100644 --- a/examples/link/main.cpp +++ b/examples/link_native/main.cpp @@ -22,7 +22,6 @@ #ifdef ARDUINO #include -#include #else #include #include diff --git a/examples/link/platformio.ini b/examples/link_native/platformio.ini similarity index 62% rename from examples/link/platformio.ini rename to examples/link_native/platformio.ini index c956b6b..bd4cfc8 100644 --- a/examples/link/platformio.ini +++ b/examples/link_native/platformio.ini @@ -72,58 +72,22 @@ lib_deps = lib_extra_dirs = ../ lib_compat_mode = off -[env:ttgo-lora32-v21] -framework = arduino -platform = espressif32 -board = ttgo-lora32-v21 -upload_speed = 460800 -board_build.partitions = no_ota.csv -build_flags = +[env:native20] +platform = native +build_unflags = -std=gnu++11 +build_flags = ${env.build_flags} + -std=c++20 + -g3 + -ggdb -Wall -Wextra -Wno-missing-field-initializers -Wno-format + -Wno-unused-parameter -I. - -DBOARD_ESP32 -lib_deps = - ${env.lib_deps} -monitor_filters = esp32_exception_decoder - -[env:ttgo-t-beam] -framework = arduino -platform = espressif32 -board = ttgo-t-beam -board_build.partitions = no_ota.csv -;board_build.partitions = huge_app.csv -build_flags = - ${env.build_flags} - -Wall - -Wextra - -Wno-missing-field-initializers - -Wno-format - -I. - -DBOARD_ESP32 -lib_deps = - ${env.lib_deps} -monitor_filters = esp32_exception_decoder - -[env:wiscore_rak4631] -framework = arduino -platform = nordicnrf52 -board = wiscore_rak4631 -board_build.partitions = no_ota.csv -board_build.FileSystem = littlefs -build_flags = - ${env.build_flags} - -fexceptions - -Wall - ;-Wextra - -Wno-missing-field-initializers - -Wno-format - -I. - -DBOARD_NRF52 - -DRNS_USE_TLSF=1 -build_unflags = -fno-exceptions -lib_deps = + -DNATIVE +lib_deps = ${env.lib_deps} +lib_extra_dirs = ../ +lib_compat_mode = off diff --git a/examples/lora_announce/main.cpp b/examples/lora_announce/main.cpp index baae90b..98fcc21 100644 --- a/examples/lora_announce/main.cpp +++ b/examples/lora_announce/main.cpp @@ -16,7 +16,7 @@ #ifdef ARDUINO #include -#include +//#include #else #include #include @@ -265,6 +265,7 @@ void setup() { pinMode(BUTTON_PIN, INPUT); attachInterrupt(BUTTON_PIN, userKey, FALLING); +/* // Setup filesystem if (!SPIFFS.begin(true, "")){ ERROR("SPIFFS filesystem mount failed"); @@ -272,6 +273,7 @@ void setup() { else { DEBUG("SPIFFS filesystem is ready"); } +*/ #endif RNS::loglevel(RNS::LOG_TRACE); diff --git a/examples/lora_announce/platformio.ini b/examples/lora_announce/platformio.ini index 11f1f7e..535f240 100644 --- a/examples/lora_announce/platformio.ini +++ b/examples/lora_announce/platformio.ini @@ -9,7 +9,6 @@ ; https://docs.platformio.org/page/projectconf.html [platformio] -default_envs = native include_dir = . src_dir = . @@ -18,63 +17,24 @@ monitor_speed = 115200 upload_speed = 921600 build_type = debug build_flags = + -Wall + -Wno-missing-field-initializers + -Wno-format + -I. ;-DMEM_LOG=1 -DRNS_USE_ALLOCATOR=1 - -DRNS_USE_ALLOCATOR=1 -DRNS_USE_TLSF=1 ;-DTEST_OBJECT_DATA=1 -DTEST_OBJECT_IMPL=1 lib_deps = ArduinoJson@^6.21.3 + sandeepmistry/LoRa @ ^0.8.0 https://github.com/attermann/Crypto.git https://github.com/hideakitai/MsgPack.git microReticulum=symlink://../.. universal_filesystem=symlink://../common/universal_filesystem lora_interface=symlink://../common/lora_interface -[env:native] -platform = native -monitor_port = none -build_flags = - ${env.build_flags} - -std=c++11 - -g3 - -ggdb - -Wall - -Wextra - -Wno-missing-field-initializers - -Wno-format - -Wno-unused-parameter - -I. - -DNATIVE -lib_deps = - ${env.lib_deps} -lib_extra_dirs = ../ -lib_compat_mode = off -;debug_init_break = -;debug_init_break = tbreak -;debug_tool = - -[env:native17] -platform = native -build_unflags = -std=gnu++11 -build_flags = - ${env.build_flags} - -std=c++17 - -g3 - -ggdb - -Wall - -Wextra - -Wno-missing-field-initializers - -Wno-format - -Wno-unused-parameter - -I. - -DNATIVE -lib_deps = - ${env.lib_deps} -lib_extra_dirs = ../ -lib_compat_mode = off - [env:ttgo-lora32-v21] framework = arduino platform = espressif32 @@ -83,11 +43,7 @@ upload_speed = 460800 board_build.partitions = no_ota.csv build_flags = ${env.build_flags} - -Wall -Wextra - -Wno-missing-field-initializers - -Wno-format - -I. -DBOARD_ESP32 lib_deps = ${env.lib_deps} @@ -101,11 +57,7 @@ board_build.partitions = no_ota.csv ;board_build.partitions = huge_app.csv build_flags = ${env.build_flags} - -Wall -Wextra - -Wno-missing-field-initializers - -Wno-format - -I. -DBOARD_ESP32 lib_deps = ${env.lib_deps} @@ -119,14 +71,39 @@ board_build.partitions = no_ota.csv board_build.FileSystem = littlefs build_flags = ${env.build_flags} - -fexceptions - -Wall ;-Wextra - -Wno-missing-field-initializers - -Wno-format - -I. + -fexceptions -DBOARD_NRF52 -DRNS_USE_TLSF=1 build_unflags = -fno-exceptions +lib_deps = + ${env.lib_deps} + adafruit/Adafruit TinyUSB Library + +[env:nrf52840_dk_adafruit] +framework = arduino +platform = nordicnrf52 +board = nrf52840_dk_adafruit +monitor_speed = 115200 +build_flags = + ${env.build_flags} + ;-Wextra + -fexceptions + -DBOARD_NRF52 + -DRNS_USE_TLSF=1 +lib_deps = + ${env.lib_deps} + +[env:nrf52_dk] +framework = arduino +;framework = zephyr +platform = nordicnrf52 +board = nrf52_dk +build_flags = + ${env.build_flags} + ;-Wextra + -fexceptions + -DBOARD_NRF52 + -DRNS_USE_TLSF=1 lib_deps = ${env.lib_deps} diff --git a/examples/udp_announce/main.cpp b/examples/udp_announce/main.cpp index 58832da..76feaeb 100644 --- a/examples/udp_announce/main.cpp +++ b/examples/udp_announce/main.cpp @@ -16,7 +16,7 @@ #ifdef ARDUINO #include -#include +//#include #else #include #include @@ -258,6 +258,7 @@ void setup() { pinMode(BUTTON_PIN, INPUT); attachInterrupt(BUTTON_PIN, userKey, FALLING); +/* // Setup filesystem if (!SPIFFS.begin(true, "")){ ERROR("SPIFFS filesystem mount failed"); @@ -265,6 +266,7 @@ void setup() { else { DEBUG("SPIFFS filesystem is ready"); } +*/ #endif #if defined(MEM_LOG) diff --git a/examples/udp_announce/platformio.ini b/examples/udp_announce/platformio.ini index 3d019e9..c6a7b91 100644 --- a/examples/udp_announce/platformio.ini +++ b/examples/udp_announce/platformio.ini @@ -72,6 +72,26 @@ lib_deps = lib_extra_dirs = ../ lib_compat_mode = off +[env:native20] +platform = native +build_unflags = -std=gnu++11 +build_flags = + ${env.build_flags} + -std=c++20 + -g3 + -ggdb + -Wall + -Wextra + -Wno-missing-field-initializers + -Wno-format + -Wno-unused-parameter + -I. + -DNATIVE +lib_deps = + ${env.lib_deps} +lib_extra_dirs = ../ +lib_compat_mode = off + [env:ttgo-lora32-v21] framework = arduino platform = espressif32 @@ -108,46 +128,6 @@ lib_deps = ${env.lib_deps} monitor_filters = esp32_exception_decoder -[env:wiscore_rak4631] -framework = arduino -platform = nordicnrf52 -board = wiscore_rak4631 -board_build.partitions = no_ota.csv -board_build.FileSystem = littlefs -build_flags = - ${env.build_flags} - -fexceptions - -Wall - ;-Wextra - -Wno-missing-field-initializers - -Wno-format - -I. - -DBOARD_NRF52 - -DRNS_USE_TLSF=1 -build_unflags = -fno-exceptions -lib_deps = - ${env.lib_deps} - -[env:nrf52840_dk_adafruit] -framework = arduino -platform = nordicnrf52 -board = nrf52840_dk_adafruit -monitor_speed = 115200 -build_flags = - ${env.build_flags} -lib_deps = - ${env.lib_deps} - -[env:nrf52_dk] -framework = arduino -;framework = zephyr -platform = nordicnrf52 -board = nrf52_dk -build_flags = - ${env.build_flags} -lib_deps = - ${env.lib_deps} - [env:luckfox] ;platform = linux_arm ;board = raspberrypi_2b diff --git a/platformio.ini b/platformio.ini index 8d4252f..fbd8a11 100644 --- a/platformio.ini +++ b/platformio.ini @@ -13,7 +13,6 @@ default_envs = native [env] build_flags = - -std=c++11 -Wall ;-Wextra -Wno-missing-field-initializers @@ -36,6 +35,7 @@ test_build_src = true platform = native build_flags = ${env.build_flags} + -std=c++11 -DNATIVE lib_deps = ${env.lib_deps} @@ -102,6 +102,7 @@ build_flags = -DMSGPACK_USE_BOOST=OFF lib_deps = ${env.lib_deps} + adafruit/Adafruit TinyUSB Library ; Overrides for specific tests (not working!) [test_env:test_objects] diff --git a/src/Bytes.h b/src/Bytes.h index a9e154e..120e1e3 100644 --- a/src/Bytes.h +++ b/src/Bytes.h @@ -78,6 +78,10 @@ MEM("Creating from data-move..."); assign(chunk, size); MEMF("Bytes object created from chunk \"%s\", this: %lu, data: %lu", toString().c_str(), this, _data.get()); } + Bytes(const void* chunk, size_t size) { + assign(chunk, size); + MEMF("Bytes object created from chunk \"%s\", this: %lu, data: %lu", toString().c_str(), this, _data.get()); + } Bytes(const char* string) { assign(string); MEMF("Bytes object created from string \"%s\", this: %lu, data: %lu", toString().c_str(), this, _data.get()); @@ -161,6 +165,19 @@ MEM("Creating from data-move..."); return Data(); return *_data.get(); } + // CBA NOTE: Following cast operators can cause issues with ambiguity from other libraries +/* + inline operator const uint8_t*() const { + if (!_data) + return nullptr; + return _data->data(); + } + inline operator const void*() const { + if (!_data) + return nullptr; + return _data->data(); + } +*/ private: inline SharedData shareData() const { @@ -226,6 +243,9 @@ MEM("Creating from data-move..."); //_data->insert(_data->begin(), chunk, chunk + chunk_size); _data->assign(chunk, chunk + chunk_size); } + inline void assign(const void* chunk, size_t chunk_size) { + assign((uint8_t*)chunk, chunk_size); + } inline void assign(const char* string) { // if assignment is empty then clear data and don't bother creating new if (string == nullptr || string[0] == 0) { @@ -267,6 +287,9 @@ MEM("Creating from data-move..."); exclusiveData(true, size() + chunk_size); _data->insert(_data->end(), chunk, chunk + chunk_size); } + inline void append(const void* chunk, size_t chunk_size) { + append((uint8_t*)chunk, chunk_size); + } inline void append(const char* string) { // if append is empty then do nothing if (string == nullptr || string[0] == 0) { @@ -410,9 +433,11 @@ inline RNS::Bytes& operator << (RNS::Bytes& lhbytes, const char* rhstr) { } namespace ArduinoJson { + // Serialize inline bool convertToJson(const RNS::Bytes& src, JsonVariant dst) { return dst.set(src.toHex()); } + // Deserialize inline void convertFromJson(JsonVariantConst src, RNS::Bytes& dst) { dst.assignHex(src.as()); } diff --git a/src/Link.cpp b/src/Link.cpp index 1c436df..31a7ed3 100644 --- a/src/Link.cpp +++ b/src/Link.cpp @@ -1034,7 +1034,7 @@ void Link::receive(const Packet& packet) { { const Bytes plaintext = decrypt(packet.data()); if (plaintext) { - if (_object->_initiator && plaintext.size() == Type::Identity::KEYSIZE/8 + Type::Identity::SIGLENGTH/8) { + if (!(_object->_initiator) && plaintext.size() == Type::Identity::KEYSIZE/8 + Type::Identity::SIGLENGTH/8) { const Bytes public_key = plaintext.left(Type::Identity::KEYSIZE/8); const Bytes signed_data = _object->_link_id + public_key; const Bytes signature = plaintext.mid(Type::Identity::KEYSIZE/8, Type::Identity::SIGLENGTH/8); diff --git a/src/main.cpp b/src/main.cpp index f55c542..04cb6c6 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3,8 +3,11 @@ #include #ifdef ARDUINO +#include void setup() { + Serial.begin(115200); + Serial.print("\nSilly rabbit, microReticulum is a library!\n\nSee the examples directory for example programs that make use of this library.\n\n"); } void loop() { } diff --git a/test/test_msgpack/test_main.cpp b/test/test_msgpack/test_main.cpp index 47984fe..4546220 100644 --- a/test/test_msgpack/test_main.cpp +++ b/test/test_msgpack/test_main.cpp @@ -3,6 +3,9 @@ #define MSGPACK_DEBUGLOG_ENABLE 0 #define DEBUGLOG_DEFAULT_LOG_LEVEL_TRACE #include + +#include + #include "Bytes.h" #include @@ -176,6 +179,7 @@ void test_pack_bytes_array_python() { const RNS::Bytes one("first\xab"); const RNS::Bytes two("second\xcd"); MsgPack::Packer packer; + // CBA NOTE: MsgPack appears to use Bytes cast operator to std::vector for serializing Bytes as binary packer.to_array(time, one, two); RNS::Bytes data(packer.data(), packer.size()); TEST_ASSERT_EQUAL_size_t(27, packer.size()); @@ -232,6 +236,57 @@ void test_unpack_float_python() { } +void test_json_pack_bytes_array_python() { + static const unsigned char binary[] = { + 0x93, 0xcb, 0x40, 0x5e, 0xdd, 0x2f, 0x1a, 0x9f, + 0xbe, 0x77, 0xc4, 0x06, 0x66, 0x69, 0x72, 0x73, + 0x74, 0xab, 0xc4, 0x07, 0x73, 0x65, 0x63, 0x6f, + 0x6e, 0x64, 0xcd, + }; + double time = 123.456; + // Test that array containing bytes matches python equivalent + const RNS::Bytes one("first\xab"); + const RNS::Bytes two("second\xcd"); + // CBA NOTE: ArduinJson AJ MsgPack appears to also use Bytes cast operator to std::vector for serializing Bytes + // but serializes it as an array instead of as binary, so can't currently serialize Bytes directly yet. + // CBA NOTE: Actually AJ MsgPack probably uses the same Json (de)serializers defined in Bytes as AJ Json uses, so need a way + // to distinguish MsgPack from JSON in (de)serializers to know whether to store as binary or as string represenation!!! + MsgPackBinary bin_one(one.data(), one.size()); + MsgPackBinary bin_two(two.data(), two.size()); + JsonDocument doc; + doc.add(time); + doc.add(bin_one); + doc.add(bin_two); + RNS::Bytes packed; + size_t len = serializeMsgPack(doc, packed.writable(256), 256); + packed.resize(len); + TEST_ASSERT_EQUAL_size_t(27, packed.size()); + TEST_ASSERT_EQUAL_MEMORY(binary, packed.data(), packed.size()); +} + +void test_json_unpack_bytes_array_python() { + static const unsigned char binary[] = { + 0x93, 0xcb, 0x40, 0x5e, 0xdd, 0x2f, 0x1a, 0x9f, + 0xbe, 0x77, 0xc4, 0x06, 0x66, 0x69, 0x72, 0x73, + 0x74, 0xab, 0xc4, 0x07, 0x73, 0x65, 0x63, 0x6f, + 0x6e, 0x64, 0xcd, + }; + JsonDocument doc; + deserializeMsgPack(doc, binary, sizeof(binary)); + double time = doc[0]; + // CBA NOTE: Can't currently deserialize directly into Bytes + //RNS::Bytes one; + //RNS::Bytes two; + MsgPackBinary bin_one = doc[1]; + MsgPackBinary bin_two = doc[2]; + RNS::Bytes one(bin_one.data(), bin_one.size()); + RNS::Bytes two(bin_two.data(), bin_two.size()); + TEST_ASSERT_EQUAL_FLOAT(123.456, time); + TEST_ASSERT_EQUAL_MEMORY("first\xab", one.data(), one.size()); + TEST_ASSERT_EQUAL_MEMORY("second\xcd", two.data(), two.size()); +} + + void setUp(void) { // set stuff up here before each test } @@ -249,6 +304,8 @@ int runUnityTests(void) { RUN_TEST(test_unpack_bytes_array_python); RUN_TEST(test_pack_float_python); RUN_TEST(test_unpack_float_python); + RUN_TEST(test_json_pack_bytes_array_python); + RUN_TEST(test_json_unpack_bytes_array_python); return UNITY_END(); } diff --git a/test/test_persistence/test_main.cpp b/test/test_persistence/test_main.cpp index af67f64..a135dfb 100644 --- a/test/test_persistence/test_main.cpp +++ b/test/test_persistence/test_main.cpp @@ -1176,8 +1176,9 @@ int runUnityTests(void) { RNS::Utilities::OS::remove_file(test_map_path); RNS::Utilities::OS::remove_file(test_vector_path); RNS::Utilities::OS::remove_file(test_set_path); - RNS::Utilities::OS::remove_file(test_array_path); RNS::Utilities::OS::remove_file(test_destination_table_path); + RNS::Utilities::OS::remove_file(test_empty_destination_table_path); + RNS::Utilities::OS::remove_file(test_array_path); RNS::Utilities::OS::remove_file(test_series_path); RNS::Utilities::OS::deregister_filesystem(); diff --git a/test/test_rns_loopback/test_main.cpp b/test/test_rns_loopback/test_main.cpp index 770000a..dab4245 100644 --- a/test/test_rns_loopback/test_main.cpp +++ b/test/test_rns_loopback/test_main.cpp @@ -6,7 +6,11 @@ #include #include -RNS::FileSystem reticulum_filesystem(RNS::Type::NONE); +#ifdef ARDUINO +const char destination_table_path[] = "/destination_table"; +#else +const char destination_table_path[] = "destination_table"; +#endif class InInterface : public RNS::InterfaceImpl { public: @@ -100,7 +104,7 @@ void testReticulum() { HEAD("Running testReticulum...", RNS::LOG_TRACE); HEAD("Registering Filesystem with OS...", RNS::LOG_TRACE); - reticulum_filesystem = new FileSystem(); + RNS::FileSystem reticulum_filesystem = new FileSystem(); ((FileSystem*)reticulum_filesystem.get())->init(); RNS::Utilities::OS::register_filesystem(reticulum_filesystem); @@ -168,6 +172,8 @@ void testReticulum() { HEAD("Destroying Reticulum instance...", RNS::LOG_TRACE); reticulum = {RNS::Type::NONE}; + + RNS::Utilities::OS::remove_file(destination_table_path); }