Giter VIP home page Giter VIP logo

c-unit-testing's Introduction

C unit testing

Example of how to write unit tests in C using Unity framework.

Project structure

There are three important directories:

  • src - source code
  • test - test cases
  • unity - unity test framework source

The unity directory is added as a submodule. Make sure to initialize it after cloning the project,

$ git submodule init && git submodule update --recursive

The Makefile is the standard Unity make, inspired from here.

Test file names should start with Test* (case sensitive). Each test file should implement the setUp, thetearDown, and the main functions since this project uses the default Unity test runner.

How to run

You need to install make.

To run tests:

$ make test

To compile the code:

$ make compile

To generate an executable:

$ make install

To run all at once:

$ make

To clean:

$ make clean

To format the code:

$ make format # follow Linux style

c-unit-testing's People

Contributors

kasramp avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Forkers

mathieusoysal

c-unit-testing's Issues

No Rule to Make Target

Hi there!
After cloning this repo I installed the Unity submodule with make.

However, I didn't get the expected output and was met with this error:
root@cameo:/mnt/c/Development/College/CS520/Test/c-unit-testing# make make: Warning: File 'Makefile' has modification time 1324 s in the future mkdir -p build/depends/ mkdir -p build/objs/ mkdir -p build/results/ make: *** No rule to make target 'build/results/Testcalc.txt', needed by 'test'. Stop.

Some help resolving this error would be greatly appreciated!

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.