String indexer std::string removed

This commit is contained in:
hsaturn
2023-01-23 21:39:57 +01:00
parent d324a913ec
commit 787cb77a26
17 changed files with 316 additions and 59 deletions

View File

@@ -1,10 +1,7 @@
# See https://github.com/bxparks/EpoxyDuino for documentation about this
# Makefile to compile and run Arduino programs natively on Linux or MacOS.
EXTRA_CXXFLAGS=-g3 -O0
# Remove flto flag from EpoxyDuino (too many <optimized out>)
CXXFLAGS = -Wextra -Wall -std=gnu++11 -fno-exceptions -fno-threadsafe-statics
include ../Makefile.opts
APP_NAME := local-tests
ARDUINO_LIBS := AUnit AceCommon AceTime TinyMqtt EspMock ESP8266WiFi ESPAsyncTCP TinyConsole

View File

@@ -16,7 +16,7 @@ using namespace std;
MqttBroker broker(1883);
std::map<std::string, std::map<Topic, int>> published; // map[client_id] => map[topic] = count
std::map<TinyString, std::map<Topic, int>> published; // map[client_id] => map[topic] = count
const char* lastPayload;
size_t lastLength;
@@ -40,7 +40,7 @@ test(local_client_should_unregister_when_destroyed)
assertEqual(broker.clientsCount(), (size_t)0);
}
test(local_client_do_not_disconnect_after_publishing)
test(local_client_do_not_disconnect_after_publishing_and_long_inactivity)
{
EpoxyTest::set_millis(0);
MqttBroker broker(1883);
@@ -56,11 +56,16 @@ test(local_client_do_not_disconnect_after_publishing)
sender.publish("test", "value");
broker.loop();
EpoxyTest::add_seconds(60);
EpoxyTest::add_seconds(600);
client.loop();
sender.loop();
broker.loop();
sender.publish("test", "value");
broker.loop();
sender.loop();
broker.loop();
assertEqual(broker.clientsCount(), (size_t)2);
assertEqual(sender.connected(), true);
assertEqual(client.connected(), true);