static OCProvisionDev_t pDev1;
static OCProvisionDev_t pDev2;
static OicSecCredType_t credType = SYMMETRIC_PAIR_WISE_KEY;
+static OCProvisionDev_t selectedDeviceInfo;
+static OicSecPconf_t pconf;
static void provisioningCB (void* UNUSED1, int UNUSED2, OCProvisionResult_t *UNUSED3, bool UNUSED4)
{
OCProvisionDev_t dev1;
EXPECT_EQ(OC_STACK_INVALID_PARAM, SRPRemoveDevice(NULL, 0, &dev1, NULL));
}
+
+TEST(SRPProvisionDirectPairingTest, NullselectedDeviceInfo)
+{
+ EXPECT_EQ(OC_STACK_INVALID_PARAM, SRPProvisionDirectPairing(NULL, NULL, &pconf, &provisioningCB));
+}
+
+TEST(SRPProvisionDirectPairingTest, Nullpconf)
+{
+ EXPECT_EQ(OC_STACK_INVALID_PARAM, SRPProvisionDirectPairing(NULL, &selectedDeviceInfo, NULL, &provisioningCB));
+}
+
+TEST(SRPProvisionDirectPairingTest, Nullcallback)
+{
+ EXPECT_EQ(OC_STACK_INVALID_CALLBACK, SRPProvisionDirectPairing(NULL, &selectedDeviceInfo, &pconf, NULL));
+}
'../../../oc_logger/include',
'../../../../extlibs/gtest/gtest-1.7.0/include',
'../../../../extlibs/cjson/',
+ '../provisioning/include',
# '../../../../extlibs/tinydtls/',
'../include'
])
'iotvticalendartest.cpp',
'base64tests.cpp',
'svcresourcetest.cpp',
- 'srmtestcommon.cpp'])
+ 'srmtestcommon.cpp',
+ 'directpairingtest.cpp'])
Alias("test", [unittest])
--- /dev/null
+//******************************************************************
+//
+// Copyright 2016 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 "gtest/gtest.h"
+#include "directpairing.h"
+
+using namespace std;
+
+#define TAG "DIRECTPAIRING-UT"
+
+static OCDirectPairingDev_t peer;
+static OicSecPrm_t pmSel;
+static char pinNumber;
+
+static void ResultCB(OCDirectPairingDev_t *UNUSED1, OCStackResult UNUSED2)
+{
+ //dummy callback
+ (void) UNUSED1;
+ (void) UNUSED2;
+}
+
+TEST(DPDirectPairingTest, NullPeer)
+{
+ EXPECT_EQ(OC_STACK_INVALID_PARAM, DPDirectPairing(NULL, pmSel, &pinNumber, &ResultCB));
+}
+
+TEST(DPDirectPairingTest, NullPinNumber)
+{
+ EXPECT_EQ(OC_STACK_INVALID_PARAM, DPDirectPairing(&peer, pmSel, NULL, &ResultCB));
+}
+
char gManufacturerName[] = "myName";
char gTooLongManufacturerName[] = "extremelylongmanufacturername";
char gManufacturerUrl[] = "www.foooooooooooooooo.baaaaaaaaaaaaar";
+static OCPrm_t pmSel;
+static char pinNumber;
+static OCDPDev_t peer;
std::chrono::seconds const SHORT_TEST_TIMEOUT = std::chrono::seconds(5);
return OC_STACK_KEEP_TRANSACTION;
}
+static void resultCallback(OCDPDev_t *UNUSED1, OCStackResult UNUSED2)
+{
+ (void) (UNUSED1);
+ (void) (UNUSED2);
+}
+
//-----------------------------------------------------------------------------
// Entity handler
//-----------------------------------------------------------------------------
{
EXPECT_TRUE(std::is_pod<OCHeaderOption>::value);
}
+
+TEST(OCDoDirectPairingTests, Nullpeer)
+{
+ EXPECT_EQ(OC_STACK_INVALID_PARAM,OCDoDirectPairing(NULL, pmSel, &pinNumber, &resultCallback));
+}
+
+TEST(OCDoDirectPairingTests, NullCallback)
+{
+ EXPECT_EQ(OC_STACK_INVALID_PARAM,OCDoDirectPairing(&peer, pmSel, &pinNumber, NULL));
+}
+
+TEST(OCDoDirectPairingTests, NullpinNumber)
+{
+ EXPECT_EQ(OC_STACK_INVALID_PARAM,OCDoDirectPairing(&peer, pmSel, NULL, &resultCallback));
+}