|
AWS IoT Device SDK C:
MQTT
MQTT 3.1.1 client library
|
| Return to main page ↑ |
Tests for the functions in iot_mqtt_subscription.c. More...
#include "iot_config.h"#include <stdio.h>#include <string.h>#include "iot_init.h"#include "platform/iot_threads.h"#include "platform/iot_clock.h"#include "private/iot_mqtt_internal.h"#include "unity_fixture.h"#include "iot_test_access_mqtt.h"Macros | |
| #define | AWS_IOT_MQTT_SERVER true |
| Determine which MQTT server mode to test (AWS IoT or Mosquitto). | |
| #define | LIST_ITEM_COUNT ( 10 ) |
| Number of subscriptions. | |
| #define | TEST_TOPIC_FILTER_FORMAT ( "/test%lu" ) |
| Format of each topic filter. | |
| #define | TEST_TOPIC_FILTER_LENGTH ( sizeof( TEST_TOPIC_FILTER_FORMAT ) + 1 ) |
| Maximum length of each topic filter. | |
| #define | SUBSCRIPTION_CALLBACK_FUNCTION |
| A non-NULL function pointer to use for subscription callback. This "function" should cause a crash if actually called. More... | |
| #define | TOPIC_FILTER_MATCH_MAX_LENGTH ( 32 ) |
| All test topic filters in the tests TEST_MQTT_Unit_Subscription_TopicFilterMatchTrue_ and TEST_MQTT_Unit_Subscription_TopicFilterMatchFalse_ should be shorter than this length. | |
| #define | TEST_TOPIC_MATCH(topicNameString, topicFilterString, exactMatch, expectedResult) |
| Macro to check a single topic name against a topic filter. More... | |
Functions | |
| static void | _populateList (void) |
| Places dummy subscriptions in the subscription list of _pMqttConnection. | |
| static void | _removalCallback (void *pArgument, IotMqttCallbackParam_t *pPublish) |
| A subscription callback function that unlinks its subscription. | |
| static void | _publishCallback (void *pArgument, IotMqttCallbackParam_t *pPublish) |
| A subscription callback function that only reports whether it was invoked. | |
| TEST_GROUP (MQTT_Unit_Subscription) | |
| Test group for MQTT subscription tests. | |
| TEST_SETUP (MQTT_Unit_Subscription) | |
| Test setup for MQTT subscription tests. | |
| TEST_TEAR_DOWN (MQTT_Unit_Subscription) | |
| Test tear down for MQTT subscription tests. | |
| TEST_GROUP_RUNNER (MQTT_Unit_Subscription) | |
| Test group runner for MQTT subscription tests. | |
| void | TEST_MQTT_Unit_Subscription_ListInsertRemove_ (void) |
| Tests simple insertion and removal of elements from the subscription list. | |
| void | TEST_MQTT_Unit_Subscription_ListFindByTopicFilter_ (void) |
| Tests searching the subscription list using a topic filter. | |
| void | TEST_MQTT_Unit_Subscription_ListFindByPacket_ (void) |
| Tests searching the subscription list using a packet identifier. | |
| void | TEST_MQTT_Unit_Subscription_SubscriptionRemoveByPacket_ (void) |
| Tests removing subscriptions by packet identifier. | |
| void | TEST_MQTT_Unit_Subscription_SubscriptionRemoveByTopicFilter_ (void) |
| Tests removing subscriptions by a topic filter. | |
| void | TEST_MQTT_Unit_Subscription_SubscriptionAddDuplicate_ (void) |
| Tests adding duplicate subscriptions. | |
| void | TEST_MQTT_Unit_Subscription_SubscriptionAddMallocFail_ (void) |
| Tests adding subscriptions when memory allocation fails at various points. | |
| void | TEST_MQTT_Unit_Subscription_ProcessPublish_ (void) |
| Tests invoking subscription callbacks with PUBLISH messages. | |
| void | TEST_MQTT_Unit_Subscription_ProcessPublishMultiple_ (void) |
| Tests that all matching subscription callbacks are invoked for a PUBLISH. | |
| void | TEST_MQTT_Unit_Subscription_SubscriptionUnsubscribe_ (void) |
| Tests that the unsubscribed flag is respected for subscriptions. | |
| void | TEST_MQTT_Unit_Subscription_TopicFilterMatchTrue_ (void) |
| Tests result of matching topic filters and topic names. | |
| void | TEST_MQTT_Unit_Subscription_TopicFilterMatchFalse_ (void) |
| Tests result of matching topic filters and topic names that don't match. | |
Variables | |
| static bool | _connectionCreated = false |
| Tracks whether the global MQTT connection has been created. | |
| static _mqttConnection_t * | _pMqttConnection = IOT_MQTT_CONNECTION_INITIALIZER |
| The MQTT connection shared by all tests. | |
Tests for the functions in iot_mqtt_subscription.c.
| #define SUBSCRIPTION_CALLBACK_FUNCTION |
A non-NULL function pointer to use for subscription callback. This "function" should cause a crash if actually called.
| #define TEST_TOPIC_MATCH | ( | topicNameString, | |
| topicFilterString, | |||
| exactMatch, | |||
| expectedResult | |||
| ) |
Macro to check a single topic name against a topic filter.
| [in] | topicNameString | The topic name to check. |
| [in] | topicFilterString | The topic filter to check. |
| [in] | exactMatch | Whether an exact match is required. If this is false, wildcard matching is allowed. |
| [in] | expectedResult | Whether the topic name and filter are expected to match. |