From 961a0b0e4d06d97574c2115f91cbb67196bcc196 Mon Sep 17 00:00:00 2001 From: Olaf Bergmann Date: Fri, 18 Jan 2013 15:19:41 +0100 Subject: [PATCH] check default hash value for '.well-known/core' --- tests/test_uri.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/tests/test_uri.c b/tests/test_uri.c index db8a519e..681aeb60 100644 --- a/tests/test_uri.c +++ b/tests/test_uri.c @@ -313,6 +313,29 @@ t_parse_uri12(void) { } } +void +t_parse_uri13(void) { + char teststr[] __attribute__ ((aligned (8))) = { + 0x00, 0x00, 0x00, 0x00, 0x80, 0x03, 'f', 'o', + 'o', 0x3b, '.', 'w', 'e', 'l', 'l', '-', + 'k', 'n', 'o', 'w', 'n', 0x04, 'c', 'o', + 'r', 'e' + }; + + coap_pdu_t pdu = { + .max_size = sizeof(teststr), + .hdr = (coap_hdr_t *)teststr, + .length = sizeof(teststr) + }; + + coap_key_t key; + + coap_hash_request_uri(&pdu, key); + + CU_ASSERT(sizeof(key) == sizeof(COAP_DEFAULT_WKC_HASHKEY) - 1); + CU_ASSERT_NSTRING_EQUAL(key, COAP_DEFAULT_WKC_HASHKEY, sizeof(key)); +} + CU_pSuite t_init_uri_tests(void) { CU_pSuite suite; @@ -343,6 +366,7 @@ t_init_uri_tests(void) { URI_TEST(suite, t_parse_uri10); URI_TEST(suite, t_parse_uri11); URI_TEST(suite, t_parse_uri12); + URI_TEST(suite, t_parse_uri13); return suite; }