Mercurial > hg > orthanc
comparison UnitTests/SQLiteChromium.cpp @ 63:f1d0470ff334 orthanc-renaming
renaming unittests
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Sun, 16 Sep 2012 09:33:55 +0200 |
parents | a15e90e5d6fc |
children | f333c0398f6e |
comparison
equal
deleted
inserted
replaced
62:a70bb32802ae | 63:f1d0470ff334 |
---|---|
5 #include "../Core/SQLite/Statement.h" | 5 #include "../Core/SQLite/Statement.h" |
6 #include "../Core/SQLite/Transaction.h" | 6 #include "../Core/SQLite/Transaction.h" |
7 | 7 |
8 #include <sqlite3.h> | 8 #include <sqlite3.h> |
9 | 9 |
10 using namespace Palanthir; | 10 using namespace Orthanc; |
11 | 11 |
12 | 12 |
13 | 13 |
14 /******************************************************************** | 14 /******************************************************************** |
15 ** Tests from | 15 ** Tests from |
190 // Insert in the foo table the primary key. It is an error to insert | 190 // Insert in the foo table the primary key. It is an error to insert |
191 // something other than an number. This error causes the error callback | 191 // something other than an number. This error causes the error callback |
192 // handler to be called with SQLITE_MISMATCH as error code. | 192 // handler to be called with SQLITE_MISMATCH as error code. |
193 SQLite::Statement s(db(), "INSERT INTO foo (a) VALUES (?)"); | 193 SQLite::Statement s(db(), "INSERT INTO foo (a) VALUES (?)"); |
194 s.BindCString(0, "bad bad"); | 194 s.BindCString(0, "bad bad"); |
195 EXPECT_THROW(s.Run(), PalanthirException); | 195 EXPECT_THROW(s.Run(), OrthancException); |
196 } | 196 } |
197 | 197 |
198 TEST_F(SQLStatementTest, Reset) { | 198 TEST_F(SQLStatementTest, Reset) { |
199 ASSERT_TRUE(db().Execute("CREATE TABLE foo (a, b)")); | 199 ASSERT_TRUE(db().Execute("CREATE TABLE foo (a, b)")); |
200 ASSERT_TRUE(db().Execute("INSERT INTO foo (a, b) VALUES (3, 12)")); | 200 ASSERT_TRUE(db().Execute("INSERT INTO foo (a, b) VALUES (3, 12)")); |
328 // A third inner one will fail in Begin since one has already been rolled | 328 // A third inner one will fail in Begin since one has already been rolled |
329 // back. | 329 // back. |
330 EXPECT_EQ(1, db().GetTransactionNesting()); | 330 EXPECT_EQ(1, db().GetTransactionNesting()); |
331 { | 331 { |
332 SQLite::Transaction inner3(db()); | 332 SQLite::Transaction inner3(db()); |
333 EXPECT_THROW(inner3.Begin(), PalanthirException); | 333 EXPECT_THROW(inner3.Begin(), OrthancException); |
334 EXPECT_EQ(1, db().GetTransactionNesting()); | 334 EXPECT_EQ(1, db().GetTransactionNesting()); |
335 } | 335 } |
336 } | 336 } |
337 EXPECT_EQ(0, db().GetTransactionNesting()); | 337 EXPECT_EQ(0, db().GetTransactionNesting()); |
338 EXPECT_EQ(0, CountFoo()); | 338 EXPECT_EQ(0, CountFoo()); |