2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 * @file test_scoped_fclose.cpp
18 * @author Piotr Marcinkiewicz (p.marcinkiew@samsung.com)
20 * @brief This file is the implementation file of test scoped fclose
26 #include <dpl/test/test_runner.h>
27 #include <dpl/scoped_fclose.h>
29 RUNNER_TEST_GROUP_INIT(DPL)
37 } while (NULL != result && EINTR == errno);
40 } //anonymous namespace
43 Name: ScopedFClose_Zero
44 Description: tests if operator ! works correct for closed file
45 Expected: file should be closed
47 RUNNER_TEST(ScopedFClose_Zero)
49 DPL::ScopedFClose file;
52 RUNNER_ASSERT(!!!file);
56 Name: ScopedArray_NonZero
57 Description: tests if operator ! works correct for open file
58 Expected: file should be open
60 RUNNER_TEST(ScopedFClose_NonZero)
62 DPL::ScopedFClose file(MakeTmp());
65 RUNNER_ASSERT(!!file);
69 Name: ScopedFClose_Reset
70 Description: tests reseting of scoped file
71 Expected: file should be closed after reset
73 RUNNER_TEST(ScopedFClose_Reset)
75 DPL::ScopedFClose file(MakeTmp());
80 file.Reset(MakeTmp());