<commit_before>#include "CppUTest/TestHarness.h"
#include "CppUTestExt/MockSupport.h"

#include <testfunctions.h>
#include <include/amici_hdf5.h>
#include <include/amici_interface_cpp.h>
#include <cstring>
#include "wrapfunctions.h"

TEST_GROUP(groupDirac)
{
    void setup() {

    }

    void teardown() {

    }
};


amici::UserData *getTestUserData() {
    amici::UserData *udata = new amici::UserData(2,1,3);
    double par[2] = {1,3};
    double konst[1] = {1};
    udata->setParameters(par);
    udata->setConstants(konst);
    return udata;
}


/*
 * Test for mem leaks in UserData initalization / destruction
 */
TEST(groupDirac, testCreateAndFreeUserData) {
    amici::UserData *udata = getTestUserData();

    delete udata;
}

/*
 * Test for mem leaks in ExpData initalization / destruction
 */<commit_msg>fix bad memory access in test<commit_after>#include "CppUTest/TestHarness.h"
#include "CppUTestExt/MockSupport.h"

#include <testfunctions.h>
#include <include/amici_hdf5.h>
#include <include/amici_interface_cpp.h>
#include <cstring>
#include "wrapfunctions.h"

TEST_GROUP(groupDirac)
{
    void setup() {

    }

    void teardown() {

    }
};


amici::UserData *getTestUserData() {
    int nx, nk, np;
    getModelDims(&nx,&nk,&np);
    amici::UserData *udata = new amici::UserData(np,nk,nx);
    double par[np];
    double konst[nk];
    memset(par,0,np*sizeof(double));
    memset(konst,0,nk*sizeof(double));
    udata->setParameters(par);
    udata->setConstants(konst);
    return udata;
}


/*
 * Test for mem leaks in UserData initalization / destruction
 */
TEST(groupDirac, testCreateAndFreeUserData) {
    amici::UserData *udata = getTestUserData();

    delete udata;
}

/*
 * Test for mem leaks in ExpData initalization / destruction
 */
{'fraction_non_alphanumeric': 0.14027149321266968, 'fraction_numerical': 0.006787330316742082, 'mean_word_length': 4.127536231884058, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5808776', 'n_tokens_mistral': 659, 'n_tokens_neox': 642, 'n_words': 126}