Code Monkey home page Code Monkey logo

arduino-mock's Introduction

arduino-mockBuild Status

Gitter chat

A GMock stub library for a mock of Arduino libraries.

How it works

This is the mock library for Arduino sketch program. To run unittest for this mock, please follow this instruction.

$ git clone https://github.com/ikeyasu/arduino-mock.git
$ cd arduino-mock
$ git submodule update --init --recursive
$ cd test
$ make test
for t in arduino_unittest serial_unittest spark_unittest; do ./$t; done;
Running main() from gmock_main.cc
[==========] Running 2 tests from 2 test cases.
[----------] Global test environment set-up.
[----------] 1 test from digitalRead
[ RUN      ] digitalRead.2
[       OK ] digitalRead.2 (1 ms)
[----------] 1 test from digitalRead (1 ms total)

[----------] 1 test from delay
[ RUN      ] delay.normal
[       OK ] delay.normal (0 ms)
[----------] 1 test from delay (0 ms total)

[----------] Global test environment tear-down
[==========] 2 tests from 2 test cases ran. (1 ms total)
[  PASSED  ] 2 tests.
Running main() from gmock_main.cc
[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from loop
[ RUN      ] loop.pushed
[       OK ] loop.pushed (1 ms)
[----------] 1 test from loop (1 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test case ran. (1 ms total)
[  PASSED  ] 1 test.
Running main() from gmock_main.cc
[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from publish
[ RUN      ] publish.normal
[       OK ] publish.normal (1 ms)
[----------] 1 test from publish (1 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test case ran. (1 ms total)
[  PASSED  ] 1 test.

Sample and how to install to your app

Please refer to https://github.com/ikeyasu/arduino-gmock-sample

You need to copy "make/Makefile" to your app's dir and modify it.

Contribution

Please send a pull-request. You need to run code formatter before commiting.

Install formatter

You need astyle 2.03.

Unbutun 14.04 LTS:

$ sudo apt-get install astyle=2.03-1

Mac (Homebrew):

$ brew tap ikeyasu/myversions
$ brew install astyle203

Windows: Please download from here.

How to run formatter

$ ./script/codeformatter.sh

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.