亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? filetest.cpp

?? This software aims to create an applet and panel tools to manage a wireless interface card, such as
?? CPP
字號:
//
// FileTest.cpp
//
// $Id: //poco/Main/Foundation/testsuite/src/FileTest.cpp#5 $
//
// Copyright (c) 2004, Guenter Obiltschnig/Applied Informatics.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
// 1. Redistributions of source code must retain the above copyright
//    notice, this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright
//    notice, this list of conditions and the following disclaimer in the
//    documentation and/or other materials provided with the distribution.
//
// 3. Redistributions in any form must be accompanied by information on
//    how to obtain complete source code for this software and any
//    accompanying software that uses this software.  The source code
//    must either be included in the distribution or be available for no
//    more than the cost of distribution plus a nominal fee, and must be
//    freely redistributable under reasonable conditions.  For an
//    executable file, complete source code means the source code for all
//    modules it contains.  It does not include source code for modules or
//    files that typically accompany the major components of the operating
//    system on which the executable file runs.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//


#include "FileTest.h"
#include "CppUnit/TestCaller.h"
#include "CppUnit/TestSuite.h"
#include "Foundation/File.h"
#include "Foundation/TemporaryFile.h"
#include "Foundation/Path.h"
#include "Foundation/Exception.h"
#include "Foundation/Thread.h"
#include <fstream>
#include <set>


using Foundation::File;
using Foundation::TemporaryFile;
using Foundation::Path;
using Foundation::Exception;
using Foundation::Timestamp;
using Foundation::Thread;


FileTest::FileTest(const std::string& name): CppUnit::TestCase(name)
{
}


FileTest::~FileTest()
{
}


void FileTest::testFileAttributes1()
{
	File f("testfile.dat");
	assert (!f.exists());
	
	try
	{
		bool flag = f.canRead();
		failmsg("file does not exist - must throw exception");
	}
	catch (Exception&)
	{
	}

	try
	{
		bool flag = f.canWrite();
		failmsg("file does not exist - must throw exception");
	}
	catch (Exception&)
	{
	}

	try
	{
		bool flag = f.isFile();
		failmsg("file does not exist - must throw exception");
	}
	catch (Exception&)
	{
	}

	try
	{
		bool flag = f.isDirectory();
		failmsg("file does not exist - must throw exception");
	}
	catch (Exception&)
	{
	}

	try
	{
		Timestamp ts = f.created();
		failmsg("file does not exist - must throw exception");
	}
	catch (Exception&)
	{
	}

	try
	{
		Timestamp ts = f.getLastModified();
		failmsg("file does not exist - must throw exception");
	}
	catch (Exception&)
	{
	}

	try
	{
		Timestamp ts;
		f.setLastModified(ts);
		failmsg("file does not exist - must throw exception");
	}
	catch (Exception&)
	{
	}

	try
	{
		File::FileSize fs = f.getSize();
		failmsg("file does not exist - must throw exception");
	}
	catch (Exception&)
	{
	}

	try
	{
		f.setSize(0);
		failmsg("file does not exist - must throw exception");
	}
	catch (Exception&)
	{
	}

	try
	{
		f.setWriteable();
		failmsg("file does not exist - must throw exception");
	}
	catch (Exception&)
	{
	}

	try
	{
		f.setReadOnly();
		failmsg("file does not exist - must throw exception");
	}
	catch (Exception&)
	{
	}

	try
	{
		f.copyTo("copy.dat");
		failmsg("file does not exist - must throw exception");
	}
	catch (Exception&)
	{
	}

	try
	{
		f.moveTo("copy.dat");
		failmsg("file does not exist - must throw exception");
	}
	catch (Exception&)
	{
	}

	try
	{
		f.renameTo("copy.dat");
		failmsg("file does not exist - must throw exception");
	}
	catch (Exception&)
	{
	}

	try
	{
		f.remove();
		failmsg("file does not exist - must throw exception");
	}
	catch (Exception&)
	{
	}
}


void FileTest::testCreateFile()
{
	File f("testfile.dat");
	bool created = f.createFile();
	assert (created);
	created = f.createFile();
	assert (!created);
}


void FileTest::testFileAttributes2()
{
	TemporaryFile f;
	bool created = f.createFile();
	Timestamp ts;
	assert (created);
	
	assert (f.exists());
	assert (f.canRead());
	assert (f.canWrite());
	assert (f.isFile());
	assert (!f.isDirectory());
	Timestamp tsc = f.created();
	Timestamp tsm = f.getLastModified();
	assert (tsc - ts >= -2000000 && tsc - ts <= 2000000);
	assert (tsm - ts >= -2000000 && tsm - ts <= 2000000);
	
	f.setWriteable(false);
	assert (!f.canWrite());
	assert (f.canRead());

	f.setReadOnly(false);	
	assert (f.canWrite());
	assert (f.canRead());
	
	ts = Timestamp::fromEpochTime(1000000);
	f.setLastModified(ts);
	assert (f.getLastModified() == ts);
}


void FileTest::testCompare()
{
	File f1("abc.txt");
	File f2("def.txt");
	File f3("abc.txt");
	
	assert (f1 == f3);
	assert (!(f1 == f2));
	assert (f1 != f2);
	assert (!(f1 != f3));
	assert (!(f1 == f2));
	assert (f1 < f2);
	assert (f1 <= f2);
	assert (!(f2 < f1));
	assert (!(f2 <= f1));
	assert (f2 > f1);
	assert (f2 >= f1);
	assert (!(f1 > f2));
	assert (!(f1 >= f2));
	
	assert (f1 <= f3);
	assert (f1 >= f3);
}


void FileTest::testSize()
{
	std::ofstream ostr("testfile.dat");
	ostr << "Hello, world!" << std::endl;
	ostr.close();
	File f("testfile.dat");
	assert (f.getSize() > 0);
	f.setSize(0);
	assert (f.getSize() == 0);
}


void FileTest::testDirectory()
{
	File d("testdir");
	try
	{
		d.remove(true);
	}
	catch (...)
	{
	}
	TemporaryFile::registerForDeletion("testdir");
	
	bool created = d.createDirectory();
	assert (created);
	assert (d.isDirectory());
	assert (!d.isFile());
	std::vector<std::string> files;
	d.list(files);
	assert (files.empty());
	
	File f = Path("testdir/file1", Path::PATH_UNIX);
	f.createFile();
	f = Path("testdir/file2", Path::PATH_UNIX);
	f.createFile();
	f = Path("testdir/file3", Path::PATH_UNIX);
	f.createFile();
	
	d.list(files);
	assert (files.size() == 3);
	
	std::set<std::string> fs;
	fs.insert(files.begin(), files.end());
	assert (fs.find("file1") != fs.end());
	assert (fs.find("file2") != fs.end());
	assert (fs.find("file3") != fs.end());
	
	File dd(Path("testdir/testdir2/testdir3", Path::PATH_UNIX));
	dd.createDirectories();
	assert (dd.exists());
	assert (dd.isDirectory());
	
	d.remove(true);
}


void FileTest::testCopy()
{
	std::ofstream ostr("testfile.dat");
	ostr << "Hello, world!" << std::endl;
	ostr.close();

	File f1("testfile.dat");
	TemporaryFile f2;
	f1.copyTo(f2.path());
	assert (f2.exists());
	assert (f1.getSize() == f2.getSize());
}


void FileTest::testMove()
{
	std::ofstream ostr("testfile.dat");
	ostr << "Hello, world!" << std::endl;
	ostr.close();

	File f1("testfile.dat");
	File::FileSize sz = f1.getSize();
	TemporaryFile f2;
	f1.moveTo(f2.path());
	assert (f2.exists());
	assert (f2.getSize() == sz);
	assert (f1.exists());
	assert (f1 == f2);
}


void FileTest::testRename()
{
	std::ofstream ostr("testfile.dat");
	ostr << "Hello, world!" << std::endl;
	ostr.close();

	File f1("testfile.dat");
	File f2("testfile2.dat");
	f1.renameTo(f2.path());

	assert (f2.exists());
	assert (f1.exists());
	assert (f1 == f2);
	
	f2.remove();
}


void FileTest::setUp()
{
	File f("testfile.dat");
	try
	{
		f.remove();
	}
	catch (...)
	{
	}
}


void FileTest::tearDown()
{
	File f("testfile.dat");
	try
	{
		f.remove();
	}
	catch (...)
	{
	}
}


CppUnit::Test* FileTest::suite()
{
	CppUnit::TestSuite* pSuite = new CppUnit::TestSuite("FileTest");

	CppUnit_addTest(pSuite, FileTest, testFileAttributes1);
	CppUnit_addTest(pSuite, FileTest, testFileAttributes2);
	CppUnit_addTest(pSuite, FileTest, testCompare);
	CppUnit_addTest(pSuite, FileTest, testSize);
	CppUnit_addTest(pSuite, FileTest, testDirectory);
	CppUnit_addTest(pSuite, FileTest, testCopy);
	CppUnit_addTest(pSuite, FileTest, testMove);
	CppUnit_addTest(pSuite, FileTest, testRename);

	return pSuite;
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩欧美中文字幕精品| 国产精品欧美久久久久一区二区| 亚洲最大成人网4388xx| 欧美一级二级三级蜜桃| 国产伦精品一区二区三区免费| 日韩精品一区二区三区四区| 成人av网址在线| 亚洲高清一区二区三区| 一区二区高清视频在线观看| 91在线丨porny丨国产| 成人动漫在线一区| 国内精品写真在线观看| 成人欧美一区二区三区小说| 日韩一级二级三级| 欧美少妇性性性| 97成人超碰视| 国产成人午夜精品5599| 久99久精品视频免费观看| 亚洲成人午夜影院| 一区二区三区在线视频观看| 日本一区二区视频在线观看| 亚洲精品一区二区三区在线观看| 欧美专区日韩专区| 99久久综合狠狠综合久久| 精品一区二区三区香蕉蜜桃| 视频在线观看91| 国产精品美女久久久久久2018| 日韩一区二区三区四区| 欧美精品国产精品| 欧美日韩不卡在线| 欧美日韩高清影院| 欧美一区二区三区四区五区 | 国产精品欧美精品| 亚洲色图自拍偷拍美腿丝袜制服诱惑麻豆 | 精品三级av在线| 精品免费日韩av| 国产精品污污网站在线观看| 日韩视频免费观看高清完整版 | 538在线一区二区精品国产| 欧美日本乱大交xxxxx| 6080日韩午夜伦伦午夜伦| 91麻豆精品国产综合久久久久久| 欧美日韩国产大片| 日韩一区二区三区四区| 国产精品人人做人人爽人人添| 中文av字幕一区| 一区二区三区高清| 久久国产精品区| 成人夜色视频网站在线观看| 欧美在线一二三四区| 欧美成人一级视频| 午夜电影网一区| 99久久99久久精品国产片果冻 | 26uuu国产一区二区三区| 国产精品久久久久精k8| 日韩国产在线观看一区| 97aⅴ精品视频一二三区| 国产欧美日韩在线看| 日本色综合中文字幕| 欧美视频一区二区| 一区二区三区精品久久久| 成人免费视频免费观看| 国产午夜精品理论片a级大结局| 丝袜国产日韩另类美女| 欧美日韩美少妇| 午夜视频一区二区| 欧美久久婷婷综合色| 亚洲成人免费看| 欧美老人xxxx18| 亚洲午夜av在线| 91麻豆精品国产自产在线| 一区二区三区四区亚洲| 色综合久久综合网欧美综合网| 亚洲日本在线看| 91久久国产最好的精华液| 亚洲精品国产精品乱码不99| 色婷婷亚洲综合| 午夜激情一区二区三区| 欧美精三区欧美精三区| 麻豆精品一区二区av白丝在线| 精品国产一区久久| 成人av资源网站| 亚洲成人资源网| 久久久久久久久一| 一本色道久久综合精品竹菊| 视频一区二区不卡| 精品国产3级a| 在线视频中文字幕一区二区| 天堂蜜桃一区二区三区 | 精品国产凹凸成av人导航| 国产乱一区二区| 亚洲国产精品人人做人人爽| 欧美性猛片xxxx免费看久爱| 九九久久精品视频| 亚洲精品视频观看| 久久精品这里都是精品| 99久久99久久免费精品蜜臀| 免费一级片91| 亚洲国产精品一区二区www| 精品国产乱码久久久久久图片 | 欧洲av一区二区嗯嗯嗯啊| 国产一区二区三区综合| 亚洲高清免费观看高清完整版在线观看| 7777精品久久久大香线蕉| 色综合久久久久久久久久久| 国产精品一二三区| 亚洲午夜精品在线| 亚洲精品免费电影| 国产精品久久久一本精品| 91精品国产综合久久福利软件| 国产剧情在线观看一区二区 | 亚洲午夜在线视频| 国产精品国产三级国产aⅴ中文| 精品少妇一区二区三区日产乱码| 在线影视一区二区三区| 色女孩综合影院| 色综合久久88色综合天天免费| 成人综合日日夜夜| 成人午夜电影小说| 成人av一区二区三区| 成人动漫一区二区在线| 成人v精品蜜桃久久一区| 成人免费视频网站在线观看| 国产不卡视频在线播放| 国产suv精品一区二区三区| 成人免费毛片片v| 99视频超级精品| 欧美日韩精品欧美日韩精品一综合| 在线看不卡av| 欧美肥妇bbw| 久久亚洲春色中文字幕久久久| 2024国产精品| 亚洲欧美乱综合| 三级不卡在线观看| 国产精品影视在线| 大美女一区二区三区| 色94色欧美sute亚洲线路一久 | 一区二区三区中文在线观看| 中文字幕中文字幕在线一区| 亚洲人快播电影网| 亚洲地区一二三色| 国产精品一级黄| 国产成人av一区| 欧美日韩精品一区二区三区四区| 欧美一区二区网站| 国产日韩v精品一区二区| 亚洲精品久久久蜜桃| 日本不卡一区二区| 成人午夜激情视频| 欧美久久婷婷综合色| 国产日韩欧美精品在线| 亚洲一区二区三区免费视频| 麻豆91在线观看| 91麻豆高清视频| 精品少妇一区二区三区在线视频| 亚洲欧美一区二区三区极速播放| 丝袜美腿高跟呻吟高潮一区| 成人国产电影网| 欧美精品一区二区三区在线| 亚洲女女做受ⅹxx高潮| 国产露脸91国语对白| 7777精品伊人久久久大香线蕉最新版 | 日韩美一区二区三区| 亚洲一卡二卡三卡四卡| 成人国产精品免费网站| 久久综合色播五月| 日韩电影在线免费观看| 91精彩视频在线观看| 国产亚洲视频系列| 另类调教123区 | 在线观看精品一区| 亚洲欧美色图小说| eeuss鲁片一区二区三区在线看| 欧美r级在线观看| 九九**精品视频免费播放| 欧美精品色综合| 婷婷六月综合亚洲| 欧美乱妇20p| 九九在线精品视频| 精品第一国产综合精品aⅴ| 久久不见久久见中文字幕免费| 欧美成人性战久久| 麻豆精品新av中文字幕| 久久久亚洲午夜电影| 久久99热这里只有精品| 久久九九99视频| 丁香一区二区三区| 亚洲三级小视频| 欧美色精品在线视频| 亚洲午夜在线视频| 日韩色在线观看| 国产精品一区二区x88av| 国产精品视频一二三区| 在线观看一区不卡| 日韩精品免费视频人成| 精品国产一区二区三区四区四| 国产98色在线|日韩| 五月天激情综合网| 久久综合色鬼综合色| 91在线你懂得|