diff PostgreSQL/UnitTests/UnitTestsMain.cpp @ 14:9774802fd05f

PostgreSQLStorageArea working
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 09 Jul 2018 20:28:27 +0200
parents 7cea966b6829
children 714c5d2bee76
line wrap: on
line diff
--- a/PostgreSQL/UnitTests/UnitTestsMain.cpp	Mon Jul 09 18:42:34 2018 +0200
+++ b/PostgreSQL/UnitTests/UnitTestsMain.cpp	Mon Jul 09 20:28:27 2018 +0200
@@ -29,6 +29,16 @@
 #include "../../Framework/Plugins/IndexUnitTests.h"
 
 
+#if ORTHANC_POSTGRESQL_STATIC == 1
+#  include <c.h>  // PostgreSQL includes
+
+TEST(PostgreSQL, Version)
+{
+  ASSERT_STREQ("9.6.1", PG_VERSION);
+}
+#endif
+
+
 TEST(PostgreSQLParameters, Basic)
 {
   OrthancDatabases::PostgreSQLParameters p;
@@ -96,51 +106,6 @@
 }
 
 
-#if 0
-TEST(PostgreSQL, StorageArea)
-{
-  std::auto_ptr<PostgreSQLDatabase> pg(CreateTestDatabase(true));
-  PostgreSQLStorageArea s(pg.release(), true, true);
-
-  ASSERT_EQ(0, CountLargeObjects(s.GetDatabase()));
-  
-  for (int i = 0; i < 10; i++)
-  {
-    std::string uuid = boost::lexical_cast<std::string>(i);
-    std::string value = "Value " + boost::lexical_cast<std::string>(i * 2);
-    s.Create(uuid, value.c_str(), value.size(), OrthancPluginContentType_Unknown);
-  }
-
-  std::string tmp;
-  ASSERT_THROW(s.Read(tmp, "nope", OrthancPluginContentType_Unknown), Orthanc::OrthancException);
-  
-  ASSERT_EQ(10, CountLargeObjects(s.GetDatabase()));
-  s.Remove("5", OrthancPluginContentType_Unknown);
-  ASSERT_EQ(9, CountLargeObjects(s.GetDatabase()));
-
-  for (int i = 0; i < 10; i++)
-  {
-    std::string uuid = boost::lexical_cast<std::string>(i);
-    std::string expected = "Value " + boost::lexical_cast<std::string>(i * 2);
-    std::string content;
-
-    if (i == 5)
-    {
-      ASSERT_THROW(s.Read(content, uuid, OrthancPluginContentType_Unknown), Orthanc::OrthancException);
-    }
-    else
-    {
-      s.Read(content, uuid, OrthancPluginContentType_Unknown);
-      ASSERT_EQ(expected, content);
-    }
-  }
-
-  s.Clear();
-  ASSERT_EQ(0, CountLargeObjects(s.GetDatabase()));
-}
-#endif
-
-
 int main(int argc, char **argv)
 {
   if (argc < 6)