Publishing R5 content (#72)
[platform/upstream/dldt.git] / inference-engine / tests / unit / stress_tests / stress_tests.cpp
1 // Copyright (C) 2018 Intel Corporation
2 // SPDX-License-Identifier: Apache-2.0
3 //
4
5 #include <gtest/gtest.h>
6 #include <file_utils.h>
7 #include <fstream>
8
9 using namespace std;
10
11 #ifdef ENABLE_STRESS_UNIT_TESTS
12 class StressTests : public ::testing::Test {
13 protected:
14     const std::string DUMMY_FILE_NAME = "Dummy.txt";
15     const long long BIG_FILE_SIZE = 2LL * 1024 * 1024 * 1024 + 1;
16
17     virtual void TearDown() {
18     }
19
20     virtual void SetUp() {
21     }
22
23 public:
24
25 };
26
27 struct DummyFileManager {
28
29     static void createDummyFile(const std::string &filename, const size_t size) {
30         std::ofstream ofs(filename, std::ios::binary | std::ios::out);
31         ofs.seekp(size - 1);
32         ofs.write("", 1);
33     }
34
35     static void deleteFile(const std::string &filename) {
36         std::remove(filename.c_str());
37     }
38 };
39
40 TEST_F(StressTests, checkBigFileSize) {
41     DummyFileManager::createDummyFile(DUMMY_FILE_NAME, BIG_FILE_SIZE);
42     long long size = FileUtils::fileSize(DUMMY_FILE_NAME);
43     DummyFileManager::deleteFile(DUMMY_FILE_NAME);
44     ASSERT_EQ(size, BIG_FILE_SIZE);
45 }
46 #endif //ENABLE_STRESS_UNIT_TESTS