1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

tests: add tests for msg_queue_capacity()

This commit is contained in:
Martine Lenders 2021-03-09 13:46:29 +01:00
parent bb89334322
commit f9efe364b4
No known key found for this signature in database
GPG Key ID: 2134D77A5336DD80
3 changed files with 79 additions and 0 deletions

View File

@ -0,0 +1,5 @@
include ../Makefile.tests_common
USEMODULE += embunit
include $(RIOTBASE)/Makefile.include

View File

@ -0,0 +1,59 @@
/*
* Copyright (C) 2015 Nick van IJzendoorn <nijzendoorn@engineering-spirit.nl>
* 2017 HAW Hamburg
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @ingroup tests
* @{
*
* @file
* @brief Thread test application
*
* @author Nick van IJzendoorn <nijzendoorn@engineering-spirit.nl>
* @author Sebastian Meiling <s@mlng.net>
*
* @}
*/
#include <stdio.h>
#include <inttypes.h>
#include "embUnit/embUnit.h"
#include "embUnit.h"
#include "msg.h"
#include "thread.h"
#define MSG_QUEUE_LENGTH (8)
static msg_t msg_queue[MSG_QUEUE_LENGTH];
static void test_msg_queue_capacity(void)
{
TEST_ASSERT_EQUAL_INT(0, msg_queue_capacity(thread_getpid()));
msg_init_queue(msg_queue, MSG_QUEUE_LENGTH);
TEST_ASSERT_EQUAL_INT(MSG_QUEUE_LENGTH, msg_queue_capacity(thread_getpid()));
}
static Test *tests_msg_queue_capacity_suite(void)
{
EMB_UNIT_TESTFIXTURES(fixtures) {
new_TestFixture(test_msg_queue_capacity),
};
EMB_UNIT_TESTCALLER(tests, NULL, NULL, fixtures);
return (Test *)&tests;
}
int main(void)
{
TESTS_START();
TESTS_RUN(tests_msg_queue_capacity_suite());
TESTS_END();
return 0;
}

View File

@ -0,0 +1,15 @@
#!/usr/bin/env python3
# Copyright (C) 2016 Kaspar Schleiser <kaspar@schleiser.de>
# 2017 Sebastian Meiling <s@mlng.net>
#
# This file is subject to the terms and conditions of the GNU Lesser
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.
import sys
from testrunner import run_check_unittests
if __name__ == "__main__":
sys.exit(run_check_unittests())