亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
2021国产精品久久精品| 国产精品久久久久久久久晋中| 国产一区二区毛片| 日本亚洲视频在线| 日韩成人免费电影| 亚洲成人自拍一区| 五月天欧美精品| 日本欧美在线观看| 奇米在线7777在线精品| 久久精品国产999大香线蕉| 精品午夜久久福利影院 | 亚洲婷婷在线视频| 日韩一区欧美小说| 一区二区三区**美女毛片| 亚洲精品中文字幕在线观看| 亚洲人成电影网站色mp4| 一区二区三区在线影院| 日韩激情av在线| 国产又黄又大久久| 91丨porny丨首页| 色综合色狠狠天天综合色| 91浏览器打开| 欧美一级生活片| 国产日韩高清在线| 亚洲午夜在线电影| 免费观看30秒视频久久| 高清不卡在线观看av| 欧美性大战久久| 日韩欧美不卡在线观看视频| 欧美国产精品一区| 日韩精品一区第一页| 国产一区二区在线看| 91九色最新地址| 日韩欧美中文字幕精品| 国产精品久久久久影院老司| 五月婷婷激情综合| 成人av午夜影院| 欧美一级淫片007| 亚洲欧洲精品一区二区三区| 日本不卡一区二区三区高清视频| 国产乱色国产精品免费视频| 欧美四级电影在线观看| 国产亚洲精品久| 亚洲免费观看高清在线观看| 韩国成人精品a∨在线观看| 日本韩国一区二区| 久久久精品中文字幕麻豆发布| 综合电影一区二区三区 | 精品欧美一区二区在线观看| 亚洲美女免费视频| 国产成人综合网| 91精品午夜视频| 亚洲日本韩国一区| 国产精品一区二区你懂的| 精品视频一区三区九区| 久久免费偷拍视频| 蜜臀av一区二区| 欧美综合欧美视频| 中文字幕日本不卡| 国产·精品毛片| 久久综合色一综合色88| 舔着乳尖日韩一区| 欧美午夜免费电影| 亚洲免费av观看| 99久久99久久精品免费看蜜桃| 久久综合色综合88| 国产伦精一区二区三区| 精品理论电影在线| 蜜桃av噜噜一区| 91精品国产乱码| 日本亚洲视频在线| 精品欧美黑人一区二区三区| 奇米一区二区三区| 欧美一级专区免费大片| 男人的天堂亚洲一区| 日韩午夜在线观看视频| 麻豆精品在线视频| 亚洲精品一区二区三区蜜桃下载| 久久99精品久久只有精品| 日韩欧美成人一区| 国产伦精品一区二区三区免费| 欧美精品一区二区三区蜜臀 | 国产精品你懂的在线欣赏| 成人一区二区三区中文字幕| 欧美韩国日本不卡| 92精品国产成人观看免费| 一区二区三区国产豹纹内裤在线| 在线视频综合导航| 欧美96一区二区免费视频| 欧美精品一区二区三区在线播放| 国产精品自产自拍| 国产精品成人一区二区艾草 | 欧美成人一区二区| 国产一区二区主播在线| 国产精品家庭影院| 在线观看网站黄不卡| 日本美女一区二区| 国产午夜精品一区二区三区视频| 国产福利不卡视频| 亚洲精选视频免费看| 欧美专区亚洲专区| 欧美bbbbb| 亚洲欧美综合另类在线卡通| 欧美午夜一区二区| 黄色小说综合网站| 亚洲欧美日韩久久| 日韩欧美高清一区| av网站一区二区三区| 日韩精品亚洲专区| 久久九九影视网| 欧美日韩情趣电影| 懂色av一区二区三区蜜臀| 亚洲成在线观看| 国产欧美日韩视频一区二区| 欧美视频在线播放| 国产99久久久久久免费看农村| 一区二区三区在线免费视频| 精品国产91久久久久久久妲己| 91色九色蝌蚪| 国产乱国产乱300精品| 一二三四区精品视频| 欧美国产欧美综合| 538prom精品视频线放| 91免费观看国产| 国产成人免费视频网站| 天天综合色天天| 亚洲精品乱码久久久久久久久 | 日韩精品亚洲专区| 亚洲四区在线观看| 久久久激情视频| 日韩一级高清毛片| 欧美日韩的一区二区| 91社区在线播放| 丰满亚洲少妇av| 国产激情一区二区三区四区| 日韩成人dvd| 午夜欧美电影在线观看| 亚洲精品老司机| 亚洲欧洲精品天堂一级| 国产精品拍天天在线| 国产日韩v精品一区二区| 久久综合色之久久综合| 精品国产污网站| 日韩亚洲欧美综合| 777奇米成人网| 正在播放一区二区| 91精品麻豆日日躁夜夜躁| 欧美视频一区在线| 欧美电影影音先锋| 日韩一二三区不卡| 精品99一区二区| 久久免费美女视频| 久久午夜老司机| 国产精品午夜春色av| 亚洲欧美自拍偷拍| 一区二区三区中文字幕精品精品 | 91精品国产丝袜白色高跟鞋| 欧美吞精做爰啪啪高潮| 欧美日韩国产高清一区二区三区 | 久久精品国产999大香线蕉| 日韩av一级片| 国模一区二区三区白浆| 丁香六月综合激情| www.成人网.com| 91福利视频网站| 欧美午夜不卡视频| 91精品国产91久久综合桃花| 欧美成人精品福利| 欧美国产日韩在线观看| 亚洲美女视频一区| 欧美日韩色一区| 另类欧美日韩国产在线| 蜜桃视频一区二区三区在线观看| 手机精品视频在线观看| 久久精品国产精品亚洲红杏| 成人午夜私人影院| 在线视频你懂得一区| 免费在线看成人av| 欧美亚洲图片小说| 亚洲色图视频网站| 国产a精品视频| 久久精品视频一区二区三区| 麻豆精品在线观看| 欧美一区二区三区在线观看| 亚洲超丰满肉感bbw| 日本精品一区二区三区四区的功能| 久久男人中文字幕资源站| 美女网站色91| 日韩欧美国产一区二区三区| 免费观看一级特黄欧美大片| 制服丝袜亚洲网站| 蜜桃av一区二区三区| 欧美精品久久一区二区三区| 亚洲在线视频免费观看| 日本韩国欧美三级| 亚洲18色成人| 7777精品伊人久久久大香线蕉 | 国产精品白丝jk黑袜喷水| 日韩免费观看2025年上映的电影| 日韩精品成人一区二区三区|