Skip to content

Commit

Permalink
Improve auto_analyse_raw_data and add lint/unit tests.
Browse files Browse the repository at this point in the history
* Make analyse script code unittest-able.
* Improve raw data parsing for analyse script.
* Add some unit tests for analyse script.
* Update Makefile(s) to use 'run_tests' to run their tests.
* Add python unit & lint tests into Travis
  • Loading branch information
crankyoldgit committed May 12, 2018
1 parent 5a38823 commit 314811c
Show file tree
Hide file tree
Showing 8 changed files with 569 additions and 200 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ lib/googletest/**/*
# GCC pre-compiled headers.
**/*.gch

# Python compiled files
**/*.pyc

# Unit Test builds
test/*.o
test/*.a
Expand Down
File renamed without changes.
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ install:
- arduino --board $BD --save-prefs
- arduino --pref "compiler.warning_level=all" --save-prefs
- sudo apt-get install jq
- sudo pip install pylint
script:
# Check that everything compiles.
- arduino --verify --board $BD $PWD/examples/IRrecvDemo/IRrecvDemo.ino
Expand All @@ -44,9 +45,11 @@ script:
# Check for lint issues.
- shopt -s nullglob
- python cpplint.py --extensions=c,cc,cpp,ino --headers=h,hpp {src,test,tools}/*.{h,c,cc,cpp,hpp,ino} examples/*/*.{h,c,cc,cpp,hpp,ino}
- pylint {src,test,tools}/*.py
- shopt -u nullglob
# Build and run the unit tests.
- (cd test; make run)
- (cd tools; make run_tests)
# Check the version numbers match.
- LIB_VERSION=$(egrep "^#define\s+_IRREMOTEESP8266_VERSION_\s+" src/IRremoteESP8266.h | cut -d\" -f2)
- test ${LIB_VERSION} == "$(jq -r .version library.json)"
Expand Down
File renamed without changes.
2 changes: 2 additions & 0 deletions test/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ run : all
echo "PASS: \o/ \o/ All unit tests passed. \o/ \o/"; \
fi

run_tests : run

install-googletest :
git clone https://github.com/google/googletest.git ../lib/googletest

Expand Down
14 changes: 13 additions & 1 deletion tools/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,20 @@ CXXFLAGS += -g -Wall -Wextra -pthread

all : gc_decode

run_tests : all
failed=""; \
for py_unittest in *_test.py; do \
echo "RUNNING: $${py_unittest}"; \
python ./$${py_unittest} || failed="$${failed} $${py_unittest}"; \
done; \
if [ -n "$${failed}" ]; then \
echo "FAIL: :-( :-( Unit test(s)$${failed} failed! :-( :-("; exit 1; \
else \
echo "PASS: \o/ \o/ All unit tests passed. \o/ \o/"; \
fi

clean :
rm -f *.o gc_decode
rm -f *.o *.pyc gc_decode


# All the IR protocol object files.
Expand Down
Loading

0 comments on commit 314811c

Please sign in to comment.