Tag Unit Test

Software development using Bash

As for any other language I develop with, I like to make use of tools and utilities to help me spot problems as soon as possible. For that reason I like to have three things in all my projects: Formatter Linter (Static Analysis) Unit Test Framework When developing in Bash there is no difference in this regard. Some people would say that Bash is just for scripting. I mostly agree with that statement, however, sometimes you have to write a lot of Bash and for these cases I want to be able to develop... (read more)

FFF a mocking frameowork for C

This post is a continuation from a previous post called Unity; unit test for C, but in this post we are going to use FFF. FFF is one of the available mocking frameworks for C. In this example I will use CMake to configure the project and build it. All the code and configuration files used in this post are available in this repo in GitHub. Why do we need to mock functions? To answer that question I will introduce the signature of the two methods I will use during this post. The first function is... (read more)

Unity: unit test for C

Unity is one of the available frameworks to create unit tests for C. In this example, I will use CMake to configure the project and build. All the code and configuration files used in this post are available in this repo in GitHub. Can you do unit test in C? And what is Unity? Some people do not know you can do unit tests in C and people must do unit tests in any language. My choice to do unit tests in C is Unity for several reasons: No need to install any package in your distro. Just add the three... (read more)

Unit test with Google Mock for C++

This post is a continuation from a previous post called Unit test with Google Test for C++, but in this post we are going to use Google Mock, that extends the functionality of Google Test. Google Mock is one of the available frameworks for C++ to mock objects in unit tests. In this example I will use the same technologies as for the previous one: CMake to configure the project and build it, for the dependency manager I will use the new and shiny conan. All the code and configuration files used in... (read more)

Unit test with Google Test for C++

Google Test is one of the available Frameworks to create unit test for C++. In this example I will use CMake to configure the project and build. Furthermore, for the dependency manager I will use the new and shiny conan. Before starting, why use a dependency manager such as conan or software to configure and build such as CMake? Because these technologies are widely use it in real projects. All the code and configuration files used in this post are available in this repo in GitHub. Step 1 Install... (read more)