Rebased & fixed

pull/7944/head
Antti Kauppila 2018-09-09 13:21:54 +03:00
parent a6b4938844
commit 2b7a087849
7 changed files with 80 additions and 9 deletions

View File

@ -124,7 +124,7 @@ TEST_F(TestAT_CellularDevice, test_AT_CellularDevice_close_network)
EXPECT_TRUE(ATHandler_stub::ref_count == 1);
dev.close_network();
EXPECT_TRUE(ATHandler_stub::ref_count == 0);
EXPECT_TRUE(ATHandler_stub::ref_count == kATHandler_destructor_ref_ount);
}
TEST_F(TestAT_CellularDevice, test_AT_CellularDevice_close_sms)
@ -139,7 +139,7 @@ TEST_F(TestAT_CellularDevice, test_AT_CellularDevice_close_sms)
EXPECT_TRUE(ATHandler_stub::ref_count == 1);
dev.close_sms();
EXPECT_TRUE(ATHandler_stub::ref_count == 0);
EXPECT_TRUE(ATHandler_stub::ref_count == kATHandler_destructor_ref_ount);
}
TEST_F(TestAT_CellularDevice, test_AT_CellularDevice_close_power)
@ -154,7 +154,7 @@ TEST_F(TestAT_CellularDevice, test_AT_CellularDevice_close_power)
EXPECT_TRUE(ATHandler_stub::ref_count == 1);
dev.close_power();
EXPECT_TRUE(ATHandler_stub::ref_count == 0);
EXPECT_TRUE(ATHandler_stub::ref_count == kATHandler_destructor_ref_ount);
}
TEST_F(TestAT_CellularDevice, test_AT_CellularDevice_close_sim)
@ -163,16 +163,19 @@ TEST_F(TestAT_CellularDevice, test_AT_CellularDevice_close_sim)
AT_CellularDevice dev(que);
FileHandle_stub fh1;
ATHandler_stub::ref_count = 0;
int ana = 0;
EXPECT_TRUE(dev.open_sim(&fh1));
AT_CellularBase_stub::handler_value = AT_CellularBase_stub::handler_at_constructor_value;
ana = ATHandler_stub::ref_count;
dev.close_sms(); // this should not affect to refcount as it's not opened
EXPECT_TRUE(ATHandler_stub::ref_count == 1);
ana = ATHandler_stub::ref_count;
dev.close_sim();
EXPECT_TRUE(ATHandler_stub::ref_count == 0);
EXPECT_TRUE(ATHandler_stub::ref_count == kATHandler_destructor_ref_ount);
}
TEST_F(TestAT_CellularDevice, test_AT_CellularDevice_close_information)

View File

@ -153,7 +153,7 @@ TEST_F(TestInternetSocket, sigio)
callback_is_called = false;
// I'm calling sigio() through the DEPRECATED method, just to get coverage for both.
// Not sure if this is wise at all, we should not aim for 100%
socket->attach(mbed::callback(my_callback));
socket->sigio(mbed::callback(my_callback));
socket->event();
EXPECT_EQ(callback_is_called, true);
}

View File

@ -15,6 +15,7 @@ set(unittest-sources
)
set(unittest-test-sources
features/netsocket/InternetSocket/test_InternetSocket.cpp
stubs/Mutex_stub.cpp
stubs/mbed_assert_stub.c
stubs/equeue_stub.c
@ -22,5 +23,6 @@ set(unittest-test-sources
stubs/mbed_shared_queues_stub.cpp
stubs/nsapi_dns_stub.cpp
stubs/EventFlags_stub.cpp
features/netsocket/InternetSocket/test_InternetSocket.cpp
stubs/stoip4_stub.c
stubs/ip4tos_stub.c
)

View File

@ -15,8 +15,10 @@ set(unittest-sources
)
set(unittest-test-sources
features/netsocket/TCPSocket/test_TCPSocket.cpp
stubs/Mutex_stub.cpp
stubs/mbed_assert_stub.c
stubs/EventFlags_stub.cpp
features/netsocket/TCPSocket/test_TCPSocket.cpp
stubs/stoip4_stub.c
stubs/ip4tos_stub.c
)

View File

@ -16,6 +16,7 @@ set(unittest-sources
)
set(unittest-test-sources
features/netsocket/UDPSocket/test_UDPSocket.cpp
stubs/Mutex_stub.cpp
stubs/mbed_assert_stub.c
stubs/equeue_stub.c
@ -23,5 +24,6 @@ set(unittest-test-sources
stubs/mbed_shared_queues_stub.cpp
stubs/EventFlags_stub.cpp
stubs/nsapi_dns_stub.cpp
features/netsocket/UDPSocket/test_UDPSocket.cpp
stubs/stoip4_stub.c
stubs/ip4tos_stub.c
)

View File

@ -0,0 +1,30 @@
/*
* Copyright (c) 2014-2018 ARM Limited. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
* 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 <stdio.h>
#include <string.h>
#include "common_functions.h"
#include "ip4string.h"
static void ipv4_itoa(char *string, uint8_t byte);
uint_fast8_t ip4tos(const void *ip4addr, char *p)
{
return 0;
}
static void ipv4_itoa(char *string, uint8_t byte)
{
}

View File

@ -0,0 +1,32 @@
/*
* Copyright (c) 2014-2018 ARM Limited. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
* 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 <string.h>
#include <stdlib.h>
#include <stdint.h>
#include "common_functions.h"
#include "ip4string.h"
/**
* Convert numeric IPv4 address string to a binary.
* \param ip4addr IPv4 address in string format.
* \param len Length of IPv4 string, maximum of 16..
* \param dest buffer for address. MUST be 4 bytes.
* \return boolean set to true if conversion succeded, false if it didn't
*/
bool stoip4(const char *ip4addr, size_t len, void *dest)
{
return true;
}