[tests] Changed assertions
This commit is contained in:
@@ -56,8 +56,8 @@ test(nowifi_publish_should_be_dispatched)
|
|||||||
publisher.publish("a/c");
|
publisher.publish("a/c");
|
||||||
|
|
||||||
assertEqual(published.size(), (size_t)1); // 1 client has received something
|
assertEqual(published.size(), (size_t)1); // 1 client has received something
|
||||||
assertTrue(published[""]["a/b"] == 1);
|
assertEqual(published[""]["a/b"], 1);
|
||||||
assertTrue(published[""]["a/c"] == 2);
|
assertEqual(published[""]["a/c"], 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
test(nowifi_publish_should_be_dispatched_to_nowifi_clients)
|
test(nowifi_publish_should_be_dispatched_to_nowifi_clients)
|
||||||
@@ -79,10 +79,10 @@ test(nowifi_publish_should_be_dispatched_to_nowifi_clients)
|
|||||||
publisher.publish("a/c");
|
publisher.publish("a/c");
|
||||||
|
|
||||||
assertEqual(published.size(), (size_t)2); // 2 clients have received something
|
assertEqual(published.size(), (size_t)2); // 2 clients have received something
|
||||||
assertTrue(published["A"]["a/b"] == 1);
|
assertEqual(published["A"]["a/b"], 1);
|
||||||
assertTrue(published["A"]["a/c"] == 1);
|
assertEqual(published["A"]["a/c"], 1);
|
||||||
assertTrue(published["B"]["a/b"] == 1);
|
assertEqual(published["B"]["a/b"], 1);
|
||||||
assertTrue(published["B"]["a/c"] == 0);
|
assertEqual(published["B"]["a/c"], 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
test(nowifi_unsubscribe)
|
test(nowifi_unsubscribe)
|
||||||
@@ -95,14 +95,14 @@ test(nowifi_unsubscribe)
|
|||||||
subscriber.subscribe("a/b");
|
subscriber.subscribe("a/b");
|
||||||
|
|
||||||
MqttClient publisher(&broker);
|
MqttClient publisher(&broker);
|
||||||
publisher.publish("a/b");
|
publisher.publish("a/b"); // This publish is received
|
||||||
|
|
||||||
subscriber.unsubscribe("a/b");
|
subscriber.unsubscribe("a/b");
|
||||||
|
|
||||||
publisher.publish("a/b");
|
publisher.publish("a/b"); // Those one, no (unsubscribed)
|
||||||
publisher.publish("a/b");
|
publisher.publish("a/b");
|
||||||
|
|
||||||
assertTrue(published[""]["a/b"] == 1); // Only one publish has been received
|
assertEqual(published[""]["a/b"], 1); // Only one publish has been received
|
||||||
}
|
}
|
||||||
|
|
||||||
test(nowifi_nocallback_when_destroyed)
|
test(nowifi_nocallback_when_destroyed)
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ void onPublish(const MqttClient* srce, const Topic& topic, const char* payload,
|
|||||||
|
|
||||||
test(indexer_empty)
|
test(indexer_empty)
|
||||||
{
|
{
|
||||||
assertTrue(StringIndexer::count()==0);
|
assertEqual(StringIndexer::count(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
test(indexer_strings_deleted_should_empty_indexer)
|
test(indexer_strings_deleted_should_empty_indexer)
|
||||||
@@ -33,15 +33,15 @@ test(indexer_strings_deleted_should_empty_indexer)
|
|||||||
assertTrue(StringIndexer::count()==0);
|
assertTrue(StringIndexer::count()==0);
|
||||||
{
|
{
|
||||||
IndexedString one("one");
|
IndexedString one("one");
|
||||||
assertTrue(StringIndexer::count()==1);
|
assertEqual(StringIndexer::count(), 1);
|
||||||
IndexedString two("two");
|
IndexedString two("two");
|
||||||
assertTrue(StringIndexer::count()==2);
|
assertEqual(StringIndexer::count(), 2);
|
||||||
IndexedString three("three");
|
IndexedString three("three");
|
||||||
assertTrue(StringIndexer::count()==3);
|
assertEqual(StringIndexer::count(), 3);
|
||||||
IndexedString four("four");
|
IndexedString four("four");
|
||||||
assertTrue(StringIndexer::count()==4);
|
assertEqual(StringIndexer::count(), 4);
|
||||||
}
|
}
|
||||||
assertTrue(StringIndexer::count()==0);
|
assertEqual(StringIndexer::count(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
test(indexer_same_strings_count_as_one)
|
test(indexer_same_strings_count_as_one)
|
||||||
@@ -51,7 +51,7 @@ test(indexer_same_strings_count_as_one)
|
|||||||
IndexedString three("one");
|
IndexedString three("one");
|
||||||
IndexedString fourt("one");
|
IndexedString fourt("one");
|
||||||
|
|
||||||
assertTrue(StringIndexer::count()==1);
|
assertEqual(StringIndexer::count(), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
test(indexer_size_of_indexed_string)
|
test(indexer_size_of_indexed_string)
|
||||||
@@ -81,9 +81,9 @@ test(indexer_indexed_operator_eq)
|
|||||||
{
|
{
|
||||||
IndexedString same = one;
|
IndexedString same = one;
|
||||||
assertTrue(one == same);
|
assertTrue(one == same);
|
||||||
assertTrue(StringIndexer::count()==1);
|
assertEqual(StringIndexer::count(), 1);
|
||||||
}
|
}
|
||||||
assertTrue(StringIndexer::count()==1);
|
assertEqual(StringIndexer::count(), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
test(indexer_get_string)
|
test(indexer_get_string)
|
||||||
|
|||||||
Reference in New Issue
Block a user