March 2017 version
It seems that TDD can be done even in the world of embedded C language Or rather, I really want an environment for testing legacy code. .. .. At that time, Great Person said that the framework called CppUTest is recommended. By the way, the work environment has finally moved to windows 10, and I want to do various things at this timing. Of course, I'm in trouble if I don't support my Mac and multi-platform Windows is particularly troublesome to build an environment, so I decided to go for it. .. .. Or rather, there is little Japanese information on CppUTest.
windows10 64bit
macOS sierra 10.12.3
By the way, the IDE uses CLion 2016.3.3 It feels good to support multiple platforms
Introduced 64-bit version of cygwin (32bit version may be acceptable)
Clone CppUTest from github
--Choose your favorite directory
--Hereafter, the directory of CppUTest is referred to as \
Build CppUTest with cygwin For the time being, just send the following command and it's OK
cd <CppUTest>/cpputest_build
../configure
make
You can check if the following command was installed properly as it is
```sh
make tdd
```
The test should run and pass or ignore If you have installed it successfully, you should set environment variables.
```sh
CPPUTEST_HOME=<CppUTest>
```
It's a good idea to install the script as well.
```sh
cd <CppUTest>/scripts
chmod u+x *.sh
./InstallScripts.sh
```
Try it like this
```sh
git clone https://github.com/davisford/cmake-cpputest
cd cmake-cpputest
mkdir build
cd build
cmake ..
make
```
** It seems that even if you pick up the tutorial sample and make it as it is, it will not pass! !! !! ** **
An error occurs because there is no rule to make ‘\
Located in ** \
**libCppUTest.a**
**libCppUTestExt.a**
To ** \
It seems that it can be installed with Homebrew, but I did it with git git clone and below just like windows
** \
/ cpputest_build / lib ** libCppUTest.a libCppUTestExt.a
Copy> to ** \
Don't forget
mac doesn't have to do anything special All you have to do is set windows and cygwin When I open the above tutorial sample in CLion, I get a warning due to a different version of cmake, but there is no problem with the build. For CLion, if you add -v to Program arguments in the build config, you can always see the test results and make progress.
For the time being, I wanted a comprehensive Japanese commentary from the introduction of cygwin to the construction of the CppUTest environment. If you do so far, you can stand at the starting point Right now, I'm groping for the time being and writing tests while fighting English.
-Embedded programming by test-driven development
Recommended Posts