Hi everyone,
I am new at google test, and just wanted to do a simple test by verifying a function that calculates the power of the number. The function are declared and defined in different header file and different source file. Here is the part of the code:
header.hpp:
int pow_test(int x, int y);
src1.c:
#include <math.h>
#include "header.hpp"
int pow_test(int x, int y){
return pow(x,y);
}
test.cc:
#include <gtest/gtest.h>
#include <math.h>
#include "src/header.hpp"
TEST (TestingPowTest, PowTests){
EXPECT_EQ(pow_test(2,4),16);
}
I am receiving error message when I try to build the code with the command line below:
bazel test --cxxopt=-std=c++14 --test_output=all //:test
The error message:
test.cc:4:10: fatal error: src/header.hpp: No such file or directory
4 | #include "src/header.hpp"
But the header file is the same directory, why it can not find it? Can anybody help me on that? Thank you