[tests] Removed warning and using namespace std

This commit is contained in:
hsaturn
2023-02-20 02:18:16 +01:00
parent e45af112c2
commit c21b7b63fb
5 changed files with 5 additions and 15 deletions

View File

@@ -17,7 +17,7 @@ class TestReceiver : public MqttClassBinder<TestReceiver>
public: public:
TestReceiver(const char* name) : MqttClassBinder(), name_(name) {} TestReceiver(const char* name) : MqttClassBinder(), name_(name) {}
void onPublish(const MqttClient* /* source */, const Topic& topic, const char* payload, size_t /* length */) void onPublish(const MqttClient* /* source */, const Topic& topic, const char* /* payload */, size_t /* length */)
{ {
(void) topic; (void) topic;
// Serial << "--> routed message received by " << name_ << ':' << topic.c_str() << " = " << payload << endl; // Serial << "--> routed message received by " << name_ << ':' << topic.c_str() << " = " << payload << endl;

View File

@@ -12,8 +12,6 @@
* Also, this will allow to mock and thus run Action on github * Also, this will allow to mock and thus run Action on github
**/ **/
using namespace std;
MqttBroker broker(1883); MqttBroker broker(1883);
std::map<TinyString, 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

View File

@@ -11,8 +11,6 @@
* Checks with a local broker. Clients must connect to the local broker * Checks with a local broker. Clients must connect to the local broker
**/ **/
using namespace std;
MqttBroker broker(1883); MqttBroker broker(1883);
std::map<TinyString, 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

View File

@@ -9,8 +9,6 @@
* *
**/ **/
using namespace std;
test(indexer_empty) test(indexer_empty)
{ {
assertEqual(StringIndexer::count(), 0); assertEqual(StringIndexer::count(), 0);

View File

@@ -5,26 +5,22 @@
#include <map> #include <map>
#include <iostream> #include <iostream>
#define endl "\n"
/** /**
* TinyMqtt / StringIndexer unit tests. * TinyMqtt / StringIndexer unit tests.
* *
**/ **/
using namespace std;
bool testTopicMatch(const char* a, const char* b, bool expected) bool testTopicMatch(const char* a, const char* b, bool expected)
{ {
Topic ta(a); Topic ta(a);
Topic tb(b); Topic tb(b);
bool match(ta.matches(tb)); bool match(ta.matches(tb));
cout << " " << ta.c_str() << ' '; std::cout << " " << ta.c_str() << ' ';
if (match != expected) if (match != expected)
cout << (expected ? " should match " : " should not match "); std::cout << (expected ? " should match " : " should not match ");
else else
cout << (expected ? " matches " : " unmatches "); std::cout << (expected ? " matches " : " unmatches ");
cout << tb.c_str() << endl; std::cout << tb.c_str() << std::endl;
return expected == match; return expected == match;
} }