mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-24 22:13:52 +01:00
19743: tests/unittests: improve int size detection r=maribu a=maribu ### Contribution description Deduce from the value of `INT_MAX` whether `int` is 16 bit or 32 bit, rather than check CPU names. 19744: tests: update tests for MSP430 CPU r=maribu a=maribu ### Contribution description Using the builtin `__MSP430__` macro is fool-proof and stable even if one would try to rename and reorganize the MSP430 cpu code. Co-authored-by: Marian Buschsieweke <marian.buschsieweke@posteo.net>
This commit is contained in:
commit
4deca3dfd7
@ -21,7 +21,7 @@
|
||||
|
||||
/* For MSP430 cpu's the last page holds the interrupt vector, although the api
|
||||
should not limit erasing that page, we don't want to break when testing */
|
||||
#if defined(CPU_CC430) || defined(CPU_MSP430FXYZ)
|
||||
#ifdef __MSP430__
|
||||
#define LAST_AVAILABLE_PAGE (FLASHPAGE_NUMOF - 2)
|
||||
#else
|
||||
#define LAST_AVAILABLE_PAGE (FLASHPAGE_NUMOF - 1)
|
||||
|
||||
@ -341,7 +341,7 @@ static int cmd_test_last(int argc, char **argv)
|
||||
fill = 'a';
|
||||
}
|
||||
}
|
||||
#if defined(CPU_CC430) || defined(CPU_MSP430FXYZ)
|
||||
#ifdef __MSP430__
|
||||
printf("The last page holds the ISR vector, so test page %u\n", last_free);
|
||||
#endif
|
||||
if (flashpage_write_and_verify(last_free, page_mem) != FLASHPAGE_OK) {
|
||||
@ -427,7 +427,7 @@ static int cmd_test_last_raw(int argc, char **argv)
|
||||
|
||||
/* try to align */
|
||||
memcpy(raw_buf, "test12344321tset", 16);
|
||||
#if defined(CPU_CC430) || defined(CPU_MSP430FXYZ)
|
||||
#ifdef __MSP430__
|
||||
printf("The last page holds the ISR vector, so test page %u\n", last_free);
|
||||
#endif
|
||||
|
||||
|
||||
@ -157,7 +157,7 @@ Test *tests_senml(void)
|
||||
{
|
||||
EMB_UNIT_TESTFIXTURES(fixtures) {
|
||||
/* Don't run this test on CPUs with unpredictable rounding */
|
||||
#if !defined(__AVR__) && !defined(CPU_MSP430FXYZ)
|
||||
#if !defined(__AVR__) && !defined(__MSP430__)
|
||||
new_TestFixture(test_phydat_to_senml_float),
|
||||
#endif
|
||||
new_TestFixture(test_phydat_to_senml_decimal),
|
||||
|
||||
@ -8,6 +8,9 @@
|
||||
|
||||
#ifndef UNITTESTS_CONSTANTS_H
|
||||
#define UNITTESTS_CONSTANTS_H
|
||||
#include <limits.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "embUnit/embUnit.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
@ -55,7 +58,7 @@ extern "C" {
|
||||
#define TEST_UINT64 (13500266397057512199LLU)
|
||||
#endif
|
||||
|
||||
#if defined(CPU_CC430) || defined(CPU_MSP430FXYZ) || defined(CPU_ATMEGA2560)
|
||||
#if INT_MAX == INT16_MAX
|
||||
#define TEST_INT TEST_INT16
|
||||
#else
|
||||
#define TEST_INT TEST_INT32
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user