From: JINMEI Tatuya Date: Thu, 25 Aug 2011 20:16:09 +0000 (-0700) Subject: [master] rename exists() to isReadable() to better represent the intent. X-Git-Tag: perftcpdns_before_epoll~191^2~16 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=255bf5b18e2b0e28a65062e87dc2d1212376bfc2;p=thirdparty%2Fkea.git [master] rename exists() to isReadable() to better represent the intent. also use is_open() instead of != NULL (it's strange that the original code did even compile, but in any case this one should be better in clarity and possibly in portability). okayed on jabber, should be minor enough, directly pushing. --- diff --git a/src/lib/datasrc/tests/sqlite3_accessor_unittest.cc b/src/lib/datasrc/tests/sqlite3_accessor_unittest.cc index c9db3f146f..427ee7167e 100644 --- a/src/lib/datasrc/tests/sqlite3_accessor_unittest.cc +++ b/src/lib/datasrc/tests/sqlite3_accessor_unittest.cc @@ -364,20 +364,19 @@ public: } }; -bool exists(const char* filename) { - std::ifstream f(filename); - return (f != NULL); +bool isReadable(const char* filename) { + return (std::ifstream(filename).is_open()); } TEST_F(SQLite3Create, creationtest) { - ASSERT_FALSE(exists(SQLITE_NEW_DBFILE)); + ASSERT_FALSE(isReadable(SQLITE_NEW_DBFILE)); // Should simply be created SQLite3Accessor accessor(SQLITE_NEW_DBFILE, RRClass::IN()); - ASSERT_TRUE(exists(SQLITE_NEW_DBFILE)); + ASSERT_TRUE(isReadable(SQLITE_NEW_DBFILE)); } TEST_F(SQLite3Create, emptytest) { - ASSERT_FALSE(exists(SQLITE_NEW_DBFILE)); + ASSERT_FALSE(isReadable(SQLITE_NEW_DBFILE)); // open one manualle sqlite3* db; @@ -393,7 +392,7 @@ TEST_F(SQLite3Create, emptytest) { } TEST_F(SQLite3Create, lockedtest) { - ASSERT_FALSE(exists(SQLITE_NEW_DBFILE)); + ASSERT_FALSE(isReadable(SQLITE_NEW_DBFILE)); // open one manually sqlite3* db;