--- /dev/null
+//******************************************************************
+//
+// Copyright 2020 Samsung Electronics All Rights Reserved.
+//
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+#include "OCDirectPairing.h"
+#include <iomanip>
+#include <OCApi.h>
+#include <gtest/gtest.h>
+#include <string>
+#include <map>
+
+
+using namespace OC;
+
+TEST(getHost, getHost)
+{
+ OCDPDev_t* ptr = (OCDPDev_t*) calloc(1, sizeof(OCDPDev_t));
+ OCDevAddr addrs;
+ strcpy(addrs.addr, "192.168.0.1");
+ ptr->endpoint = addrs;
+ ptr->connType = CT_ADAPTER_IP;
+ ptr->securePort = 0xFF00;
+ OCUUIdentity devId;
+ memcpy(devId.id, "ABCDE1234567890", UUID_IDENTITY_SIZE);
+ ptr->deviceID = devId;
+ OCDirectPairing obj(ptr);
+ std::string str = obj.getHost();
+ EXPECT_EQ("coaps://192.168.0.1:65280", str);
+}
+
+TEST(getDeviceID, getDeviceID)
+{
+ OCDPDev_t* ptr = (OCDPDev_t*) calloc(1, sizeof(OCDPDev_t));
+ OCDevAddr addrs;
+ strcpy(addrs.addr, "192.168.0.1");
+ ptr->endpoint = addrs;
+ ptr->connType = CT_ADAPTER_IP;
+ ptr->securePort = 0xFF00;
+ OCUUIdentity devId;
+ memcpy(devId.id, "ABCDE1234567890", UUID_IDENTITY_SIZE);
+ ptr->deviceID = devId;
+ OCDirectPairing obj(ptr);
+ std::string str = obj.getDeviceID();
+ EXPECT_EQ("41424344-4531-3233-3435-363738393000", str);
+}
+
+TEST(getPairingMethods, getPairingMethods_success)
+{
+ OCDPDev_t* ptr = (OCDPDev_t*) calloc(1, sizeof(OCDPDev_t));
+ ptr->prm = (OCPrm_t *) calloc(3, sizeof(OCPrm_t));
+ ptr->prm[0] = DP_NOT_ALLOWED;
+ ptr->prm[1] = DP_PRE_CONFIGURED;
+ ptr->prm[2] = DP_RANDOM_PIN;
+ ptr->prmLen = 3;
+ std::vector<OCPrm_t> vctr;
+ OCDirectPairing obj(ptr);
+ vctr = obj.getPairingMethods();
+ EXPECT_EQ(ptr->prmLen, vctr.size());
+ for (int i = 0; i < ptr->prmLen; i++)
+ {
+ EXPECT_EQ(ptr->prm[i], vctr[i]);
+ }
+}
+
+TEST(getConnType, getConnType)
+{
+ OCDPDev_t* ptr = (OCDPDev_t*) calloc(1, sizeof(OCDPDev_t));
+ OCDevAddr addrs;
+ strcpy(addrs.addr, "192.168.0.1");
+ ptr->endpoint = addrs;
+ ptr->connType = CT_ADAPTER_IP;
+ ptr->securePort = 0xFF00;
+ OCUUIdentity devId;
+ memcpy(devId.id, "ABCDE1234567890", UUID_IDENTITY_SIZE);
+ ptr->deviceID = devId;
+ OCDirectPairing obj(ptr);
+ OCConnectivityType conn = obj.getConnType();
+ EXPECT_EQ(CT_ADAPTER_IP, conn);
+}
+
+TEST(getDev, getDev)
+{
+ OCDPDev_t* ptr = (OCDPDev_t*) calloc(1, sizeof(OCDPDev_t));
+ OCDevAddr addrs;
+ strcpy(addrs.addr, "192.168.0.1");
+ ptr->endpoint = addrs;
+ ptr->connType = CT_ADAPTER_IP;
+ ptr->securePort = 0xFF00;
+ OCUUIdentity devId;
+ unsigned char st[] = "ABCDE1234567890";
+ memcpy(devId.id, st, UUID_IDENTITY_SIZE);
+ ptr->deviceID = devId;
+ OCDirectPairing obj(ptr);
+ OCDPDev_t* devPtr;
+ devPtr = obj.getDev();
+ EXPECT_EQ(ptr, devPtr);
+}
\ No newline at end of file