Publishing 2019 R1 content
[platform/upstream/dldt.git] / inference-engine / tests / unit / stress_tests / stress_tests.cpp
1 // Copyright (C) 2018-2019 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 class StressTests : public ::testing::Test {
12 protected:
13     const std::string DUMMY_FILE_NAME = "Dummy.txt";
14     const long long BIG_FILE_SIZE = 2LL * 1024 * 1024 * 1024 + 1;
15
16     virtual void TearDown() {
17     }
18
19     virtual void SetUp() {
20     }
21
22 public:
23
24 };
25
26 struct DummyFileManager {
27
28     static void createDummyFile(const std::string &filename, const size_t size) {
29         std::ofstream ofs(filename, std::ios::binary | std::ios::out);
30         ofs.seekp(size - 1);
31         ofs.write("", 1);
32     }
33
34     static void deleteFile(const std::string &filename) {
35         std::remove(filename.c_str());
36     }
37 };
38
39 TEST_F(StressTests, checkBigFileSize) {
40     DummyFileManager::createDummyFile(DUMMY_FILE_NAME, BIG_FILE_SIZE);
41     long long size = FileUtils::fileSize(DUMMY_FILE_NAME);
42     DummyFileManager::deleteFile(DUMMY_FILE_NAME);
43     ASSERT_EQ(size, BIG_FILE_SIZE);
44 }