boost test case for function taking user input
Posted
by
oadams
on Stack Overflow
See other posts from Stack Overflow
or by oadams
Published on 2011-03-07T23:20:52Z
Indexed on
2011/03/08
0:10 UTC
Read the original article
Hit count: 149
c++
|boost-test
I have a function that takes in user input via std::cin:
std::getline(std::cin, in);
and creates a corresponding data structure by matching it with a regular expression. The function then returns this data structure.
I'm using boost.test and I want to create a unit test to check that the output data type is correct given some inputs. However I don't know how to go about it since the input isn't passed as an argument to the function.
EDIT: Is there a simple way to create a boost test case that feeds the function a string via standard input?
© Stack Overflow or respective owner