Skip to content

Commit

Permalink
Fixed stubs.
Browse files Browse the repository at this point in the history
  • Loading branch information
Juha Heiskanen authored and juhhei01 committed Feb 13, 2018
1 parent 3f66f6a commit ffb3639
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 4 deletions.
1 change: 1 addition & 0 deletions test/nanostack/unittest/stub/adaptation_interface_stub.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ int8_t lowpan_adaptation_indirect_free_messages_from_queues_by_address(struct pr

int8_t lowpan_adaptation_interface_mpx_register(int8_t interface_id, struct mpx_api_s *mpx_api, uint16_t mpx_user_id)
{
adaptation_interface_stub.mpx_api = mpx_api;
return adaptation_interface_stub.expectedInt8;
}

Expand Down
3 changes: 3 additions & 0 deletions test/nanostack/unittest/stub/adaptation_interface_stub.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,12 @@ extern "C" {
#endif
#include "inttypes.h"

struct mpx_api_s;

typedef struct {
int8_t expectedInt8;
bool expectedBool;
struct mpx_api_s *mpx_api;
} adaptation_interface_stub_def;

extern adaptation_interface_stub_def adaptation_interface_stub;
Expand Down
8 changes: 5 additions & 3 deletions test/nanostack/unittest/stub/mac_ie_lib_stub.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "ns_config.h"
#include "nsconfig.h"
#include "ns_types.h"
#include "string.h"
#include "common_functions.h"
#include "mac_common_defines.h"
#include "6LoWPAN/MAC/mac_ie_lib.h"
#include "mac_ie_lib_stub.h"

mac_ie_lib_stub_def_t mac_ie_lib_stub_def;
Expand Down Expand Up @@ -47,19 +48,20 @@ uint8_t *mac_ie_nested_ie_short_base_write(uint8_t *ptr, uint8_t sub_id, uint16_
uint16_t mac_ie_payload_discover(uint8_t *payload_ptr, uint16_t length, mac_payload_IE_t * payload_ie)
{
payload_ie->content_ptr = payload_ptr;
payload_ie->length = mac_ie_lib_stub_def.value_uint16;
return mac_ie_lib_stub_def.value_uint16;
}

uint8_t mac_ie_header_discover(uint8_t *header_ptr, uint16_t length, mac_header_IE_t * header_ie)
{
header_ie->content_ptr = payload_ptr;
header_ie->content_ptr = header_ptr;
return mac_ie_lib_stub_def.value_uint8;
}


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)
{
header_ie->content_ptr = payload_ptr;
header_ie->content_ptr = header_ptr;
return mac_ie_lib_stub_def.value_uint8;
}

Expand Down
3 changes: 2 additions & 1 deletion test/nanostack/unittest/stub/ws_mpx_header_stub.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,14 @@
#include "nsdynmemLIB.h"
#include "common_functions.h"
#include "mac_common_defines.h"
#include "ws_mpx_header.h"
#include "6LoWPAN/ws/ws_mpx_header.h"
#include "ws_mpx_header_stub.h"

ws_mpx_stub_def ws_mpx_stub;

bool ws_llc_mpx_header_frame_parse(uint8_t *ptr, uint16_t length, mpx_msg_t *msg)
{
*msg = ws_mpx_stub.mpx_msg;
return ws_mpx_stub.bool_value;
}

Expand Down
1 change: 1 addition & 0 deletions test/nanostack/unittest/stub/ws_mpx_header_stub.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ extern "C" {
#include "inttypes.h"

typedef struct {
mpx_msg_t mpx_msg;
bool bool_value;
} ws_mpx_stub_def;

Expand Down

0 comments on commit ffb3639

Please sign in to comment.