|
Revision 30757, 1.5 kB
(checked in by saturday06, 4 years ago)
|
|
dounika natteru............
|
| Line | |
|---|
| 1 | #include <PrecompiledHeaders.h>
|
|---|
| 2 | #include "Common.h"
|
|---|
| 3 | #include "Mediator.h"
|
|---|
| 4 | #include "ConfigFile.h"
|
|---|
| 5 |
|
|---|
| 6 | #include <boost/test/unit_test.hpp>
|
|---|
| 7 |
|
|---|
| 8 | using namespace i3;
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 | BOOST_AUTO_TEST_CASE(test_configboostpp)
|
|---|
| 12 | {
|
|---|
| 13 | //c.b = reinterpret_cast<decltype(c.b)>(&c);
|
|---|
| 14 | //BOOST_CHECK((Config*)(decltype(c.b))(&c) == &c);
|
|---|
| 15 |
|
|---|
| 16 | using namespace std;
|
|---|
| 17 | }
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 | BOOST_AUTO_TEST_CASE(test_configboostasiodfj)
|
|---|
| 21 | {
|
|---|
| 22 |
|
|---|
| 23 | }
|
|---|
| 24 |
|
|---|
| 25 | BOOST_AUTO_TEST_CASE(test_basic_tcscat_s)
|
|---|
| 26 | {
|
|---|
| 27 | BOOST_CHECK(get_config_dir_path() == NULL);
|
|---|
| 28 |
|
|---|
| 29 | init_config_dir_path();
|
|---|
| 30 |
|
|---|
| 31 | TCHAR temp[MAX_PATH] = {};
|
|---|
| 32 |
|
|---|
| 33 |
|
|---|
| 34 | BOOST_REQUIRE(_tcscpy_s(temp, get_config_dir_path()) == 0);
|
|---|
| 35 | BOOST_REQUIRE(_tcsnlen(temp, _countof(temp)) > 3); // fuzzy
|
|---|
| 36 | BOOST_REQUIRE(_tcscat_s(temp, _T("\\temp.txt")) == 0);
|
|---|
| 37 |
|
|---|
| 38 | #ifdef MOL_GUI_WINDOWS
|
|---|
| 39 | const TCHAR nulldevice[] = _T("nul");
|
|---|
| 40 | const TCHAR mkdir_p[] = _T("mkdir");
|
|---|
| 41 | i3::string cmd;
|
|---|
| 42 | cmd = i3::string() + mkdir_p + _T("\"") + get_config_dir_path() + _T("\" 2>") + nulldevice;
|
|---|
| 43 | const TCHAR* c = cmd.c_str();
|
|---|
| 44 | _tsystem(cmd.c_str());
|
|---|
| 45 | #endif
|
|---|
| 46 |
|
|---|
| 47 | _tremove(temp);
|
|---|
| 48 | {
|
|---|
| 49 | FILE* f = _tfopen(temp, _T("w"));
|
|---|
| 50 | BOOST_REQUIRE(f);
|
|---|
| 51 | fprintf(f, "test");
|
|---|
| 52 | fclose(f);
|
|---|
| 53 | }
|
|---|
| 54 | {
|
|---|
| 55 | FILE* f = _tfopen(temp, _T("r"));
|
|---|
| 56 | BOOST_REQUIRE(f);
|
|---|
| 57 | char buf[100] = {};
|
|---|
| 58 | fgets(buf, _countof(buf), f);
|
|---|
| 59 | fclose(f);
|
|---|
| 60 |
|
|---|
| 61 | BOOST_REQUIRE(std::string(buf) == "test");
|
|---|
| 62 | }
|
|---|
| 63 | BOOST_REQUIRE(_tremove(temp) == 0);
|
|---|
| 64 | }
|
|---|