Skip to content
Snippets Groups Projects
Commit 1036de93 authored by Daniel Hornung's avatar Daniel Hornung
Browse files

STY: Linting.

parent c19c78af
Branches
Tags
1 merge request!2ENH: Retrieving single entities works on the mex side.
Pipeline #11673 passed with warnings
Pipeline: caosdb-octaveinttest

#11674

    ...@@ -80,10 +80,10 @@ classdef Caosdb < handle ...@@ -80,10 +80,10 @@ classdef Caosdb < handle
    % id: string % id: string
    % The ID of the entity to be retrieved. % The ID of the entity to be retrieved.
    function collection = retrieve(obj, id) function collection = retrieve(obj, id)
    assert(ischar(id), assert(ischar(id), ...
    "maox:InvalidArgument", "maox:InvalidArgument", ...
    "ID must be a string, was:\n%s", "ID must be a string, was:\n%s", ...
    disp(id)) disp(id));
    disp(["ID (oct): >", id, "<"]); disp(["ID (oct): >", id, "<"]);
    try try
    collection = maox_retrieve(obj.connection, id); collection = maox_retrieve(obj.connection, id);
    ...@@ -95,5 +95,6 @@ classdef Caosdb < handle ...@@ -95,5 +95,6 @@ classdef Caosdb < handle
    rethrow(lasterror()); rethrow(lasterror());
    end end
    end end
    end end
    end end
    ...@@ -43,8 +43,7 @@ auto mxFromCaosDBMessages(const caosdb::entity::Messages &messages) -> mxArray * ...@@ -43,8 +43,7 @@ auto mxFromCaosDBMessages(const caosdb::entity::Messages &messages) -> mxArray *
    /** /**
    * Generate a mex error message from a TransactionStatus. * Generate a mex error message from a TransactionStatus.
    */ */
    auto transactionStatusToMessage( auto transactionStatusToMessage(const caosdb::transaction::Transaction *const trans)
    const caosdb::transaction::Transaction *const trans)
    -> std::pair<string, string> { -> std::pair<string, string> {
    auto status = trans->GetStatus(); auto status = trans->GetStatus();
    auto code = status.GetCode(); auto code = status.GetCode();
    ...@@ -59,8 +58,7 @@ auto transactionStatusToMessage( ...@@ -59,8 +58,7 @@ auto transactionStatusToMessage(
    /** /**
    * Throw an Octave error if the transaction did not finish properly. * Throw an Octave error if the transaction did not finish properly.
    */ */
    void throwOctExceptionIfError( void throwOctExceptionIfError(const caosdb::transaction::Transaction *const trans) {
    const caosdb::transaction::Transaction *const trans) {
    auto msg = maoxdb::transactionStatusToMessage(trans); auto msg = maoxdb::transactionStatusToMessage(trans);
    if (msg.first != "") { if (msg.first != "") {
    mexErrMsgIdAndTxt(msg.first.c_str(), msg.second.c_str()); mexErrMsgIdAndTxt(msg.first.c_str(), msg.second.c_str());
    ...@@ -70,12 +68,10 @@ void throwOctExceptionIfError( ...@@ -70,12 +68,10 @@ void throwOctExceptionIfError(
    /** /**
    * Extract useful strings from an Exception: ID and description. * Extract useful strings from an Exception: ID and description.
    */ */
    auto exceptionToMessage(const caosdb::exceptions::Exception &exc) auto exceptionToMessage(const caosdb::exceptions::Exception &exc) -> std::pair<string, string> {
    -> std::pair<string, string> {
    string id = std::to_string(exc.GetCode()); string id = std::to_string(exc.GetCode());
    string text = string text = caosdb::get_status_description(exc.GetCode()) + "\n" + exc.what();
    caosdb::get_status_description(exc.GetCode()) + "\n" + exc.what();
    return std::pair<string, string>(id, text); return std::pair<string, string>(id, text);
    } }
    ...@@ -93,8 +89,7 @@ void throwOctException(const caosdb::exceptions::Exception &exc) { ...@@ -93,8 +89,7 @@ void throwOctException(const caosdb::exceptions::Exception &exc) {
    /** /**
    * @brief Convert a ResultSet to a struct mexArray. * @brief Convert a ResultSet to a struct mexArray.
    */ */
    auto mxFromResultSet(const caosdb::transaction::ResultSet &resultSet) auto mxFromResultSet(const caosdb::transaction::ResultSet &resultSet) -> mxArray * {
    -> mxArray * {
    auto resSize = resultSet.Size(); auto resSize = resultSet.Size();
    std::array<mwSize, 2> dims = {1, resSize}; std::array<mwSize, 2> dims = {1, resSize};
    std::vector<const mxArray *> entities; std::vector<const mxArray *> entities;
    ...@@ -112,6 +107,7 @@ auto mxFromResultSet(const caosdb::transaction::ResultSet &resultSet) ...@@ -112,6 +107,7 @@ auto mxFromResultSet(const caosdb::transaction::ResultSet &resultSet)
    * @brief Convert an Entity from libcaosdb to Octave struct mexArray. * @brief Convert an Entity from libcaosdb to Octave struct mexArray.
    */ */
    auto mxFromCaosDBEntity(const caosdb::entity::Entity &entity) -> mxArray * { auto mxFromCaosDBEntity(const caosdb::entity::Entity &entity) -> mxArray * {
    // clang-format off
    auto fields = std::vector<const char*> auto fields = std::vector<const char*>
    {"role", {"role",
    "id", "id",
    ...@@ -127,6 +123,7 @@ auto mxFromCaosDBEntity(const caosdb::entity::Entity &entity) -> mxArray * { ...@@ -127,6 +123,7 @@ auto mxFromCaosDBEntity(const caosdb::entity::Entity &entity) -> mxArray * {
    "warnings", "warnings",
    "infos" "infos"
    }; };
    // clang-format on
    std::array<mwSize, 2> dims = {1, (mwSize)fields.size()}; 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 // Fill with scalar values
    ...@@ -149,17 +146,18 @@ auto mxFromCaosDBEntity(const caosdb::entity::Entity &entity) -> mxArray * { ...@@ -149,17 +146,18 @@ auto mxFromCaosDBEntity(const caosdb::entity::Entity &entity) -> mxArray * {
    mxSetField(result, 0, "warnings", mxFromCaosDBMessages(entity.GetWarnings())); mxSetField(result, 0, "warnings", mxFromCaosDBMessages(entity.GetWarnings()));
    mxSetField(result, 0, "infos", mxFromCaosDBMessages(entity.GetInfos())); mxSetField(result, 0, "infos", mxFromCaosDBMessages(entity.GetInfos()));
    return result; return result;
    } }
    // Parents to struct array // Parents to struct array
    auto mxFromCaosDBParents(const caosdb::entity::Parents &parents) -> mxArray * { auto mxFromCaosDBParents(const caosdb::entity::Parents &parents) -> mxArray * {
    // clang-format off
    std::vector<const char*> fields = std::vector<const char*> fields =
    {"id", {"id",
    "name", "name",
    "description" "description"
    }; };
    // clang-format on
    std::array<mwSize, 2> fieldDims = {1, (mwSize)fields.size()}; std::array<mwSize, 2> fieldDims = {1, (mwSize)fields.size()};
    std::array<mwSize, 2> dims = {1, (mwSize)parents.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());
    ...@@ -168,13 +166,15 @@ auto mxFromCaosDBParents(const caosdb::entity::Parents &parents) -> mxArray * { ...@@ -168,13 +166,15 @@ auto mxFromCaosDBParents(const caosdb::entity::Parents &parents) -> mxArray * {
    mxSetField(result, i, "id", mxCreateString(parent.GetId().c_str())); mxSetField(result, i, "id", mxCreateString(parent.GetId().c_str()));
    mxSetField(result, i, "name", mxCreateString(parent.GetName().c_str())); mxSetField(result, i, "name", mxCreateString(parent.GetName().c_str()));
    // FIXME Add again once upstream is ready. // 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; return result;
    } }
    // Properties to struct array // Properties to struct array
    auto mxFromCaosDBProperties(const caosdb::entity::Properties &properties) -> mxArray * { auto mxFromCaosDBProperties(const caosdb::entity::Properties &properties) -> mxArray * {
    // clang-format off
    std::vector<const char*> fields = std::vector<const char*> fields =
    {"id", {"id",
    "name", "name",
    ...@@ -184,6 +184,7 @@ auto mxFromCaosDBProperties(const caosdb::entity::Properties &properties) -> mxA ...@@ -184,6 +184,7 @@ auto mxFromCaosDBProperties(const caosdb::entity::Properties &properties) -> mxA
    "unit", "unit",
    "datatype" "datatype"
    }; };
    // clang-format on
    std::array<mwSize, 2> fieldDims = {1, (mwSize)fields.size()}; std::array<mwSize, 2> fieldDims = {1, (mwSize)fields.size()};
    std::array<mwSize, 2> dims = {1, (mwSize)properties.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());
    ...@@ -203,9 +204,9 @@ auto mxFromCaosDBProperties(const caosdb::entity::Properties &properties) -> mxA ...@@ -203,9 +204,9 @@ auto mxFromCaosDBProperties(const caosdb::entity::Properties &properties) -> mxA
    // Messages to struct array // Messages to struct array
    auto mxFromCaosDBMessages(const caosdb::entity::Messages &messages) -> mxArray * { auto mxFromCaosDBMessages(const caosdb::entity::Messages &messages) -> mxArray * {
    std::vector<const char*> fields = std::vector<const char *> fields = {
    {"code", "code", //
    "description" "description" //
    }; };
    std::array<mwSize, 2> fieldDims = {1, (mwSize)fields.size()}; std::array<mwSize, 2> fieldDims = {1, (mwSize)fields.size()};
    std::array<mwSize, 2> dims = {1, (mwSize)messages.Size()}; std::array<mwSize, 2> dims = {1, (mwSize)messages.Size()};
    ......
    ...@@ -14,10 +14,11 @@ ...@@ -14,10 +14,11 @@
    * *
    * \b{Data exchange} * \b{Data exchange}
    * *
    * Exchanging data between the Octave side wrapper and this C++ library is done via Octave struct * Exchanging data between the Octave side wrapper and this C++ library is done
    * arrays, each struct corresponds to one CaosDB Entity. * 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" * - role: One of "RecordType", "Record", "Property"
    * - id * - id
    ...@@ -49,7 +50,6 @@ ...@@ -49,7 +50,6 @@
    // Macros ///////////////////////////////////////////////////////////////////// // Macros /////////////////////////////////////////////////////////////////////
    // Utility functions ////////////////////////////////////////////////////////// // Utility functions //////////////////////////////////////////////////////////
    namespace maoxdb { namespace maoxdb {
    ...@@ -84,10 +84,10 @@ inline auto mxEmptyDOUBLE() -> mxArray * { ...@@ -84,10 +84,10 @@ inline auto mxEmptyDOUBLE() -> mxArray * {
    /** /**
    * @brief Convert the string-typed value in an Entity-like object to a 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> template <class T> auto mxScalarFromStringValue(const T &entity) -> mxArray * {
    auto mxScalarFromStringValue(const T& entity) -> mxArray * {
    mxArray *result; mxArray *result;
    auto dt = entity.GetDatatype(); auto dt = entity.GetDatatype();
    auto value = entity.GetValue(); auto value = entity.GetValue();
    ...@@ -129,8 +129,8 @@ auto mxScalarFromStringValue(const T& entity) -> mxArray * { ...@@ -129,8 +129,8 @@ auto mxScalarFromStringValue(const T& entity) -> mxArray * {
    /** /**
    * @brief Generate a mex error message from a TransactionStatus. * @brief Generate a mex error message from a TransactionStatus.
    * *
    * @details Preprocess the transaction status of a transaction, to create the necessary * @details Preprocess the transaction status of a transaction, to create the
    * information for raising an Octave error. * necessary information for raising an Octave error.
    * *
    * @param trans * @param trans
    * The transaction of which to handle the status. * The transaction of which to handle the status.
    ...@@ -139,14 +139,14 @@ auto mxScalarFromStringValue(const T& entity) -> mxArray * { ...@@ -139,14 +139,14 @@ auto mxScalarFromStringValue(const T& entity) -> mxArray * {
    * The message ID and description of any error. If the transaction status is * The message ID and description of any error. If the transaction status is
    * SUCCESS, or some kind of "still running", both strings are empty. * SUCCESS, or some kind of "still running", both strings are empty.
    */ */
    auto auto transactionStatusToMessage(const caosdb::transaction::Transaction *const trans)
    transactionStatusToMessage(const caosdb::transaction::Transaction *const trans)
    -> std::pair<string, string>; -> std::pair<string, string>;
    /** /**
    * @brief Throw an Octave error if the transaction did not finish properly. * @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 * @param trans
    * The transaction to check. * The transaction to check.
    ...@@ -168,8 +168,7 @@ void throwOctExceptionIfError(const caosdb::transaction::Transaction *const tran ...@@ -168,8 +168,7 @@ void throwOctExceptionIfError(const caosdb::transaction::Transaction *const tran
    * @note Additional utility functions should be easy to implement when the * @note Additional utility functions should be easy to implement when the
    * libcaosdb error handling changes. * libcaosdb error handling changes.
    */ */
    auto auto exceptionToMessage(const caosdb::exceptions::Exception &exc) -> std::pair<string, string>;
    exceptionToMessage(const caosdb::exceptions::Exception &exc) -> std::pair<string, string>;
    /** /**
    * @brief Throw a CaosDB Exception inside Octave. * @brief Throw a CaosDB Exception inside Octave.
    ...@@ -184,7 +183,6 @@ exceptionToMessage(const caosdb::exceptions::Exception &exc) -> std::pair<string ...@@ -184,7 +183,6 @@ exceptionToMessage(const caosdb::exceptions::Exception &exc) -> std::pair<string
    */ */
    void throwOctException(const caosdb::exceptions::Exception &exc); void throwOctException(const caosdb::exceptions::Exception &exc);
    // Entity handling //////////////////////////////////////////////////////////// // Entity handling ////////////////////////////////////////////////////////////
    /** /**
    ...@@ -197,7 +195,8 @@ auto mxFromResultSet(const caosdb::transaction::ResultSet &resultSet) -> mxArray ...@@ -197,7 +195,8 @@ auto mxFromResultSet(const caosdb::transaction::ResultSet &resultSet) -> mxArray
    /** /**
    * @brief Convert an Entity from libcaosdb to Octave struct mexArray. * @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 *; auto mxFromCaosDBEntity(const caosdb::entity::Entity &entity) -> mxArray *;
    ...@@ -206,7 +205,8 @@ auto mxFromCaosDBEntity(const caosdb::entity::Entity &entity) -> mxArray *; ...@@ -206,7 +205,8 @@ auto mxFromCaosDBEntity(const caosdb::entity::Entity &entity) -> mxArray *;
    /** /**
    * @brief Merges a number of scalar mex structs into a 1xN struct. * @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. * @param structs: Must all have the same fields.
    * *
    ......
    ...@@ -17,12 +17,11 @@ void print_usage() { ...@@ -17,12 +17,11 @@ void print_usage() {
    mexPrintf(" --help Print this help and return.\n"); mexPrintf(" --help Print this help and return.\n");
    mexPrintf(" --version Print the version of OctaveCaosDB and " mexPrintf(" --version Print the version of OctaveCaosDB and "
    "libcaosdb and return.\n"); "libcaosdb and return.\n");
    mexPrintf( mexPrintf(" --test-connection Test the default connection and return.\n");
    " --test-connection Test the default connection and return.\n");
    }; };
    const std::string FULL_VERSION = std::string( const std::string FULL_VERSION =
    "v0.1 (libcaosdb v" + std::to_string(caosdb::LIBCAOSDB_VERSION_MAJOR) + "." + 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_MINOR) + "." +
    std::to_string(caosdb::LIBCAOSDB_VERSION_PATCH) + ")"); std::to_string(caosdb::LIBCAOSDB_VERSION_PATCH) + ")");
    ...@@ -33,17 +32,14 @@ auto print_version() -> const char * { ...@@ -33,17 +32,14 @@ auto print_version() -> const char * {
    }; };
    void test_connection() { void test_connection() {
    const auto &connection = const auto &connection = caosdb::connection::ConnectionManager::GetDefaultConnection();
    caosdb::connection::ConnectionManager::GetDefaultConnection();
    const auto &version_info = connection->GetVersionInfo(); const auto &version_info = connection->GetVersionInfo();
    mexPrintf("Server Version: v%d.%d.%d-%s-%s\n", version_info->GetMajor(), mexPrintf("Server Version: v%d.%d.%d-%s-%s\n", version_info->GetMajor(), version_info->GetMinor(),
    version_info->GetMinor(), version_info->GetPatch(), version_info->GetPatch(), version_info->GetPreRelease().c_str(),
    version_info->GetPreRelease().c_str(),
    version_info->GetBuild().c_str()); version_info->GetBuild().c_str());
    } }
    void mexFunction(int /*nlhs*/, mxArray *plhs[], int nrhs, void mexFunction(int /*nlhs*/, mxArray *plhs[], int nrhs, const mxArray *prhs[]) {
    const mxArray *prhs[]) {
    if (nrhs == 1) { if (nrhs == 1) {
    auto const *first_arg = mxArrayToString(prhs[0]); auto const *first_arg = mxArrayToString(prhs[0]);
    ......
    ...@@ -30,16 +30,11 @@ auto info(string const &connection_name) -> mxArray * { ...@@ -30,16 +30,11 @@ auto info(string const &connection_name) -> mxArray * {
    std::array<mwSize, 2> dims = {1, 1}; std::array<mwSize, 2> dims = {1, 1};
    mxArray *info_struct = mxCreateStructArray(2, dims.data(), 5, keys); // NOLINT mxArray *info_struct = mxCreateStructArray(2, dims.data(), 5, keys); // NOLINT
    mxSetField(info_struct, 0, "major", mxSetField(info_struct, 0, "major", maoxdb::mxScalarUINT64(version_info.GetMajor()));
    maoxdb::mxScalarUINT64(version_info.GetMajor())); mxSetField(info_struct, 0, "minor", maoxdb::mxScalarUINT64(version_info.GetMinor()));
    mxSetField(info_struct, 0, "minor", mxSetField(info_struct, 0, "patch", maoxdb::mxScalarUINT64(version_info.GetPatch()));
    maoxdb::mxScalarUINT64(version_info.GetMinor())); mxSetField(info_struct, 0, "pre_release", mxCreateString(version_info.GetPreRelease().c_str()));
    mxSetField(info_struct, 0, "patch", mxSetField(info_struct, 0, "build", mxCreateString(version_info.GetBuild().c_str()));
    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; return info_struct;
    } }
    ...@@ -53,8 +48,7 @@ auto info(string const &connection_name) -> mxArray * { ...@@ -53,8 +48,7 @@ auto info(string const &connection_name) -> mxArray * {
    * *
    * @return return type * @return return type
    */ */
    void mexFunction(int /*nlhs*/, mxArray *plhs[], int nrhs, void mexFunction(int /*nlhs*/, mxArray *plhs[], int nrhs, const mxArray *prhs[]) {
    const mxArray *prhs[]) {
    string conn_name; string conn_name;
    if (nrhs >= 1 && mxGetNumberOfElements(prhs[0]) > 0) { if (nrhs >= 1 && mxGetNumberOfElements(prhs[0]) > 0) {
    ......
    ...@@ -32,16 +32,11 @@ auto info(string const &connection_name) -> mxArray * { ...@@ -32,16 +32,11 @@ auto info(string const &connection_name) -> mxArray * {
    std::array<mwSize, 2> dims = {1, 1}; std::array<mwSize, 2> dims = {1, 1};
    mxArray *info_struct = mxCreateStructArray(2, dims.data(), 5, keys); // NOLINT mxArray *info_struct = mxCreateStructArray(2, dims.data(), 5, keys); // NOLINT
    mxSetField(info_struct, 0, "major", mxSetField(info_struct, 0, "major", maoxdb::mxScalarUINT64(version_info.GetMajor()));
    maoxdb::mxScalarUINT64(version_info.GetMajor())); mxSetField(info_struct, 0, "minor", maoxdb::mxScalarUINT64(version_info.GetMinor()));
    mxSetField(info_struct, 0, "minor", mxSetField(info_struct, 0, "patch", maoxdb::mxScalarUINT64(version_info.GetPatch()));
    maoxdb::mxScalarUINT64(version_info.GetMinor())); mxSetField(info_struct, 0, "pre_release", mxCreateString(version_info.GetPreRelease().c_str()));
    mxSetField(info_struct, 0, "patch", mxSetField(info_struct, 0, "build", mxCreateString(version_info.GetBuild().c_str()));
    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; return info_struct;
    } }
    ...@@ -57,15 +52,13 @@ auto info(string const &connection_name) -> mxArray * { ...@@ -57,15 +52,13 @@ auto info(string const &connection_name) -> mxArray * {
    * *
    * @return collection A struct with the entities. * @return collection A struct with the entities.
    */ */
    void mexFunction(int /*nlhs*/, mxArray *plhs[], int nrhs, void mexFunction(int /*nlhs*/, mxArray *plhs[], int nrhs, const mxArray *prhs[]) {
    const mxArray *prhs[]) {
    string conn_name; string conn_name;
    std::vector<string> ids; std::vector<string> ids;
    try { try {
    if (nrhs < 2) { if (nrhs < 2) {
    mexErrMsgIdAndTxt( mexErrMsgIdAndTxt("maox:InsufficientArguments",
    "maox:InsufficientArguments",
    "Need at least 2 arguments: connection_name and 1 or more IDs"); "Need at least 2 arguments: connection_name and 1 or more IDs");
    } }
    if (mxGetNumberOfElements(prhs[0]) > 0) { if (mxGetNumberOfElements(prhs[0]) > 0) {
    ...@@ -77,8 +70,7 @@ void mexFunction(int /*nlhs*/, mxArray *plhs[], int nrhs, ...@@ -77,8 +70,7 @@ void mexFunction(int /*nlhs*/, mxArray *plhs[], int nrhs,
    ids.emplace_back(mxArrayToString(prhs[i])); ids.emplace_back(mxArrayToString(prhs[i]));
    } }
    } catch (...) { } catch (...) {
    mexErrMsgIdAndTxt("maox:ArgumentHandling", mexErrMsgIdAndTxt("maox:ArgumentHandling", "Error while handling the arguments.");
    "Error while handling the arguments.");
    } }
    auto n_ids = ids.size(); auto n_ids = ids.size();
    ......
    ...@@ -19,5 +19,5 @@ ...@@ -19,5 +19,5 @@
    pkg load caosdb; pkg load caosdb;
    test_result = moxunit_runtests("-verbose", "test_unittest.m"); test_result = moxunit_runtests("-verbose", "test_unittest.m");
    if not(test_result) if not(test_result)
    exit(1) exit(1);
    end end
    ...@@ -28,7 +28,7 @@ end ...@@ -28,7 +28,7 @@ end
    function test_local() function test_local()
    % default connection % default connection
    c1 = Caosdb(); c1 = Caosdb();
    assertEqual(c1.connection, "") assertEqual(c1.connection, "");
    % class with explicit connection % class with explicit connection
    c2 = Caosdb("local-caosdb-admin"); c2 = Caosdb("local-caosdb-admin");
    assertEqual(c2.connection, "local-caosdb-admin"); assertEqual(c2.connection, "local-caosdb-admin");
    ......
    ...@@ -67,10 +67,10 @@ void test_scalar_logical(bool value) { ...@@ -67,10 +67,10 @@ void test_scalar_logical(bool value) {
    /** /**
    * Generate a vector with useful values for testing. * Generate a vector with useful values for testing.
    */ */
    template<typename T> template <typename T> auto values() -> std::vector<T> {
    auto values() -> std::vector<T> { std::vector<T> values = {
    std::vector<T> values = 0,
    {0, 1, 1,
    std::numeric_limits<T>::max(), std::numeric_limits<T>::max(),
    std::numeric_limits<T>::min(), std::numeric_limits<T>::min(),
    std::numeric_limits<T>::lowest(), std::numeric_limits<T>::lowest(),
    ...@@ -116,10 +116,9 @@ TEST(test_utilities, exception_handling) { ...@@ -116,10 +116,9 @@ TEST(test_utilities, exception_handling) {
    caosdb::exceptions::AuthenticationError exc("Authentication failed."); caosdb::exceptions::AuthenticationError exc("Authentication failed.");
    auto strings = exceptionToMessage(exc); auto strings = exceptionToMessage(exc);
    EXPECT_EQ(strings.first, std::string("16")); EXPECT_EQ(strings.first, std::string("16"));
    EXPECT_EQ(strings.second, EXPECT_EQ(strings.second, std::string("The attempt to execute this transaction has not been "
    std::string("The attempt to execute this transaction has not been "
    "executed at all because the authentication did not " "executed at all because the authentication did not "
    "succeed.\nAuthentication failed.")); "succeed.\nAuthentication failed."));
    } }
    } // maoxdb } // namespace maoxdb
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Please register or to comment