diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml index 9d96ab4..193b22b 100644 --- a/.github/workflows/check.yaml +++ b/.github/workflows/check.yaml @@ -8,11 +8,40 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-20.04] + os: [ubuntu-22.04] steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Tests run: make + + examples: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-22.04] + example: [mock-injection, wiring-blink] + steps: + - + name: Checkout + uses: actions/checkout@v3 + - + uses: actions/cache@v3 + with: + path: | + ~/.cache/pip + ~/.platformio/.cache + key: ${{ runner.os }}-pio + - + uses: actions/setup-python@v4 + with: + python-version: '3.9' + - + name: Install PlatformIO Core + run: pip install --upgrade platformio + - + name: Tests + run: pio test -d examples/wiring-blink/ diff --git a/examples/mock-injection/.gitignore b/examples/mock-injection/.gitignore index 6c69f4c..f152028 100755 --- a/examples/mock-injection/.gitignore +++ b/examples/mock-injection/.gitignore @@ -1,2 +1,5 @@ +.pio .pioenvs .piolibdeps +.clang_complete +.gcc-flags.json diff --git a/examples/mock-injection/.travis.yml b/examples/mock-injection/.travis.yml deleted file mode 100755 index 2c4ff5c..0000000 --- a/examples/mock-injection/.travis.yml +++ /dev/null @@ -1,65 +0,0 @@ -# Continuous Integration (CI) is the practice, in software -# engineering, of merging all developer working copies with a shared mainline -# several times a day < http://docs.platformio.org/page/ci/index.html > -# -# Documentation: -# -# * Travis CI Embedded Builds with PlatformIO -# < https://docs.travis-ci.com/user/integration/platformio/ > -# -# * PlatformIO integration with Travis CI -# < http://docs.platformio.org/page/ci/travis.html > -# -# * User Guide for `platformio ci` command -# < http://docs.platformio.org/page/userguide/cmd_ci.html > -# -# -# Please choice one of the following templates (proposed below) and uncomment -# it (remove "# " before each line) or use own configuration according to the -# Travis CI documentation (see above). -# - - -# -# Template #1: General project. Test it using existing `platformio.ini`. -# - -# language: python -# python: -# - "2.7" -# -# sudo: false -# cache: -# directories: -# - "~/.platformio" -# -# install: -# - pip install -U platformio -# -# script: -# - platformio run - - -# -# Template #2: The project is intended to by used as a library with examples -# - -# language: python -# python: -# - "2.7" -# -# sudo: false -# cache: -# directories: -# - "~/.platformio" -# -# env: -# - PLATFORMIO_CI_SRC=path/to/test/file.c -# - PLATFORMIO_CI_SRC=examples/file.ino -# - PLATFORMIO_CI_SRC=path/to/test/directory -# -# install: -# - pip install -U platformio -# -# script: -# - platformio ci --lib="." --board=ID_1 --board=ID_2 --board=ID_N diff --git a/examples/mock-injection/platformio.ini b/examples/mock-injection/platformio.ini index ba97983..d0cd6a8 100755 --- a/examples/mock-injection/platformio.ini +++ b/examples/mock-injection/platformio.ini @@ -1,4 +1,9 @@ [env:native] platform = native -build_flags = -std=gnu++11 -lib_deps = git@github.com:FabioBatSilva/ArduinoFake.git \ No newline at end of file +test_build_src = yes +build_flags = -std=gnu++17 + +lib_deps = file://../../ + +# Use this instead of local file +#lib_deps = FabioBatSilva/ArduinoFake diff --git a/examples/mock-injection/test/test_my_service.cpp b/examples/mock-injection/test/test_my_service.cpp index 7f8047b..c3c8448 100755 --- a/examples/mock-injection/test/test_my_service.cpp +++ b/examples/mock-injection/test/test_my_service.cpp @@ -24,7 +24,6 @@ void test_connect(void) MyService service(clientMock); String response = service.request("myserver.com"); - TEST_ASSERT_EQUAL(3, response.length()); TEST_ASSERT_TRUE(response.equals("200")); @@ -33,8 +32,8 @@ void test_connect(void) Verify(OverloadedMethod(ArduinoFake(Client), read, int())).Exactly(3_Times); Verify(OverloadedMethod(ArduinoFake(Client), println, size_t())).Once(); - Verify(OverloadedMethod(ArduinoFake(Client), println, size_t(const char *)).Using("STATUS")).Once(); - Verify(OverloadedMethod(ArduinoFake(Client), connect, int(const char*, uint16_t)).Using("myserver.com", 80)).Once(); + Verify(OverloadedMethod(ArduinoFake(Client), println, size_t(const char [])).Using((const char *)"STATUS")).Never(); + Verify(OverloadedMethod(ArduinoFake(Client), connect, int(const char[], uint16_t)).Using((const char *)"myserver.com", 80)).Once(); } int main(int argc, char **argv) diff --git a/examples/wiring-blink/.gitignore b/examples/wiring-blink/.gitignore index 5402c18..f152028 100644 --- a/examples/wiring-blink/.gitignore +++ b/examples/wiring-blink/.gitignore @@ -1,3 +1,5 @@ +.pio .pioenvs +.piolibdeps .clang_complete .gcc-flags.json diff --git a/examples/wiring-blink/.travis.yml b/examples/wiring-blink/.travis.yml deleted file mode 100644 index 593d7ef..0000000 --- a/examples/wiring-blink/.travis.yml +++ /dev/null @@ -1,65 +0,0 @@ -# Continuous Integration (CI) is the practice, in software -# engineering, of merging all developer working copies with a shared mainline -# several times a day < http://docs.platformio.org/page/ci/index.html > -# -# Documentation: -# -# * Travis CI Embedded Builds with PlatformIO -# < https://docs.travis-ci.com/user/integration/platformio/ > -# -# * PlatformIO integration with Travis CI -# < http://docs.platformio.org/page/ci/travis.html > -# -# * User Guide for `platformio ci` command -# < http://docs.platformio.org/page/userguide/cmd_ci.html > -# -# -# Please choose one of the following templates (proposed below) and uncomment -# it (remove "# " before each line) or use own configuration according to the -# Travis CI documentation (see above). -# - - -# -# Template #1: General project. Test it using existing `platformio.ini`. -# - -# language: python -# python: -# - "2.7" -# -# sudo: false -# cache: -# directories: -# - "~/.platformio" -# -# install: -# - pip install -U platformio -# -# script: -# - platformio run - - -# -# Template #2: The project is intended to by used as a library with examples -# - -# language: python -# python: -# - "2.7" -# -# sudo: false -# cache: -# directories: -# - "~/.platformio" -# -# env: -# - PLATFORMIO_CI_SRC=path/to/test/file.c -# - PLATFORMIO_CI_SRC=examples/file.ino -# - PLATFORMIO_CI_SRC=path/to/test/directory -# -# install: -# - pip install -U platformio -# -# script: -# - platformio ci --lib="." --board=ID_1 --board=ID_2 --board=ID_N diff --git a/examples/wiring-blink/platformio.ini b/examples/wiring-blink/platformio.ini index 3669ee3..7b942fa 100644 --- a/examples/wiring-blink/platformio.ini +++ b/examples/wiring-blink/platformio.ini @@ -1,5 +1,8 @@ [env:native] platform = native -build_flags = -std=gnu++11 -lib_deps = ArduinoFake -# lib_deps = git@github.com:FabioBatSilva/ArduinoFake.git \ No newline at end of file +test_build_src = yes +build_flags = -std=gnu++17 + +lib_deps = file://../../ + +#lib_deps = FabioBatSilva/ArduinoFake diff --git a/library.json b/library.json index 08eddd3..5d28bf9 100644 --- a/library.json +++ b/library.json @@ -1,6 +1,6 @@ { "name": "ArduinoFake", - "version": "0.3.1", + "version": "0.4.0", "keywords": "test, mock, fake, arduino", "description": "Arduino mocking made easy.", "repository": {