0

I have never used any unit test framework with C++. Now I took CppUTest version 3.6. I am trying to compile library according to README_InstallCppUTest.txt file:

./configure => OK

make => Not OK

src/CppUTest/JUnitTestOutput.cpp:170:29: error: use of old-style cast [-Werror,-Wold-style-cast]

Shall I correct all of these compiling error or can I somehow skip the errors? I know that g++ is symbolic link to clang in OSX.

Previously I tried to use gtest. Basically it was very nice when making dummy test (e.g. EXPECT_EQ(1,1)). When I tried to test a class of normal production code, it was difficult to find how to use stubs or mocs. So I decided to try CppUTest.

Pasi
  • 181
  • 2
  • 7
  • 1
    Preferences and opinions. IMHO, the use of the old-style cast can 'hide' (certain types of conversion) errors, and thus should be edited to one (or sometimes more) of the new style casts (which can be very tedious). – 2785528 Apr 03 '15 at 22:26
  • Ok. If I change CppUTest framework code, can I then commit changes? Please answer if you are familiar with CppUTest. – Pasi Apr 04 '15 at 06:05
  • Pasi, I'd recommend you use the current head from github. I am pretty sure the error will be gone. CppUTest uses "old style" casts for compatibility reasons, and the current makefiles already contain compiler flags to disable that warning. You could of course locally change the make for 3.6 but I don't remember offhand where you'd have to do that, and the current code is already fixed... – A.Robert Apr 29 '15 at 20:27
  • The flag in question is `-Wno-old-style-cast`. – A.Robert Apr 29 '15 at 20:36

1 Answers1

0

Shall I correct all of these compiling error or can I somehow skip the errors?

You may disable the warning (or remove -Werror - it turns all warnings into errors).

I assume you have downloaded the stable release, so you can try with the current Git Snapshot. However, this may not be stable.

Ok. If I change CppUTest framework code, can I then commit changes?

You should frist check the current sources (link above). If it's not fixed yet, it's always a good idea to contribute your fix to the project.

You can either file an issue or open a pull request for your fix.

ollo
  • 24,797
  • 14
  • 106
  • 155