Skip to content

Commit ffb3639

Browse files
Juha Heiskanenjuhhei01
authored andcommitted
Fixed stubs.
1 parent 3f66f6a commit ffb3639

File tree

5 files changed

+12
-4
lines changed

5 files changed

+12
-4
lines changed

test/nanostack/unittest/stub/adaptation_interface_stub.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ int8_t lowpan_adaptation_indirect_free_messages_from_queues_by_address(struct pr
8989

9090
int8_t lowpan_adaptation_interface_mpx_register(int8_t interface_id, struct mpx_api_s *mpx_api, uint16_t mpx_user_id)
9191
{
92+
adaptation_interface_stub.mpx_api = mpx_api;
9293
return adaptation_interface_stub.expectedInt8;
9394
}
9495

test/nanostack/unittest/stub/adaptation_interface_stub.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,12 @@ extern "C" {
2323
#endif
2424
#include "inttypes.h"
2525

26+
struct mpx_api_s;
27+
2628
typedef struct {
2729
int8_t expectedInt8;
2830
bool expectedBool;
31+
struct mpx_api_s *mpx_api;
2932
} adaptation_interface_stub_def;
3033

3134
extern adaptation_interface_stub_def adaptation_interface_stub;

test/nanostack/unittest/stub/mac_ie_lib_stub.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,12 @@
1414
* See the License for the specific language governing permissions and
1515
* limitations under the License.
1616
*/
17-
#include "ns_config.h"
17+
#include "nsconfig.h"
1818
#include "ns_types.h"
1919
#include "string.h"
2020
#include "common_functions.h"
2121
#include "mac_common_defines.h"
22+
#include "6LoWPAN/MAC/mac_ie_lib.h"
2223
#include "mac_ie_lib_stub.h"
2324

2425
mac_ie_lib_stub_def_t mac_ie_lib_stub_def;
@@ -47,19 +48,20 @@ uint8_t *mac_ie_nested_ie_short_base_write(uint8_t *ptr, uint8_t sub_id, uint16_
4748
uint16_t mac_ie_payload_discover(uint8_t *payload_ptr, uint16_t length, mac_payload_IE_t * payload_ie)
4849
{
4950
payload_ie->content_ptr = payload_ptr;
51+
payload_ie->length = mac_ie_lib_stub_def.value_uint16;
5052
return mac_ie_lib_stub_def.value_uint16;
5153
}
5254

5355
uint8_t mac_ie_header_discover(uint8_t *header_ptr, uint16_t length, mac_header_IE_t * header_ie)
5456
{
55-
header_ie->content_ptr = payload_ptr;
57+
header_ie->content_ptr = header_ptr;
5658
return mac_ie_lib_stub_def.value_uint8;
5759
}
5860

5961

6062
uint8_t mac_ie_header_sub_id_discover(uint8_t *header_ptr, uint16_t length, mac_header_IE_t * header_ie, uint8_t sub_id)
6163
{
62-
header_ie->content_ptr = payload_ptr;
64+
header_ie->content_ptr = header_ptr;
6365
return mac_ie_lib_stub_def.value_uint8;
6466
}
6567

test/nanostack/unittest/stub/ws_mpx_header_stub.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,14 @@
3838
#include "nsdynmemLIB.h"
3939
#include "common_functions.h"
4040
#include "mac_common_defines.h"
41-
#include "ws_mpx_header.h"
41+
#include "6LoWPAN/ws/ws_mpx_header.h"
4242
#include "ws_mpx_header_stub.h"
4343

4444
ws_mpx_stub_def ws_mpx_stub;
4545

4646
bool ws_llc_mpx_header_frame_parse(uint8_t *ptr, uint16_t length, mpx_msg_t *msg)
4747
{
48+
*msg = ws_mpx_stub.mpx_msg;
4849
return ws_mpx_stub.bool_value;
4950
}
5051

test/nanostack/unittest/stub/ws_mpx_header_stub.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ extern "C" {
2626
#include "inttypes.h"
2727

2828
typedef struct {
29+
mpx_msg_t mpx_msg;
2930
bool bool_value;
3031
} ws_mpx_stub_def;
3132

0 commit comments

Comments
 (0)