[IOT-2112] No unit tests 15/21915/11
authorakk0rd <v.riznyk@samsung.com>
Tue, 15 Aug 2017 09:30:39 +0000 (12:30 +0300)
committerRandeep Singh <randeep.s@samsung.com>
Fri, 8 Sep 2017 09:31:44 +0000 (09:31 +0000)
No unit tests for CASelectCipherSuite/OCSelectCipherSuite

Change-Id: I71a75b172d65bd15ff2e511d5190f1441275f46d
Signed-off-by: akk0rd <v.riznyk@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/21915
Tested-by: jenkins-iotivity <jenkins@iotivity.org>
Reviewed-by: Randeep Singh <randeep.s@samsung.com>
resource/csdk/stack/test/SConscript
resource/csdk/stack/test/stacktests.cpp

index abdd263..2372177 100644 (file)
@@ -44,6 +44,9 @@ stacktest_env.PrependUnique(CPPPATH=[
     '../../connectivity/inc/pkix',
     '../../connectivity/external/inc',
     '../../../oc_logger/include',
+    '#resource/csdk/connectivity/inc',
+    '#resource/csdk/connectivity/lib/libcoap-4.1.1/include',
+    '#resource/csdk/connectivity/common/inc',
 ])
 
 stacktest_env.PrependUnique(LIBS=[
index b6b6651..3b0fd53 100644 (file)
@@ -30,6 +30,11 @@ extern "C"
     #include "oic_time.h"
     #include "ocresourcehandler.h"
     #include "occollection.h"
+    #include "mbedtls/ssl_ciphersuites.h"
+    #include "octypes.h"
+#if defined (WITH_POSIX) && (defined (__WITH_DTLS__) || defined(__WITH_TLS__))
+    #include "ca_adapter_net_ssl.h"
+#endif
 }
 
 #include <gtest/gtest.h>
@@ -3436,3 +3441,23 @@ TEST(OCIpv6ScopeLevel, invalidAddressTest)
     EXPECT_EQ(OC_STACK_ERROR, OCGetIpv6AddrScope(invalidAddr3, &scopeLevel));
     EXPECT_EQ(OC_STACK_ERROR, OCGetIpv6AddrScope(invalidAddr4, &scopeLevel));
 }
+
+#if defined (WITH_POSIX) && (defined (__WITH_DTLS__) || defined(__WITH_TLS__))
+TEST(SelectCipherSuite,SelectPositiveAdapter)
+{
+
+    CAinitSslAdapter();
+
+    uint16_t cipher = 0xC0AE;
+    EXPECT_EQ(OC_STACK_OK,OCSelectCipherSuite(cipher, OC_ADAPTER_IP));
+    EXPECT_EQ(OC_STACK_OK,OCSelectCipherSuite(cipher, OC_ADAPTER_GATT_BTLE));
+    EXPECT_EQ(OC_STACK_OK,OCSelectCipherSuite(cipher, OC_ADAPTER_RFCOMM_BTEDR));
+    EXPECT_EQ(OC_STACK_OK,OCSelectCipherSuite(cipher, OC_ADAPTER_TCP));
+    EXPECT_EQ(OC_STACK_OK,OCSelectCipherSuite(cipher, OC_ADAPTER_NFC));
+
+    #ifdef RA_ADAPTER
+        EXPECT_EQ(OC_STACK_OK,OCSelectCipherSuite(cipher, OC_ADAPTER_REMOTE_ACCESS));
+    #endif
+
+}
+#endif