Patrick Barrett / libexositecoap
Revision:
26:3d46024a8c30
Parent:
7:f9df43829cea
--- a/picocoap/tests/coap_test.c	Tue Jan 06 13:02:02 2015 -0600
+++ b/picocoap/tests/coap_test.c	Wed Jan 07 12:37:30 2015 -0600
@@ -161,6 +161,22 @@
 	mu_assert("[ERROR] GET CON option two value was wrong.",
 	          memcmp(option.val, ref_bin+14, option.len) == 0);
 
+	option = coap_get_option_by_num(&msg_ref, CON_URI_QUERY, 0);
+	mu_assert("[ERROR] GET CON option by num length was wrong.",
+	          option.len == 40);
+	mu_assert("[ERROR] GET CON option by num number was wrong.",
+	          option.num == CON_URI_QUERY);
+	mu_assert("[ERROR] GET CON option by num value was wrong.",
+	          memcmp(option.val, ref_bin+14, option.len) == 0);
+
+	option = coap_get_option_by_num(&msg_ref, CON_ETAG, 0);
+	mu_assert("[ERROR] GET CON non-option by num length not zero.",
+	          option.len == 0);
+	mu_assert("[ERROR] GET CON non-option by num number not null.",
+	          option.num == 0);
+	mu_assert("[ERROR] GET CON non-option by num value not null.",
+	          option.val == NULL);
+
 	return 0;
 }