Greenbone Vulnerability Management Libraries 22.32.0
mqtt_tests.c File Reference
#include "mqtt.c"
#include <cgreen/assertions.h>
#include <cgreen/cgreen.h>
#include <cgreen/constraint_syntax_helpers.h>
#include <cgreen/internal/c_assertions.h>
#include <cgreen/mocks.h>
Include dependency graph for mqtt_tests.c:

Go to the source code of this file.

Functions

void MQTTClient_destroy (MQTTClient *client)
 Describe (mqtt)
 BeforeEach (mqtt)
 AfterEach (mqtt)
 Ensure (mqtt, mqtt_client_destroy_nulls_client)
int main (int argc, char **argv)

Function Documentation

◆ AfterEach()

AfterEach ( mqtt )

Definition at line 25 of file mqtt_tests.c.

26{
27}

◆ BeforeEach()

BeforeEach ( mqtt )

Definition at line 21 of file mqtt_tests.c.

22{
23}

◆ Describe()

Describe ( mqtt )

◆ Ensure()

Ensure ( mqtt ,
mqtt_client_destroy_nulls_client  )

Definition at line 31 of file mqtt_tests.c.

32{
33 MQTTClient client;
34 mqtt_t *mqtt;
35
36 mqtt = g_malloc0 (sizeof (*mqtt));
37 mqtt_set_client_id (mqtt);
38 client = mqtt_create (mqtt, "address");
39 mqtt_set_client (mqtt, client);
40 assert_that (mqtt->client, is_not_null);
41
43 assert_that (mqtt->client, is_null);
44
45 // Cleanup
47 assert_that (mqtt, is_null);
48}
static int mqtt_set_client(mqtt_t *mqtt, MQTTClient client)
Set MQTTClient of mqtt_t.
Definition mqtt.c:288
static void mqtt_client_destroy(mqtt_t *mqtt)
Destroy the MQTTClient client of the mqtt_t.
Definition mqtt.c:186
static MQTTClient mqtt_create(mqtt_t *mqtt, const char *address)
Create a new mqtt client.
Definition mqtt.c:238
static char * mqtt_set_client_id(mqtt_t *mqtt)
Set a random client ID.
Definition mqtt.c:269
static void mqtt_client_data_destroy(mqtt_t **mqtt)
Destroy the mqtt_t data.
Definition mqtt.c:201
Definition mqtt.c:41
void * client
Definition mqtt.c:42

References mqtt_t::client, mqtt_client_data_destroy(), mqtt_client_destroy(), mqtt_create(), mqtt_set_client(), and mqtt_set_client_id().

Here is the call graph for this function:

◆ main()

int main ( int argc,
char ** argv )

Definition at line 52 of file mqtt_tests.c.

53{
54 int ret;
55 TestSuite *suite;
56
57 suite = create_test_suite ();
58
59 add_test_with_context (suite, mqtt, mqtt_client_destroy_nulls_client);
60
61 if (argc > 1)
62 ret = run_single_test (suite, argv[1], create_text_reporter ());
63 else
64 ret = run_test_suite (suite, create_text_reporter ());
65
66 destroy_test_suite (suite);
67
68 return ret;
69}

◆ MQTTClient_destroy()

void MQTTClient_destroy ( MQTTClient * client)

Definition at line 15 of file mqtt_tests.c.

16{
17 (void) client;
18}

Referenced by mqtt_client_destroy(), and mqtt_create().

Here is the caller graph for this function: