2

I have a linux utility that parses structured input ( a text file ), processes it and prints the result to the screen. For example: (input)

COMMAND=create
    NAME=Stack
    SURNAME=Overflow

My utility takes as input the above text file and tries to create an object (stack, overflow) in the database. If the action is executed successfully my program returns something like this:

COMMAND=create
    Code=0
    Result=OK

or in case of error

COMMAND=create
    Code=10
    Result=Duplicate entry

I am looking for a good way to create a regression suite for my binary. Any ideas that fit my case? Is any alternative to JUnit in C/C++?

4
  • C or C++? The answers will be different. "C/C++" is not a language. Commented Apr 2, 2012 at 15:05
  • Some binaries are pure C. However most of them are C++. My basic target is C++. Commented Apr 2, 2012 at 15:08
  • possible duplicate of Choosing a C++ unit testing tool/framework Commented Apr 2, 2012 at 15:10
  • For C unit testing, see stackoverflow.com/q/2745775/10077. Commented Apr 2, 2012 at 15:12

2 Answers 2

3

Google test is an awesome C++ framework, but it has a bit of a learning curve: https://github.com/google/googletest/

Sign up to request clarification or add additional context in comments.

Comments

1

I recommend CTest, which is part of CMake. It's pretty easy to configure and adding a test is as as simple as creating a test executable and calling TEST("Code should be 0", Code=0, true); Or something similar ... and it works for both c and c++ ;)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.