Skip to content

Commit

Permalink
Add simple continuous integration check for version macros
Browse files Browse the repository at this point in the history
  • Loading branch information
terrillmoore committed Jun 10, 2018
1 parent 4c23be1 commit 777a061
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 5 deletions.
13 changes: 8 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ before_install:
#
- "function _samdopts { echo mcci:samd:${1:-mcci_catena_4450}:lorawan_region=${2:-us915} ; }"
- "function _stm32l0opts { echo mcci:stm32:Catena:pnum=${1:-CATENA_4551},opt=${3:-osstd},xserial=${4:-generic},usb=${5:-none},upload_method=${6:-STLink} ; }"
#
#
# Put one or more arguments into lmic_project_config.h as `#define $i\n`
- function _projcfg { for i in "$@" ; do printf '#define %s 1\n' "$i" ; done > $PWD/project_config/lmic_project_config.h ; }
#
Expand All @@ -29,17 +29,20 @@ before_install:
#
# modify the board manager preferences to point to our BSPs.
- arduino --pref "boardsmanager.additional.urls=https://github.com/mcci-catena/arduino-boards/raw/master/BoardManagerFiles/package_mcci_index.json" --save-prefs
#
# show the output of the config commands for reference.
- "echo $(_stm32l0opts) $(_stm32l0opts '' projcfg)"
- "echo $(_samdopts) $(_samdopts '' projcfg)"

install:
- arduino --install-boards mcci:samd
- arduino --install-boards mcci:stm32

script:
#
# show the output of the config commands for reference.
- "echo $(_stm32l0opts) $(_stm32l0opts '' projcfg)"
- "echo $(_samdopts) $(_samdopts '' projcfg)"

# simple header file test
- arduino --verify --board $(_samdopts) $PWD/examples/header_test/header_test.ino
- arduino --verify --board $(_stm32l0opts) $PWD/examples/header_test/header_test.ino
#
# test each of the regions.
- arduino --verify --board $(_samdopts '' us915) $PWD/examples/raw-feather/raw-feather.ino
Expand Down
36 changes: 36 additions & 0 deletions examples/header_test/header_test.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
Module: header_test.ino
Function:
Simple hello-world (and compile-test) app
Copyright notice and License:
See LICENSE file accompanying this project.
Author:
Terry Moore, MCCI Corporation April 2018
*/

#include <lmic.h>

# define STATIC_ASSERT(e) \
void STATIC_ASSERT__(int MCCIADK_C_ASSERT_x[(e) ? 1: -1])

STATIC_ASSERT(ARDUINO_LMIC_VERSION >= ARDUINO_LMIC_VERSION_CALC(2,2,0,0));

STATIC_ASSERT(ARDUINO_LMIC_VERSION_CALC(1,2,3,4) == 0x01020304);

STATIC_ASSERT(ARDUINO_LMIC_VERSION_GET_MAJOR(ARDUINO_LMIC_VERSION_CALC(1,2,3,4)) == 1);
STATIC_ASSERT(ARDUINO_LMIC_VERSION_GET_MINOR(ARDUINO_LMIC_VERSION_CALC(1,2,3,4)) == 2);
STATIC_ASSERT(ARDUINO_LMIC_VERSION_GET_PATCH(ARDUINO_LMIC_VERSION_CALC(1,2,3,4)) == 3);
STATIC_ASSERT(ARDUINO_LMIC_VERSION_GET_LOCAL(ARDUINO_LMIC_VERSION_CALC(1,2,3,4)) == 4);

void setup()
{
}

void loop()
{
}

0 comments on commit 777a061

Please sign in to comment.