mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00

Include files are now grouped and sorted in following order: 1. Header file of the class the current file implements 2. Project files 3. Third party files 4. Standard library Change-Id: If31af05652184169f7fee1d7ad08f1b2ed602cf0 Signed-off-by: Filip Hazubski <filip.hazubski@intel.com>
42 lines
938 B
C++
42 lines
938 B
C++
/*
|
|
* Copyright (C) 2017-2019 Intel Corporation
|
|
*
|
|
* SPDX-License-Identifier: MIT
|
|
*
|
|
*/
|
|
|
|
#include "runtime/helpers/file_io.h"
|
|
|
|
#include "gtest/gtest.h"
|
|
|
|
#include <cstdio>
|
|
|
|
TEST(FileIO, existsHasSize) {
|
|
std::string fileName("fileIO.bin");
|
|
std::remove(fileName.c_str());
|
|
ASSERT_FALSE(fileExists(fileName.c_str()));
|
|
|
|
FILE *fp = nullptr;
|
|
fopen_s(&fp, fileName.c_str(), "wb");
|
|
ASSERT_NE(nullptr, fp);
|
|
fprintf(fp, "TEST");
|
|
fclose(fp);
|
|
|
|
EXPECT_TRUE(fileExists(fileName.c_str()));
|
|
EXPECT_TRUE(fileExistsHasSize(fileName.c_str()));
|
|
}
|
|
|
|
TEST(FileIO, existsSizeZero) {
|
|
std::string fileName("fileIO.bin");
|
|
std::remove(fileName.c_str());
|
|
ASSERT_FALSE(fileExists(fileName.c_str()));
|
|
|
|
FILE *fp = nullptr;
|
|
fopen_s(&fp, fileName.c_str(), "wb");
|
|
ASSERT_NE(nullptr, fp);
|
|
fclose(fp);
|
|
|
|
EXPECT_TRUE(fileExists(fileName.c_str()));
|
|
EXPECT_FALSE(fileExistsHasSize(fileName.c_str()));
|
|
}
|