// file : qt/common/smart-ptr/driver.cxx // author : Constantin Michael // copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC // license : GNU GPL v2; see accompanying LICENSE file // Test Qt smart pointers. // #include // std::auto_ptr #include #include #include #include #include #include "test.hxx" #include "test-odb.hxx" using namespace std; using namespace odb::core; int main (int argc, char* argv[]) { try { auto_ptr db (create_database (argc, argv)); QSharedPointer c1 (new cont (1)); // Test comparison operators. // { assert (QLazySharedPointer () == QLazySharedPointer ()); assert (QLazySharedPointer () != QLazySharedPointer (c1)); assert (QLazySharedPointer (c1) == QLazySharedPointer (c1)); QLazySharedPointer lc1 (*db, 1); assert (lc1 != QLazySharedPointer ()); assert (lc1 == QLazySharedPointer (*db, c1)); QSharedPointer c2 (new cont (2)); assert (lc1 != QLazySharedPointer (*db, c2)); } } catch (const odb::exception& e) { cerr << e.what () << endl; return 1; } }