#include <boost/nowide/stat.hpp>
#include <boost/nowide/cstdio.hpp>
+#include "test.hpp"
#ifdef BOOST_WINDOWS
#include <errno.h>
#endif
-#include "test.hpp"
-
+// coverity [root_function]
void test_main(int, char** argv, char**)
{
const std::string prefix = argv[0];
TEST(f);
const char testData[] = "Hello World";
constexpr size_t testDataSize = sizeof(testData);
- TEST(std::fwrite(testData, sizeof(char), testDataSize, f) == testDataSize);
+ TEST_EQ(std::fwrite(testData, sizeof(char), testDataSize, f), testDataSize);
std::fclose(f);
{
#ifdef BOOST_WINDOWS
#else
struct stat stdStat;
#endif /* */
- TEST(boost::nowide::stat(filename.c_str(), &stdStat) == 0);
- TEST(stdStat.st_size == testDataSize);
+ TEST_EQ(boost::nowide::stat(filename.c_str(), &stdStat), 0);
+ TEST_EQ(static_cast<size_t>(stdStat.st_size), testDataSize);
boost::nowide::stat_t boostStat;
- TEST(boost::nowide::stat(filename.c_str(), &boostStat) == 0);
- TEST(boostStat.st_size == testDataSize);
+ TEST_EQ(boost::nowide::stat(filename.c_str(), &boostStat), 0);
+ TEST_EQ(static_cast<size_t>(boostStat.st_size), testDataSize);
}
#ifdef BOOST_WINDOWS
struct _stat stdStat;
// Simulate passing a struct that is 4 bytes smaller, e.g. if it uses 32 bit time field instead of 64 bit
// Need to use the detail function directly
- TEST(boost::nowide::detail::stat(filename.c_str(), &stdStat, sizeof(stdStat) - 4u) == EINVAL);
- TEST(errno == EINVAL);
+ TEST_EQ(boost::nowide::detail::stat(filename.c_str(), &stdStat, sizeof(stdStat) - 4u), EINVAL);
+ TEST_EQ(errno, EINVAL);
+ // Same for our stat_t
+ boost::nowide::stat_t boostStat;
+ TEST_EQ(boost::nowide::detail::stat(filename.c_str(), &boostStat, sizeof(boostStat) - 4u), EINVAL);
+ TEST_EQ(errno, EINVAL);
}
#endif