Example #1
0
static void test_ng_netif_remove__success(void)
{
    kernel_pid_t ifs[GNRC_NETIF_NUMOF];
    size_t size;

    test_ng_netif_add__success();

    gnrc_netif_remove(TEST_UINT8);

    size = gnrc_netif_get(ifs);
    TEST_ASSERT_EQUAL_INT(0, size);
}
Example #2
0
static void test_ng_netif_remove__KERNEL_PID_UNDEF(void)
{
    kernel_pid_t ifs[GNRC_NETIF_NUMOF];
    size_t size;

    test_ng_netif_add__success();

    gnrc_netif_remove(KERNEL_PID_UNDEF);

    size = gnrc_netif_get(ifs);
    TEST_ASSERT_EQUAL_INT(1, size);
    TEST_ASSERT_EQUAL_INT(TEST_UINT8, ifs[0]);
}
Example #3
0
static void test_gnrc_netif_remove__not_an_if(void)
{
    kernel_pid_t ifs[GNRC_NETIF_NUMOF];
    size_t size;

    test_gnrc_netif_add__success();

    gnrc_netif_remove(TEST_UINT8 + 1);

    size = gnrc_netif_get(ifs);
    TEST_ASSERT_EQUAL_INT(1, size);
    TEST_ASSERT_EQUAL_INT(TEST_UINT8, ifs[0]);
}
Example #4
0
gnrc_nettest_res_t gnrc_nettest_send_iface(kernel_pid_t pid, gnrc_pktsnip_t *in,
        unsigned int exp_pkts,
        const kernel_pid_t *exp_senders,
        const gnrc_pktsnip_t **exp_out)
{
    gnrc_nettest_res_t res;

    gnrc_netif_add(thread_getpid());

    res = _pkt_test(GNRC_NETAPI_MSG_TYPE_SND, pid, in, exp_pkts, exp_senders,
                    exp_out);

    gnrc_netif_remove(thread_getpid());

    return res;
}
Example #5
0
/* takes one out of the middle of the netif list and checks if all interfaces
 * are gotten regardless */
static void test_ng_netif_get__success_3_minus_one(void)
{
    kernel_pid_t ifs[GNRC_NETIF_NUMOF];
    size_t size;
    int count = 0;

    for (int i = 0; i < 3; i++) {
        TEST_ASSERT_EQUAL_INT(0, gnrc_netif_add(TEST_UINT8 + i));
    }

    gnrc_netif_remove(TEST_UINT8 + 1);

    size = gnrc_netif_get(ifs);
    TEST_ASSERT_EQUAL_INT(2, size);

    for (size_t i = 0; i < size; i++) {
        if ((ifs[i] == TEST_UINT8) || ifs[i] == (TEST_UINT8 + 2)) {
            count++;
        }
    }

    TEST_ASSERT_EQUAL_INT(size, count);
}