mirror of
https://github.com/cuberite/SQLiteCpp.git
synced 2025-08-05 02:06:02 -04:00
using assert() in example program to provide a basic test coverage
This commit is contained in:
parent
56aa208f62
commit
0ffa0b8f0c
2
TODO.txt
2
TODO.txt
@ -6,8 +6,6 @@ Adding an encapsulation to the statement ref counter
|
|||||||
|
|
||||||
=> V0.5.0
|
=> V0.5.0
|
||||||
|
|
||||||
using assert() in example program to provide a basic test coverage
|
|
||||||
|
|
||||||
Missing features in v0.4.0:
|
Missing features in v0.4.0:
|
||||||
- Blob
|
- Blob
|
||||||
- getColumnByName ? std::map getRow() ?
|
- getColumnByName ? std::map getRow() ?
|
||||||
|
@ -107,6 +107,7 @@ int main (void)
|
|||||||
catch (std::exception& e)
|
catch (std::exception& e)
|
||||||
{
|
{
|
||||||
std::cout << "SQLite exception: " << e.what() << std::endl;
|
std::cout << "SQLite exception: " << e.what() << std::endl;
|
||||||
|
abort(); // unexpected error : abort the example program
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
@ -124,6 +125,7 @@ int main (void)
|
|||||||
catch (std::exception& e)
|
catch (std::exception& e)
|
||||||
{
|
{
|
||||||
std::cout << "SQLite exception: " << e.what() << std::endl;
|
std::cout << "SQLite exception: " << e.what() << std::endl;
|
||||||
|
abort(); // unexpected error : abort the example program
|
||||||
}
|
}
|
||||||
|
|
||||||
// The execAndGet wrapper example (3/5) :
|
// The execAndGet wrapper example (3/5) :
|
||||||
@ -142,6 +144,7 @@ int main (void)
|
|||||||
catch (std::exception& e)
|
catch (std::exception& e)
|
||||||
{
|
{
|
||||||
std::cout << "SQLite exception: " << e.what() << std::endl;
|
std::cout << "SQLite exception: " << e.what() << std::endl;
|
||||||
|
abort(); // unexpected error : abort the example program
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
@ -181,6 +184,7 @@ int main (void)
|
|||||||
catch (std::exception& e)
|
catch (std::exception& e)
|
||||||
{
|
{
|
||||||
std::cout << "SQLite exception: " << e.what() << std::endl;
|
std::cout << "SQLite exception: " << e.what() << std::endl;
|
||||||
|
abort(); // unexpected error : abort the example program
|
||||||
}
|
}
|
||||||
remove("test.db3");
|
remove("test.db3");
|
||||||
|
|
||||||
@ -211,6 +215,7 @@ int main (void)
|
|||||||
catch (std::exception& e)
|
catch (std::exception& e)
|
||||||
{
|
{
|
||||||
std::cout << "SQLite exception: " << e.what() << std::endl;
|
std::cout << "SQLite exception: " << e.what() << std::endl;
|
||||||
|
abort(); // unexpected error : abort the example program
|
||||||
}
|
}
|
||||||
|
|
||||||
// Exemple of a rollbacked transaction :
|
// Exemple of a rollbacked transaction :
|
||||||
@ -225,12 +230,15 @@ int main (void)
|
|||||||
nb = db.exec("INSERT INTO test ObviousError");
|
nb = db.exec("INSERT INTO test ObviousError");
|
||||||
std::cout << "INSERT INTO test \"error\", returned " << nb << std::endl;
|
std::cout << "INSERT INTO test \"error\", returned " << nb << std::endl;
|
||||||
|
|
||||||
|
abort(); // unexpected success : abort the example program
|
||||||
|
|
||||||
// Commit transaction
|
// Commit transaction
|
||||||
transaction.commit();
|
transaction.commit();
|
||||||
}
|
}
|
||||||
catch (std::exception& e)
|
catch (std::exception& e)
|
||||||
{
|
{
|
||||||
std::cout << "SQLite exception: " << e.what() << std::endl;
|
std::cout << "SQLite exception: " << e.what() << std::endl;
|
||||||
|
// expected error, see above
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check the results (expect only one row of result, as the second one has been rollbacked by the error)
|
// Check the results (expect only one row of result, as the second one has been rollbacked by the error)
|
||||||
@ -244,6 +252,7 @@ int main (void)
|
|||||||
catch (std::exception& e)
|
catch (std::exception& e)
|
||||||
{
|
{
|
||||||
std::cout << "SQLite exception: " << e.what() << std::endl;
|
std::cout << "SQLite exception: " << e.what() << std::endl;
|
||||||
|
abort(); // unexpected error : abort the example program
|
||||||
}
|
}
|
||||||
remove("transaction.db3");
|
remove("transaction.db3");
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user