Fix too many things in StringIndexer test

This commit is contained in:
hsaturn
2021-04-10 15:29:17 +02:00
parent 077c0c6adf
commit 67a296eb28
3 changed files with 4 additions and 18 deletions

View File

@@ -2,7 +2,6 @@
#include <map>
#include <string>
#include <string.h>
#include <ESP8266WiFi.h>
/***
* Allows to store up to 255 different strings with one byte class

View File

@@ -1,4 +1,5 @@
#include <ESP8266WiFi.h>
#pragma once
#include <ESPAsyncTCP.h>
#include <vector>
#include <set>
#include <string>

View File

@@ -1,28 +1,14 @@
#include <AUnit.h>
#include <TinyMqtt.h>
#include <StringIndexer.h>
#include <map>
/**
* TinyMqtt local unit tests.
* TinyMqtt / StringIndexer unit tests.
*
* Clients are connected to pseudo remote broker
* The remote will be 127.0.0.1:1883
* We are using 127.0.0.1 because this is simpler to test with a single ESP
* Also, this will allow to mock and thus run Action on github
**/
using namespace std;
MqttBroker broker(1883);
std::map<std::string, std::map<Topic, int>> published; // map[client_id] => map[topic] = count
void onPublish(const MqttClient* srce, const Topic& topic, const char* payload, size_t length)
{
if (srce)
published[srce->id()][topic]++;
}
test(indexer_empty)
{
assertEqual(StringIndexer::count(), 0);