comparison UnitTestsSources/SQLiteChromiumTests.cpp @ 2655:c196d76cb8fa jobs

serialization
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 05 Jun 2018 17:57:49 +0200
parents 878b59270859
children 22524fd06225
comparison
equal deleted inserted replaced
2654:761031029aa9 2655:c196d76cb8fa
49 /******************************************************************** 49 /********************************************************************
50 ** Tests from 50 ** Tests from
51 ** http://src.chromium.org/viewvc/chrome/trunk/src/sql/connection_unittest.cc 51 ** http://src.chromium.org/viewvc/chrome/trunk/src/sql/connection_unittest.cc
52 ********************************************************************/ 52 ********************************************************************/
53 53
54 class SQLConnectionTest : public testing::Test 54 namespace
55 { 55 {
56 public: 56 class SQLConnectionTest : public testing::Test
57 SQLConnectionTest() 57 {
58 { 58 public:
59 } 59 SQLConnectionTest()
60 60 {
61 virtual ~SQLConnectionTest() 61 }
62 { 62
63 } 63 virtual ~SQLConnectionTest()
64 64 {
65 virtual void SetUp() 65 }
66 { 66
67 db_.OpenInMemory(); 67 virtual void SetUp()
68 } 68 {
69 69 db_.OpenInMemory();
70 virtual void TearDown() 70 }
71 { 71
72 db_.Close(); 72 virtual void TearDown()
73 } 73 {
74 74 db_.Close();
75 Connection& db() 75 }
76 { 76
77 return db_; 77 Connection& db()
78 } 78 {
79 79 return db_;
80 private: 80 }
81 Connection db_; 81
82 }; 82 private:
83 Connection db_;
84 };
85 }
83 86
84 87
85 88
86 TEST_F(SQLConnectionTest, Execute) 89 TEST_F(SQLConnectionTest, Execute)
87 { 90 {
264 /******************************************************************** 267 /********************************************************************
265 ** Tests from 268 ** Tests from
266 ** http://src.chromium.org/viewvc/chrome/trunk/src/sql/transaction_unittest.cc 269 ** http://src.chromium.org/viewvc/chrome/trunk/src/sql/transaction_unittest.cc
267 ********************************************************************/ 270 ********************************************************************/
268 271
269 class SQLTransactionTest : public SQLConnectionTest 272 namespace
270 { 273 {
271 public: 274 class SQLTransactionTest : public SQLConnectionTest
272 virtual void SetUp() 275 {
273 { 276 public:
274 SQLConnectionTest::SetUp(); 277 virtual void SetUp()
275 ASSERT_TRUE(db().Execute("CREATE TABLE foo (a, b)")); 278 {
276 } 279 SQLConnectionTest::SetUp();
277 280 ASSERT_TRUE(db().Execute("CREATE TABLE foo (a, b)"));
278 // Returns the number of rows in table "foo". 281 }
279 int CountFoo() 282
280 { 283 // Returns the number of rows in table "foo".
281 Statement count(db(), "SELECT count(*) FROM foo"); 284 int CountFoo()
282 count.Step(); 285 {
283 return count.ColumnInt(0); 286 Statement count(db(), "SELECT count(*) FROM foo");
284 } 287 count.Step();
285 }; 288 return count.ColumnInt(0);
289 }
290 };
291 }
286 292
287 293
288 TEST_F(SQLTransactionTest, Commit) { 294 TEST_F(SQLTransactionTest, Commit) {
289 { 295 {
290 Transaction t(db()); 296 Transaction t(db());