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:
parent
bb89334322
commit
f9efe364b4
5
tests/msg_queue_capacity/Makefile
Normal file
5
tests/msg_queue_capacity/Makefile
Normal file
@ -0,0 +1,5 @@
|
||||
include ../Makefile.tests_common
|
||||
|
||||
USEMODULE += embunit
|
||||
|
||||
include $(RIOTBASE)/Makefile.include
|
59
tests/msg_queue_capacity/main.c
Normal file
59
tests/msg_queue_capacity/main.c
Normal 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;
|
||||
}
|
15
tests/msg_queue_capacity/tests/01-run.py
Executable file
15
tests/msg_queue_capacity/tests/01-run.py
Executable 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())
|
Loading…
Reference in New Issue
Block a user