changeset 288:6d4d413a8797

unit test for large properties
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 28 Jun 2021 15:34:49 +0200
parents 772fa76cddf8
children 0868500060f3
files Framework/Plugins/IndexUnitTests.h
diffstat 1 files changed, 17 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/Framework/Plugins/IndexUnitTests.h	Mon Jun 28 15:04:23 2021 +0200
+++ b/Framework/Plugins/IndexUnitTests.h	Mon Jun 28 15:34:49 2021 +0200
@@ -522,5 +522,22 @@
   ASSERT_TRUE(db.SelectPatientToRecycle(r, *manager, p3));
   ASSERT_EQ(p1, r);
 
+  {
+    // Test creating a large property of 16MB
+    // https://groups.google.com/g/orthanc-users/c/1Y3nTBdr0uE/m/K7PA5pboAgAJ
+    std::string longProperty;
+    longProperty.resize(16 * 1024 * 1024);
+    for (size_t i = 0; i < longProperty.size(); i++)
+    {
+      longProperty[i] = 'A' + (i % 26);
+    }
+
+    db.SetGlobalProperty(*manager, MISSING_SERVER_IDENTIFIER, Orthanc::GlobalProperty_DatabaseInternal8, longProperty.c_str());
+
+    std::string tmp;
+    ASSERT_TRUE(db.LookupGlobalProperty(tmp, *manager, MISSING_SERVER_IDENTIFIER, Orthanc::GlobalProperty_DatabaseInternal8));
+    ASSERT_EQ(longProperty, tmp);
+  }
+
   manager->Close();
 }