Commit 8276dcd2 authored by Ian Craggs's avatar Ian Craggs

Add tests for wrong protocol name #294

parent d1d6496d
...@@ -571,6 +571,9 @@ int test1(struct Options options) ...@@ -571,6 +571,9 @@ int test1(struct Options options)
fprintf(xml, "<testcase classname=\"test3\" name=\"SSL connect fail to nonSSL MQTT server\""); fprintf(xml, "<testcase classname=\"test3\" name=\"SSL connect fail to nonSSL MQTT server\"");
global_start_time = start_clock(); global_start_time = start_clock();
rc = MQTTClient_create(&c, "a b://wrong protocol", "test1", MQTTCLIENT_PERSISTENCE_DEFAULT, persistenceStore);
assert("bad rc from create", rc == MQTTCLIENT_BAD_PROTOCOL, "rc was %d \n", rc);
rc = MQTTClient_create(&c, options.connection, "test1", MQTTCLIENT_PERSISTENCE_DEFAULT, persistenceStore); rc = MQTTClient_create(&c, options.connection, "test1", MQTTCLIENT_PERSISTENCE_DEFAULT, persistenceStore);
if (!(assert("good rc from create", rc == MQTTCLIENT_SUCCESS, "rc was %d \n", rc))) if (!(assert("good rc from create", rc == MQTTCLIENT_SUCCESS, "rc was %d \n", rc)))
goto exit; goto exit;
......
...@@ -613,6 +613,10 @@ int test1(struct Options options) ...@@ -613,6 +613,10 @@ int test1(struct Options options)
fprintf(xml, "<testcase classname=\"test5\" name=\"%s\"", testname); fprintf(xml, "<testcase classname=\"test5\" name=\"%s\"", testname);
global_start_time = start_clock(); global_start_time = start_clock();
rc = MQTTAsync_create(&c, "rubbish://wrong", "test1", MQTTCLIENT_PERSISTENCE_DEFAULT,
NULL);
assert("bad rc from create", rc == MQTTASYNC_BAD_PROTOCOL, "rc was %d \n", rc);
rc = MQTTAsync_create(&c, options.connection, "test1", MQTTCLIENT_PERSISTENCE_DEFAULT, rc = MQTTAsync_create(&c, options.connection, "test1", MQTTCLIENT_PERSISTENCE_DEFAULT,
NULL); NULL);
assert("good rc from create", rc == MQTTASYNC_SUCCESS, "rc was %d \n", rc); assert("good rc from create", rc == MQTTASYNC_SUCCESS, "rc was %d \n", rc);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment