diff options
author | vng <viktor.govako@gmail.com> | 2011-06-26 01:18:14 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 01:20:05 +0300 |
commit | c58c4ec772b6c924246b20f12c90cb2a803b5034 (patch) | |
tree | 315a591817ec314171649f29e012c6ffae28ff19 /platform | |
parent | bb666aaa3d97c045a67f0c2910a1b9d70c475c6a (diff) |
Replace stdlib.hpp with cstdlib.hpp;
Replace stdio.hpp with cstdio.hpp;
Replace time.hpp with systime.hpp;
Diffstat (limited to 'platform')
-rw-r--r-- | platform/platform_tests/platform_test.cpp | 30 | ||||
-rw-r--r-- | platform/preferred_languages.cpp | 2 | ||||
-rw-r--r-- | platform/wifi_info_windows.cpp | 2 |
3 files changed, 22 insertions, 12 deletions
diff --git a/platform/platform_tests/platform_test.cpp b/platform/platform_tests/platform_test.cpp index 90fb92e02f..daa18061ea 100644 --- a/platform/platform_tests/platform_test.cpp +++ b/platform/platform_tests/platform_test.cpp @@ -4,8 +4,10 @@ #include "../../defines.hpp" -#include "../../std/stdio.hpp" +#include "../../coding/writer.hpp" +#include "../../coding/internal/file_data.hpp" +#include "../../base/logging.hpp" #include "../../base/start_mem_debug.hpp" @@ -14,17 +16,25 @@ char const * TEST_FILE_NAME = "some_temporary_unit_test_file.tmp"; UNIT_TEST(WritableDir) { string const path = GetPlatform().WritableDir() + TEST_FILE_NAME; - FILE * f = fopen(path.c_str(), "w"); - TEST_NOT_EQUAL(f, 0, ("Can't create file", path)); - if (f) - fclose(f); - remove(path.c_str()); + + try + { + my::FileData f(path, my::FileData::OP_WRITE_TRUNCATE); + } + catch (Writer::OpenException const &) + { + LOG(LCRITICAL, ("Can't create file")); + return; + } + + my::DeleteFileX(path); } UNIT_TEST(WritablePathForFile) { - string const p1 = GetPlatform().WritableDir() + TEST_FILE_NAME; - string const p2 = GetPlatform().WritablePathForFile(TEST_FILE_NAME); + Platform & pl = GetPlatform(); + string const p1 = pl.WritableDir() + TEST_FILE_NAME; + string const p2 = pl.WritablePathForFile(TEST_FILE_NAME); TEST_EQUAL(p1, p2, ()); } @@ -35,7 +45,7 @@ UNIT_TEST(ReadPathForFile) Platform & p = GetPlatform(); for (size_t i = 0; i < ARRAY_SIZE(arr); ++i) { - TEST_GREATER( p.ReadPathForFile(arr[i]).size(), 0, ("File should exist!") ); + TEST_GREATER(p.ReadPathForFile(arr[i]).size(), 0, ("File should exist!")); } bool wasException = false; @@ -47,7 +57,7 @@ UNIT_TEST(ReadPathForFile) { wasException = true; } - TEST( wasException, ()); + TEST_EQUAL(wasException, true, ()); } UNIT_TEST(GetFilesInDir) diff --git a/platform/preferred_languages.cpp b/platform/preferred_languages.cpp index 4f46fb07e1..f78dde9548 100644 --- a/platform/preferred_languages.cpp +++ b/platform/preferred_languages.cpp @@ -17,7 +17,7 @@ #define MUI_LANGUAGE_NAME 0x8 #elif defined(OMIM_OS_LINUX) - #include "../std/stdlib.hpp" + #include "../std/cstdlib.hpp" #elif defined(OMIM_OS_ANDROID) /// @TODO diff --git a/platform/wifi_info_windows.cpp b/platform/wifi_info_windows.cpp index 2a226ec558..7ba77cf9b4 100644 --- a/platform/wifi_info_windows.cpp +++ b/platform/wifi_info_windows.cpp @@ -7,7 +7,7 @@ #include "../base/logging.hpp" #include "../std/windows.hpp" -#include "../std/stdio.hpp" +#include "../std/cstdio.hpp" #include <winsock2.h> #include <iphlpapi.h> |