let's imagine we have the following code snippet
// myfile.c
#include myfile.h
static int global_static_value;
bool check_it(int value) {
if (global_static_value== value) {
return true;
} else {
return false
}
}
void set_value(int value) {
global_static_value = value;
}
// myfile.h
bool check_it(int value)
void set_value(int value)
How to write google test for function bool check_it(int value)
in order to test true
and false
return value?
PS: It is not allowed to #include myfile.c
into google test
TEST_F(MyTestClass, MyTest)
{
set_value(1);
EXPECT_FALSE(check_it(2));
EXPECT_TRUE(check_it(1));
}