From 1036de93dd8113fca4dc7e9b8d292399f1b20010 Mon Sep 17 00:00:00 2001
From: Daniel <d.hornung@indiscale.com>
Date: Tue, 10 Aug 2021 14:44:12 +0200
Subject: [PATCH] STY: Linting.

---
 src/Caosdb.m                  |  9 ++++---
 src/lib/maoxdb.cpp            | 51 ++++++++++++++++++-----------------
 src/lib/maoxdb.hpp            | 40 +++++++++++++--------------
 src/private/maox_caosdb.cpp   | 22 +++++++--------
 src/private/maox_info.cpp     | 18 +++++--------
 src/private/maox_retrieve.cpp | 28 +++++++------------
 test/Run_Test.m               |  2 +-
 test/test_unittest.m          |  6 ++---
 test/test_utilities.cpp       | 35 ++++++++++++------------
 9 files changed, 97 insertions(+), 114 deletions(-)

diff --git a/src/Caosdb.m b/src/Caosdb.m
index 77d610a..eb13807 100644
--- a/src/Caosdb.m
+++ b/src/Caosdb.m
@@ -80,10 +80,10 @@ classdef Caosdb < handle
     % id: string
     %  The ID of the entity to be retrieved.
     function collection = retrieve(obj, id)
-      assert(ischar(id),
-             "maox:InvalidArgument",
-             "ID must be a string, was:\n%s",
-             disp(id))
+      assert(ischar(id), ...
+             "maox:InvalidArgument", ...
+             "ID must be a string, was:\n%s", ...
+             disp(id));
       disp(["ID (oct): >", id, "<"]);
       try
         collection = maox_retrieve(obj.connection, id);
@@ -95,5 +95,6 @@ classdef Caosdb < handle
         rethrow(lasterror());
       end
     end
+
   end
 end
diff --git a/src/lib/maoxdb.cpp b/src/lib/maoxdb.cpp
index 9416286..da5307e 100644
--- a/src/lib/maoxdb.cpp
+++ b/src/lib/maoxdb.cpp
@@ -43,8 +43,7 @@ auto mxFromCaosDBMessages(const caosdb::entity::Messages &messages) -> mxArray *
 /**
  * Generate a mex error message from a TransactionStatus.
  */
-auto transactionStatusToMessage(
-  const caosdb::transaction::Transaction *const trans)
+auto transactionStatusToMessage(const caosdb::transaction::Transaction *const trans)
   -> std::pair<string, string> {
   auto status = trans->GetStatus();
   auto code = status.GetCode();
@@ -59,8 +58,7 @@ auto transactionStatusToMessage(
 /**
  * Throw an Octave error if the transaction did not finish properly.
  */
-void throwOctExceptionIfError(
-  const caosdb::transaction::Transaction *const trans) {
+void throwOctExceptionIfError(const caosdb::transaction::Transaction *const trans) {
   auto msg = maoxdb::transactionStatusToMessage(trans);
   if (msg.first != "") {
     mexErrMsgIdAndTxt(msg.first.c_str(), msg.second.c_str());
@@ -70,12 +68,10 @@ void throwOctExceptionIfError(
 /**
  * Extract useful strings from an Exception: ID and description.
  */
-auto exceptionToMessage(const caosdb::exceptions::Exception &exc)
-  -> std::pair<string, string> {
+auto exceptionToMessage(const caosdb::exceptions::Exception &exc) -> std::pair<string, string> {
 
   string id = std::to_string(exc.GetCode());
-  string text =
-    caosdb::get_status_description(exc.GetCode()) + "\n" + exc.what();
+  string text = caosdb::get_status_description(exc.GetCode()) + "\n" + exc.what();
 
   return std::pair<string, string>(id, text);
 }
@@ -93,8 +89,7 @@ void throwOctException(const caosdb::exceptions::Exception &exc) {
 /**
  * @brief Convert a ResultSet to a struct mexArray.
  */
-auto mxFromResultSet(const caosdb::transaction::ResultSet &resultSet)
-  -> mxArray * {
+auto mxFromResultSet(const caosdb::transaction::ResultSet &resultSet) -> mxArray * {
   auto resSize = resultSet.Size();
   std::array<mwSize, 2> dims = {1, resSize};
   std::vector<const mxArray *> entities;
@@ -103,7 +98,7 @@ auto mxFromResultSet(const caosdb::transaction::ResultSet &resultSet)
     entities.push_back(mxFromCaosDBEntity(entity));
   }
 
-  auto * result = mxMergeScalarStructs(entities);
+  auto *result = mxMergeScalarStructs(entities);
 
   return result;
 }
@@ -112,6 +107,7 @@ auto mxFromResultSet(const caosdb::transaction::ResultSet &resultSet)
  * @brief Convert an Entity from libcaosdb to Octave struct mexArray.
  */
 auto mxFromCaosDBEntity(const caosdb::entity::Entity &entity) -> mxArray * {
+  // clang-format off
   auto fields = std::vector<const char*>
     {"role",
      "id",
@@ -127,8 +123,9 @@ auto mxFromCaosDBEntity(const caosdb::entity::Entity &entity) -> mxArray * {
      "warnings",
      "infos"
     };
+  // clang-format on
   std::array<mwSize, 2> dims = {1, (mwSize)fields.size()};
-  auto * result = mxCreateStructArray(2, dims.data(), fields.size(), fields.data());
+  auto *result = mxCreateStructArray(2, dims.data(), fields.size(), fields.data());
   // Fill with scalar values
   mxSetField(result, 0, "role", mxCreateString(entity.GetRole().c_str()));
   mxSetField(result, 0, "id", mxCreateString(entity.GetId().c_str()));
@@ -149,32 +146,35 @@ auto mxFromCaosDBEntity(const caosdb::entity::Entity &entity) -> mxArray * {
   mxSetField(result, 0, "warnings", mxFromCaosDBMessages(entity.GetWarnings()));
   mxSetField(result, 0, "infos", mxFromCaosDBMessages(entity.GetInfos()));
 
-
   return result;
 }
 
 // Parents to struct array
 auto mxFromCaosDBParents(const caosdb::entity::Parents &parents) -> mxArray * {
+  // clang-format off
   std::vector<const char*> fields =
     {"id",
      "name",
      "description"
     };
+  // clang-format on
   std::array<mwSize, 2> fieldDims = {1, (mwSize)fields.size()};
   std::array<mwSize, 2> dims = {1, (mwSize)parents.Size()};
-  auto * result = mxCreateStructArray (2, dims.data(), fields.size(), fields.data());
+  auto *result = mxCreateStructArray(2, dims.data(), fields.size(), fields.data());
   for (size_t i = 0; i < parents.Size(); ++i) {
     auto parent = parents.At(i);
     mxSetField(result, i, "id", mxCreateString(parent.GetId().c_str()));
     mxSetField(result, i, "name", mxCreateString(parent.GetName().c_str()));
     // FIXME Add again once upstream is ready.
-    // mxSetField(result, i, "description", mxCreateString(parent.GetDescription().c_str()));
+    // mxSetField(result, i, "description",
+    // mxCreateString(parent.GetDescription().c_str()));
   }
   return result;
 }
 
 // Properties to struct array
 auto mxFromCaosDBProperties(const caosdb::entity::Properties &properties) -> mxArray * {
+  // clang-format off
   std::vector<const char*> fields =
     {"id",
      "name",
@@ -184,9 +184,10 @@ auto mxFromCaosDBProperties(const caosdb::entity::Properties &properties) -> mxA
      "unit",
      "datatype"
     };
+  // clang-format on
   std::array<mwSize, 2> fieldDims = {1, (mwSize)fields.size()};
   std::array<mwSize, 2> dims = {1, (mwSize)properties.Size()};
-  auto * result = mxCreateStructArray (2, dims.data(), fields.size(), fields.data());
+  auto *result = mxCreateStructArray(2, dims.data(), fields.size(), fields.data());
   for (mwIndex i = 0; i < properties.Size(); ++i) {
     auto property = properties.At(i);
     mxSetField(result, i, "id", mxCreateString(property.GetId().c_str()));
@@ -203,13 +204,13 @@ auto mxFromCaosDBProperties(const caosdb::entity::Properties &properties) -> mxA
 
 // Messages to struct array
 auto mxFromCaosDBMessages(const caosdb::entity::Messages &messages) -> mxArray * {
-  std::vector<const char*> fields =
-    {"code",
-     "description"
-    };
+  std::vector<const char *> fields = {
+    "code",       //
+    "description" //
+  };
   std::array<mwSize, 2> fieldDims = {1, (mwSize)fields.size()};
   std::array<mwSize, 2> dims = {1, (mwSize)messages.Size()};
-  auto * result = mxCreateStructArray (2, dims.data(), fields.size(), fields.data());
+  auto *result = mxCreateStructArray(2, dims.data(), fields.size(), fields.data());
   for (mwIndex i = 0; i < messages.Size(); ++i) {
     auto message = messages.At(i);
     mxSetField(result, i, "code", mxScalarINT64(message.GetCode()));
@@ -223,11 +224,11 @@ auto mxFromCaosDBMessages(const caosdb::entity::Messages &messages) -> mxArray *
 /**
  * @brief      Merges a number of scalar mex structs into a 1xN struct.
  */
-auto mxMergeScalarStructs(const std::vector<const mxArray *> &structs) -> mxArray* {
+auto mxMergeScalarStructs(const std::vector<const mxArray *> &structs) -> mxArray * {
 
   // We need the field names first to create a new struct
   auto nFields = (size_t)mxGetNumberOfFields(structs[0]);
-  auto fields = std::vector<const char*>(nFields);
+  auto fields = std::vector<const char *>(nFields);
   for (mwIndex i = 0; i < nFields; ++i) {
     fields[i] = mxGetFieldNameByNumber(structs[0], i);
   }
@@ -236,9 +237,9 @@ auto mxMergeScalarStructs(const std::vector<const mxArray *> &structs) -> mxArra
   auto result = mxCreateStructArray(2, dims.data(), fields.size(), fields.data());
 
   auto i = mwIndex(0) - 1;
-  for (auto scalarStruct: structs) {
+  for (auto scalarStruct : structs) {
     ++i;
-    for (auto field: fields) {
+    for (auto field : fields) {
       mxSetField(result, i, field, mxDuplicateArray(mxGetField(scalarStruct, 0, field)));
     }
   }
diff --git a/src/lib/maoxdb.hpp b/src/lib/maoxdb.hpp
index 5f45335..2e5295d 100644
--- a/src/lib/maoxdb.hpp
+++ b/src/lib/maoxdb.hpp
@@ -1,4 +1,4 @@
-#ifndef MAOXDB_H                // NOLINT
+#ifndef MAOXDB_H // NOLINT
 #define MAOXDB_H
 
 #include "caosdb/exceptions.h"
@@ -14,10 +14,11 @@
  *
  * \b{Data exchange}
  *
- * Exchanging data between the Octave side wrapper and this C++ library is done via Octave struct
- * arrays, each struct corresponds to one CaosDB Entity.
+ * Exchanging data between the Octave side wrapper and this C++ library is done
+ * via Octave struct arrays, each struct corresponds to one CaosDB Entity.
  *
- * The Entity structs have the following structure (not all keys may exist for all roles):
+ * The Entity structs have the following structure (not all keys may exist for
+ * all roles):
  *
  * - role:        One of "RecordType", "Record", "Property"
  * - id
@@ -49,7 +50,6 @@
 
 // Macros /////////////////////////////////////////////////////////////////////
 
-
 // Utility functions //////////////////////////////////////////////////////////
 namespace maoxdb {
 
@@ -84,11 +84,11 @@ inline auto mxEmptyDOUBLE() -> mxArray * {
 /**
  * @brief Convert the string-typed value in an Entity-like object to a mxArray.
  *
- * @details For the existing datatypes, see https://docs.indiscale.com/caosdb-server/specification/Datatype.html
+ * @details For the existing datatypes, see
+ * https://docs.indiscale.com/caosdb-server/specification/Datatype.html
  */
-template <class T>
-auto mxScalarFromStringValue(const T& entity) -> mxArray * {
-  mxArray * result;
+template <class T> auto mxScalarFromStringValue(const T &entity) -> mxArray * {
+  mxArray *result;
   auto dt = entity.GetDatatype();
   auto value = entity.GetValue();
   std::cout << "Datatype/Value: " << dt << ": " << value << std::endl;
@@ -129,8 +129,8 @@ auto mxScalarFromStringValue(const T& entity) -> mxArray * {
 /**
  * @brief      Generate a mex error message from a TransactionStatus.
  *
- * @details    Preprocess the transaction status of a transaction, to create the necessary
- * information for raising an Octave error.
+ * @details    Preprocess the transaction status of a transaction, to create the
+ * necessary information for raising an Octave error.
  *
  * @param      trans
  *  The transaction of which to handle the status.
@@ -139,14 +139,14 @@ auto mxScalarFromStringValue(const T& entity) -> mxArray * {
  *  The message ID and description of any error.  If the transaction status is
  *  SUCCESS, or some kind of "still running", both strings are empty.
  */
-auto
-transactionStatusToMessage(const caosdb::transaction::Transaction *const trans)
+auto transactionStatusToMessage(const caosdb::transaction::Transaction *const trans)
   -> std::pair<string, string>;
 
 /**
  * @brief Throw an Octave error if the transaction did not finish properly.
  *
- * @details On error, this function will leave this C++ context and fall back to Octave.
+ * @details On error, this function will leave this C++ context and fall back to
+ * Octave.
  *
  * @param   trans
  *  The transaction to check.
@@ -168,8 +168,7 @@ void throwOctExceptionIfError(const caosdb::transaction::Transaction *const tran
  * @note Additional utility functions should be easy to implement when the
  * libcaosdb error handling changes.
  */
-auto
-exceptionToMessage(const caosdb::exceptions::Exception &exc) -> std::pair<string, string>;
+auto exceptionToMessage(const caosdb::exceptions::Exception &exc) -> std::pair<string, string>;
 
 /**
  * @brief Throw a CaosDB Exception inside Octave.
@@ -184,7 +183,6 @@ exceptionToMessage(const caosdb::exceptions::Exception &exc) -> std::pair<string
  */
 void throwOctException(const caosdb::exceptions::Exception &exc);
 
-
 // Entity handling ////////////////////////////////////////////////////////////
 
 /**
@@ -197,7 +195,8 @@ auto mxFromResultSet(const caosdb::transaction::ResultSet &resultSet) -> mxArray
 /**
  * @brief Convert an Entity from libcaosdb to Octave struct mexArray.
  *
- * @return A 1x1 struct array whose entry follows the maoxdb Entity convention outlined above.
+ * @return A 1x1 struct array whose entry follows the maoxdb Entity convention
+ * outlined above.
  */
 auto mxFromCaosDBEntity(const caosdb::entity::Entity &entity) -> mxArray *;
 
@@ -206,13 +205,14 @@ auto mxFromCaosDBEntity(const caosdb::entity::Entity &entity) -> mxArray *;
 /**
  * @brief      Merges a number of scalar mex structs into a 1xN struct.
  *
- * @details    The content (the mxArrays behind the input structs values) is duplicated.
+ * @details    The content (the mxArrays behind the input structs values) is
+ * duplicated.
  *
  * @param      structs: Must all have the same fields.
  *
  * @return     A 1xN struct array.
  */
-auto mxMergeScalarStructs(const std::vector<const mxArray *> &structs) -> mxArray*;
+auto mxMergeScalarStructs(const std::vector<const mxArray *> &structs) -> mxArray *;
 
 } // namespace maoxdb
 
diff --git a/src/private/maox_caosdb.cpp b/src/private/maox_caosdb.cpp
index 88d408c..7d1d5eb 100644
--- a/src/private/maox_caosdb.cpp
+++ b/src/private/maox_caosdb.cpp
@@ -17,14 +17,13 @@ void print_usage() {
   mexPrintf("    --help              Print this help and return.\n");
   mexPrintf("    --version           Print the version of OctaveCaosDB and "
             "libcaosdb and return.\n");
-  mexPrintf(
-    "    --test-connection   Test the default connection and return.\n");
+  mexPrintf("    --test-connection   Test the default connection and return.\n");
 };
 
-const std::string FULL_VERSION = std::string(
-  "v0.1 (libcaosdb v" + std::to_string(caosdb::LIBCAOSDB_VERSION_MAJOR) + "." +
-  std::to_string(caosdb::LIBCAOSDB_VERSION_MINOR) + "." +
-  std::to_string(caosdb::LIBCAOSDB_VERSION_PATCH) + ")");
+const std::string FULL_VERSION =
+  std::string("v0.1 (libcaosdb v" + std::to_string(caosdb::LIBCAOSDB_VERSION_MAJOR) + "." +
+              std::to_string(caosdb::LIBCAOSDB_VERSION_MINOR) + "." +
+              std::to_string(caosdb::LIBCAOSDB_VERSION_PATCH) + ")");
 
 auto print_version() -> const char * {
   mexPrintf("Octave caosdb client %s\n\n", FULL_VERSION.c_str());
@@ -33,17 +32,14 @@ auto print_version() -> const char * {
 };
 
 void test_connection() {
-  const auto &connection =
-    caosdb::connection::ConnectionManager::GetDefaultConnection();
+  const auto &connection = caosdb::connection::ConnectionManager::GetDefaultConnection();
   const auto &version_info = connection->GetVersionInfo();
-  mexPrintf("Server Version: v%d.%d.%d-%s-%s\n", version_info->GetMajor(),
-            version_info->GetMinor(), version_info->GetPatch(),
-            version_info->GetPreRelease().c_str(),
+  mexPrintf("Server Version: v%d.%d.%d-%s-%s\n", version_info->GetMajor(), version_info->GetMinor(),
+            version_info->GetPatch(), version_info->GetPreRelease().c_str(),
             version_info->GetBuild().c_str());
 }
 
-void mexFunction(int /*nlhs*/, mxArray *plhs[], int nrhs,
-                 const mxArray *prhs[]) {
+void mexFunction(int /*nlhs*/, mxArray *plhs[], int nrhs, const mxArray *prhs[]) {
 
   if (nrhs == 1) {
     auto const *first_arg = mxArrayToString(prhs[0]);
diff --git a/src/private/maox_info.cpp b/src/private/maox_info.cpp
index 6712d9e..f1f1774 100644
--- a/src/private/maox_info.cpp
+++ b/src/private/maox_info.cpp
@@ -30,16 +30,11 @@ auto info(string const &connection_name) -> mxArray * {
   std::array<mwSize, 2> dims = {1, 1};
   mxArray *info_struct = mxCreateStructArray(2, dims.data(), 5, keys); // NOLINT
 
-  mxSetField(info_struct, 0, "major",
-             maoxdb::mxScalarUINT64(version_info.GetMajor()));
-  mxSetField(info_struct, 0, "minor",
-             maoxdb::mxScalarUINT64(version_info.GetMinor()));
-  mxSetField(info_struct, 0, "patch",
-             maoxdb::mxScalarUINT64(version_info.GetPatch()));
-  mxSetField(info_struct, 0, "pre_release",
-             mxCreateString(version_info.GetPreRelease().c_str()));
-  mxSetField(info_struct, 0, "build",
-             mxCreateString(version_info.GetBuild().c_str()));
+  mxSetField(info_struct, 0, "major", maoxdb::mxScalarUINT64(version_info.GetMajor()));
+  mxSetField(info_struct, 0, "minor", maoxdb::mxScalarUINT64(version_info.GetMinor()));
+  mxSetField(info_struct, 0, "patch", maoxdb::mxScalarUINT64(version_info.GetPatch()));
+  mxSetField(info_struct, 0, "pre_release", mxCreateString(version_info.GetPreRelease().c_str()));
+  mxSetField(info_struct, 0, "build", mxCreateString(version_info.GetBuild().c_str()));
   return info_struct;
 }
 
@@ -53,8 +48,7 @@ auto info(string const &connection_name) -> mxArray * {
  *
  * @return     return type
  */
-void mexFunction(int /*nlhs*/, mxArray *plhs[], int nrhs,
-                 const mxArray *prhs[]) {
+void mexFunction(int /*nlhs*/, mxArray *plhs[], int nrhs, const mxArray *prhs[]) {
 
   string conn_name;
   if (nrhs >= 1 && mxGetNumberOfElements(prhs[0]) > 0) {
diff --git a/src/private/maox_retrieve.cpp b/src/private/maox_retrieve.cpp
index 92212f4..39c87a0 100644
--- a/src/private/maox_retrieve.cpp
+++ b/src/private/maox_retrieve.cpp
@@ -32,16 +32,11 @@ auto info(string const &connection_name) -> mxArray * {
   std::array<mwSize, 2> dims = {1, 1};
   mxArray *info_struct = mxCreateStructArray(2, dims.data(), 5, keys); // NOLINT
 
-  mxSetField(info_struct, 0, "major",
-             maoxdb::mxScalarUINT64(version_info.GetMajor()));
-  mxSetField(info_struct, 0, "minor",
-             maoxdb::mxScalarUINT64(version_info.GetMinor()));
-  mxSetField(info_struct, 0, "patch",
-             maoxdb::mxScalarUINT64(version_info.GetPatch()));
-  mxSetField(info_struct, 0, "pre_release",
-             mxCreateString(version_info.GetPreRelease().c_str()));
-  mxSetField(info_struct, 0, "build",
-             mxCreateString(version_info.GetBuild().c_str()));
+  mxSetField(info_struct, 0, "major", maoxdb::mxScalarUINT64(version_info.GetMajor()));
+  mxSetField(info_struct, 0, "minor", maoxdb::mxScalarUINT64(version_info.GetMinor()));
+  mxSetField(info_struct, 0, "patch", maoxdb::mxScalarUINT64(version_info.GetPatch()));
+  mxSetField(info_struct, 0, "pre_release", mxCreateString(version_info.GetPreRelease().c_str()));
+  mxSetField(info_struct, 0, "build", mxCreateString(version_info.GetBuild().c_str()));
   return info_struct;
 }
 
@@ -57,16 +52,14 @@ auto info(string const &connection_name) -> mxArray * {
  *
  * @return collection A struct with the entities.
  */
-void mexFunction(int /*nlhs*/, mxArray *plhs[], int nrhs,
-                 const mxArray *prhs[]) {
+void mexFunction(int /*nlhs*/, mxArray *plhs[], int nrhs, const mxArray *prhs[]) {
 
   string conn_name;
   std::vector<string> ids;
   try {
     if (nrhs < 2) {
-      mexErrMsgIdAndTxt(
-        "maox:InsufficientArguments",
-        "Need at least 2 arguments: connection_name and 1 or more IDs");
+      mexErrMsgIdAndTxt("maox:InsufficientArguments",
+                        "Need at least 2 arguments: connection_name and 1 or more IDs");
     }
     if (mxGetNumberOfElements(prhs[0]) > 0) {
       conn_name = mxArrayToString(prhs[0]);
@@ -77,8 +70,7 @@ void mexFunction(int /*nlhs*/, mxArray *plhs[], int nrhs,
       ids.emplace_back(mxArrayToString(prhs[i]));
     }
   } catch (...) {
-    mexErrMsgIdAndTxt("maox:ArgumentHandling",
-                      "Error while handling the arguments.");
+    mexErrMsgIdAndTxt("maox:ArgumentHandling", "Error while handling the arguments.");
   }
   auto n_ids = ids.size();
 
@@ -90,7 +82,7 @@ void mexFunction(int /*nlhs*/, mxArray *plhs[], int nrhs,
     connection = ConnectionManager::GetConnection(conn_name);
   }
   std::unique_ptr<Transaction> transaction = connection->CreateTransaction();
-  for (const auto& id : ids) {
+  for (const auto &id : ids) {
     std::cout << "RetrieveById(" << id << ")" << std::endl;
     transaction->RetrieveById(id);
   }
diff --git a/test/Run_Test.m b/test/Run_Test.m
index e72e71a..22411ad 100644
--- a/test/Run_Test.m
+++ b/test/Run_Test.m
@@ -19,5 +19,5 @@
 pkg load caosdb;
 test_result = moxunit_runtests("-verbose", "test_unittest.m");
 if not(test_result)
-  exit(1)
+  exit(1);
 end
diff --git a/test/test_unittest.m b/test/test_unittest.m
index 6dd97bf..ad7d9e6 100644
--- a/test/test_unittest.m
+++ b/test/test_unittest.m
@@ -16,9 +16,9 @@
 % You should have received a copy of the GNU Affero General Public License
 % along with this program. If not, see <https://www.gnu.org/licenses/>.
 
-function test_suite=test_unittest()
+function test_suite = test_unittest()
   try % assignment of 'localfunctions' is necessary in Matlab >= 2016
-    test_functions=localfunctions();
+    test_functions = localfunctions();
   catch % no problem; early Matlab versions can use initTestSuite fine
   end
   initTestSuite;
@@ -28,7 +28,7 @@ end
 function test_local()
   % default connection
   c1 = Caosdb();
-  assertEqual(c1.connection, "")
+  assertEqual(c1.connection, "");
   % class with explicit connection
   c2 = Caosdb("local-caosdb-admin");
   assertEqual(c2.connection, "local-caosdb-admin");
diff --git a/test/test_utilities.cpp b/test/test_utilities.cpp
index 1c42a2c..c325044 100644
--- a/test/test_utilities.cpp
+++ b/test/test_utilities.cpp
@@ -40,42 +40,42 @@ void test_scalar_uint64(UINT64_T value) {
   mxArray *scalar = mxScalarUINT64(value);
   EXPECT_TRUE(mxIsUint64(scalar));
   EXPECT_EQ(mxGetNumberOfElements(scalar), 1);
-  EXPECT_EQ(*((UINT64_T *) mxGetData(scalar)), value);
+  EXPECT_EQ(*((UINT64_T *)mxGetData(scalar)), value);
 }
 
 void test_scalar_int64(INT64_T value) {
   mxArray *scalar = mxScalarINT64(value);
   EXPECT_TRUE(mxIsInt64(scalar));
   EXPECT_EQ(mxGetNumberOfElements(scalar), 1);
-  EXPECT_EQ(*((INT64_T *) mxGetData(scalar)), value);
+  EXPECT_EQ(*((INT64_T *)mxGetData(scalar)), value);
 }
 
 void test_scalar_double(double value) {
   mxArray *scalar = mxScalarDOUBLE(value);
   EXPECT_TRUE(mxIsDouble(scalar));
   EXPECT_EQ(mxGetNumberOfElements(scalar), 1);
-  EXPECT_EQ(*((double *) mxGetData(scalar)), value);
+  EXPECT_EQ(*((double *)mxGetData(scalar)), value);
 }
 
 void test_scalar_logical(bool value) {
   mxArray *scalar = mxScalarLOGICAL(value);
   EXPECT_TRUE(mxIsLogical(scalar));
   EXPECT_EQ(mxGetNumberOfElements(scalar), 1);
-  EXPECT_EQ(*((bool *) mxGetData(scalar)), value);
+  EXPECT_EQ(*((bool *)mxGetData(scalar)), value);
 }
 
 /**
  * Generate a vector with useful values for testing.
  */
-template<typename T>
-auto values() -> std::vector<T> {
-  std::vector<T> values =
-    {0, 1,
-     std::numeric_limits<T>::max(),
-     std::numeric_limits<T>::min(),
-     std::numeric_limits<T>::lowest(),
-     std::numeric_limits<T>::epsilon() // 0 for integers, but who cares?
-    };
+template <typename T> auto values() -> std::vector<T> {
+  std::vector<T> values = {
+    0,
+    1,
+    std::numeric_limits<T>::max(),
+    std::numeric_limits<T>::min(),
+    std::numeric_limits<T>::lowest(),
+    std::numeric_limits<T>::epsilon() // 0 for integers, but who cares?
+  };
   return values;
 }
 
@@ -116,10 +116,9 @@ TEST(test_utilities, exception_handling) {
   caosdb::exceptions::AuthenticationError exc("Authentication failed.");
   auto strings = exceptionToMessage(exc);
   EXPECT_EQ(strings.first, std::string("16"));
-  EXPECT_EQ(strings.second,
-            std::string("The attempt to execute this transaction has not been "
-                        "executed at all because the authentication did not "
-                        "succeed.\nAuthentication failed."));
+  EXPECT_EQ(strings.second, std::string("The attempt to execute this transaction has not been "
+                                        "executed at all because the authentication did not "
+                                        "succeed.\nAuthentication failed."));
 }
 
-}  // maoxdb
+} // namespace maoxdb
-- 
GitLab