mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-28 03:20:11 +01:00
Poco 1.9.1 assert true (#2255)
* Rename assert by assertTrue * Update submodules * Missing assertTrue * Rename poco_assertTrue to poco_assert * Rename poco_assertTrue to poco_assert
This commit is contained in:
committed by
Aleksandar Fabijanic
parent
5a1bf5eb4a
commit
960ecb38f0
@@ -41,7 +41,7 @@ FileTest::~FileTest()
|
||||
void FileTest::testFileAttributes1()
|
||||
{
|
||||
File f("testfile.dat");
|
||||
assert (!f.exists());
|
||||
assertTrue (!f.exists());
|
||||
|
||||
try
|
||||
{
|
||||
@@ -185,10 +185,10 @@ void FileTest::testCreateFile()
|
||||
{
|
||||
File f("testfile.dat");
|
||||
bool created = f.createFile();
|
||||
assert (created);
|
||||
assert (!f.isHidden());
|
||||
assertTrue (created);
|
||||
assertTrue (!f.isHidden());
|
||||
created = f.createFile();
|
||||
assert (!created);
|
||||
assertTrue (!created);
|
||||
}
|
||||
|
||||
|
||||
@@ -197,29 +197,29 @@ void FileTest::testFileAttributes2()
|
||||
TemporaryFile f;
|
||||
bool created = f.createFile();
|
||||
Timestamp ts;
|
||||
assert (created);
|
||||
assertTrue (created);
|
||||
|
||||
assert (f.exists());
|
||||
assert (f.canRead());
|
||||
assert (f.canWrite());
|
||||
assert (f.isFile());
|
||||
assert (!f.isDirectory());
|
||||
assertTrue (f.exists());
|
||||
assertTrue (f.canRead());
|
||||
assertTrue (f.canWrite());
|
||||
assertTrue (f.isFile());
|
||||
assertTrue (!f.isDirectory());
|
||||
Timestamp tsc = f.created();
|
||||
Timestamp tsm = f.getLastModified();
|
||||
assert (tsc - ts >= -2000000 && tsc - ts <= 2000000);
|
||||
assert (tsm - ts >= -2000000 && tsm - ts <= 2000000);
|
||||
assertTrue (tsc - ts >= -2000000 && tsc - ts <= 2000000);
|
||||
assertTrue (tsm - ts >= -2000000 && tsm - ts <= 2000000);
|
||||
|
||||
f.setWriteable(false);
|
||||
assert (!f.canWrite());
|
||||
assert (f.canRead());
|
||||
assertTrue (!f.canWrite());
|
||||
assertTrue (f.canRead());
|
||||
|
||||
f.setReadOnly(false);
|
||||
assert (f.canWrite());
|
||||
assert (f.canRead());
|
||||
assertTrue (f.canWrite());
|
||||
assertTrue (f.canRead());
|
||||
|
||||
ts = Timestamp::fromEpochTime(1000000);
|
||||
f.setLastModified(ts);
|
||||
assert (f.getLastModified() == ts);
|
||||
assertTrue (f.getLastModified() == ts);
|
||||
}
|
||||
|
||||
|
||||
@@ -236,9 +236,9 @@ void FileTest::testFileAttributes3()
|
||||
#endif
|
||||
|
||||
#if !defined(_WIN32_WCE)
|
||||
assert (f.isDevice());
|
||||
assert (!f.isFile());
|
||||
assert (!f.isDirectory());
|
||||
assertTrue (f.isDevice());
|
||||
assertTrue (!f.isFile());
|
||||
assertTrue (!f.isDirectory());
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -249,22 +249,22 @@ void FileTest::testCompare()
|
||||
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));
|
||||
assertTrue (f1 == f3);
|
||||
assertTrue (!(f1 == f2));
|
||||
assertTrue (f1 != f2);
|
||||
assertTrue (!(f1 != f3));
|
||||
assertTrue (!(f1 == f2));
|
||||
assertTrue (f1 < f2);
|
||||
assertTrue (f1 <= f2);
|
||||
assertTrue (!(f2 < f1));
|
||||
assertTrue (!(f2 <= f1));
|
||||
assertTrue (f2 > f1);
|
||||
assertTrue (f2 >= f1);
|
||||
assertTrue (!(f1 > f2));
|
||||
assertTrue (!(f1 >= f2));
|
||||
|
||||
assert (f1 <= f3);
|
||||
assert (f1 >= f3);
|
||||
assertTrue (f1 <= f3);
|
||||
assertTrue (f1 >= f3);
|
||||
}
|
||||
|
||||
|
||||
@@ -274,21 +274,21 @@ void FileTest::testRootDir()
|
||||
#if defined(_WIN32_WCE)
|
||||
File f1("\\");
|
||||
File f2("/");
|
||||
assert (f1.exists());
|
||||
assert (f2.exists());
|
||||
assertTrue (f1.exists());
|
||||
assertTrue (f2.exists());
|
||||
#else
|
||||
File f1("/");
|
||||
File f2("c:/");
|
||||
File f3("c:\\");
|
||||
File f4("\\");
|
||||
assert (f1.exists());
|
||||
assert (f2.exists());
|
||||
assert (f3.exists());
|
||||
assert (f4.exists());
|
||||
assertTrue (f1.exists());
|
||||
assertTrue (f2.exists());
|
||||
assertTrue (f3.exists());
|
||||
assertTrue (f4.exists());
|
||||
#endif
|
||||
#else
|
||||
File f1("/");
|
||||
assert (f1.exists());
|
||||
assertTrue (f1.exists());
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -298,8 +298,8 @@ void FileTest::testSwap()
|
||||
File f1("abc.txt");
|
||||
File f2("def.txt");
|
||||
f1.swap(f2);
|
||||
assert (f1.path() == "def.txt");
|
||||
assert (f2.path() == "abc.txt");
|
||||
assertTrue (f1.path() == "def.txt");
|
||||
assertTrue (f2.path() == "abc.txt");
|
||||
}
|
||||
|
||||
|
||||
@@ -309,9 +309,9 @@ void FileTest::testSize()
|
||||
ostr << "Hello, world!" << std::endl;
|
||||
ostr.close();
|
||||
File f("testfile.dat");
|
||||
assert (f.getSize() > 0);
|
||||
assertTrue (f.getSize() > 0);
|
||||
f.setSize(0);
|
||||
assert (f.getSize() == 0);
|
||||
assertTrue (f.getSize() == 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -328,12 +328,12 @@ void FileTest::testDirectory()
|
||||
TemporaryFile::registerForDeletion("testdir");
|
||||
|
||||
bool created = d.createDirectory();
|
||||
assert (created);
|
||||
assert (d.isDirectory());
|
||||
assert (!d.isFile());
|
||||
assertTrue (created);
|
||||
assertTrue (d.isDirectory());
|
||||
assertTrue (!d.isFile());
|
||||
std::vector<std::string> files;
|
||||
d.list(files);
|
||||
assert (files.empty());
|
||||
assertTrue (files.empty());
|
||||
|
||||
File f = Path("testdir/file1", Path::PATH_UNIX);
|
||||
f.createFile();
|
||||
@@ -343,23 +343,23 @@ void FileTest::testDirectory()
|
||||
f.createFile();
|
||||
|
||||
d.list(files);
|
||||
assert (files.size() == 3);
|
||||
assertTrue (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());
|
||||
assertTrue (fs.find("file1") != fs.end());
|
||||
assertTrue (fs.find("file2") != fs.end());
|
||||
assertTrue (fs.find("file3") != fs.end());
|
||||
|
||||
File dd(Path("testdir/testdir2/testdir3", Path::PATH_UNIX));
|
||||
dd.createDirectories();
|
||||
assert (dd.exists());
|
||||
assert (dd.isDirectory());
|
||||
assertTrue (dd.exists());
|
||||
assertTrue (dd.isDirectory());
|
||||
|
||||
File ddd(Path("testdir/testdirB/testdirC/testdirD", Path::PATH_UNIX));
|
||||
ddd.createDirectories();
|
||||
assert (ddd.exists());
|
||||
assert (ddd.isDirectory());
|
||||
assertTrue (ddd.exists());
|
||||
assertTrue (ddd.isDirectory());
|
||||
|
||||
d.remove(true);
|
||||
}
|
||||
@@ -374,9 +374,9 @@ void FileTest::testCopy()
|
||||
File f1("testfile.dat");
|
||||
TemporaryFile f2;
|
||||
f1.setReadOnly().copyTo(f2.path());
|
||||
assert (f2.exists());
|
||||
assert (!f2.canWrite());
|
||||
assert (f1.getSize() == f2.getSize());
|
||||
assertTrue (f2.exists());
|
||||
assertTrue (!f2.canWrite());
|
||||
assertTrue (f1.getSize() == f2.getSize());
|
||||
f1.setWriteable().remove();
|
||||
}
|
||||
|
||||
@@ -391,10 +391,10 @@ void FileTest::testMove()
|
||||
File::FileSize sz = f1.getSize();
|
||||
TemporaryFile f2;
|
||||
f1.moveTo(f2.path());
|
||||
assert (f2.exists());
|
||||
assert (f2.getSize() == sz);
|
||||
assert (f1.exists());
|
||||
assert (f1 == f2);
|
||||
assertTrue (f2.exists());
|
||||
assertTrue (f2.getSize() == sz);
|
||||
assertTrue (f1.exists());
|
||||
assertTrue (f1 == f2);
|
||||
}
|
||||
|
||||
|
||||
@@ -440,28 +440,28 @@ void FileTest::testCopyDirectory()
|
||||
|
||||
Path pd1t("testdir2");
|
||||
File fd1t(pd1t);
|
||||
assert (fd1t.exists());
|
||||
assert (fd1t.isDirectory());
|
||||
assertTrue (fd1t.exists());
|
||||
assertTrue (fd1t.isDirectory());
|
||||
|
||||
Path pd2t(pd1t, "subdir");
|
||||
File fd2t(pd2t);
|
||||
assert (fd2t.exists());
|
||||
assert (fd2t.isDirectory());
|
||||
assertTrue (fd2t.exists());
|
||||
assertTrue (fd2t.isDirectory());
|
||||
|
||||
Path pf1t(pd1t, "testfile1.dat");
|
||||
File ff1t(pf1t);
|
||||
assert (ff1t.exists());
|
||||
assert (ff1t.isFile());
|
||||
assertTrue (ff1t.exists());
|
||||
assertTrue (ff1t.isFile());
|
||||
|
||||
Path pf2t(pd1t, "testfile2.dat");
|
||||
File ff2t(pf2t);
|
||||
assert (ff2t.exists());
|
||||
assert (ff2t.isFile());
|
||||
assertTrue (ff2t.exists());
|
||||
assertTrue (ff2t.isFile());
|
||||
|
||||
Path pf3t(pd2t, "testfile3.dat");
|
||||
File ff3t(pf3t);
|
||||
assert (ff3t.exists());
|
||||
assert (ff3t.isFile());
|
||||
assertTrue (ff3t.exists());
|
||||
assertTrue (ff3t.isFile());
|
||||
|
||||
fd1.remove(true);
|
||||
fd3.remove(true);
|
||||
@@ -478,9 +478,9 @@ void FileTest::testRename()
|
||||
File f2("testfile2.dat");
|
||||
f1.renameTo(f2.path());
|
||||
|
||||
assert (f2.exists());
|
||||
assert (f1.exists());
|
||||
assert (f1 == f2);
|
||||
assertTrue (f2.exists());
|
||||
assertTrue (f1.exists());
|
||||
assertTrue (f1 == f2);
|
||||
|
||||
f2.remove();
|
||||
}
|
||||
@@ -501,8 +501,8 @@ void FileTest::testLongPath()
|
||||
Poco::File d(longpath);
|
||||
d.createDirectories();
|
||||
|
||||
assert (d.exists());
|
||||
assert (d.isDirectory());
|
||||
assertTrue (d.exists());
|
||||
assertTrue (d.isDirectory());
|
||||
|
||||
Poco::File f(p.toString());
|
||||
f.remove(true);
|
||||
|
||||
Reference in New Issue
Block a user