<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 <include/amici_solver_idas.h>
#include <include/symbolic_functions.h>
#include <cstring>
#include <cmath>

TEST_GROUP(userData)
{
    void setup() {

    }

    void teardown() {

    }
};


TEST(userData, testConstructionDestruction) {
    UserData udata;
}

TEST(userData, testScalingLin) {
    UserData udata(1, 0, 0);
    const double p[1] = {1};
    udata.setParameters(p);

    udata.pscale = AMICI_SCALING_NONE;
    double unscaled[1];
    udata.unscaleParameters(unscaled);

    CHECK_EQUAL(p[0], unscaled[0]);
}

TEST(userData, testScalingLog) {
    UserData udata(1, 0, 0);
    const double p[1] = {1};
    udata.setParameters(p);

    udata.pscale = AMICI_SCALING_LN;
    double unscaled[1];
    udata.unscaleParameters(unscaled);

    DOUBLES_EQUAL(exp(p[0]), unscaled[0], 1e-16);
}

TEST(userData, testScalingLog10) {
    UserData udata(1, 0, 0);
    const double p[1] = {1};
    udata.setParameters(p);

    udata.pscale = AMICI_SCALING_LOG10;
    double unscaled[1];
    udata.unscaleParameters(unscaled);

    DOUBLES_EQUAL(pow10(p[0]), unscaled[0], 1e-16);
}


TEST_GROUP(symbolicFunctions)
{
    void setup() {

    }

    void teardown() {

    }
};


TEST(symbolicFunctions, testSign) {
    CHECK_EQUAL(-1, sign(-2));
    CHECK_EQUAL(0, sign(0));
    CHECK_EQUAL(1, sign(2));
}

TEST(symbolicFunctions, testHeaviside) {
    CHECK_EQUAL(0, heaviside(-1));
    CHECK_EQUAL(0, heaviside(0));
    CHECK_EQUAL(1, heaviside(1));
}


TEST(symbolicFunctions, testMin) {<commit_msg>pow10 seems to be non-standard<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 <include/amici_solver_idas.h>
#include <include/symbolic_functions.h>
#include <cstring>
#include <cmath>

TEST_GROUP(userData)
{
    void setup() {

    }

    void teardown() {

    }
};


TEST(userData, testConstructionDestruction) {
    UserData udata;
}

TEST(userData, testScalingLin) {
    UserData udata(1, 0, 0);
    const double p[1] = {1};
    udata.setParameters(p);

    udata.pscale = AMICI_SCALING_NONE;
    double unscaled[1];
    udata.unscaleParameters(unscaled);

    CHECK_EQUAL(p[0], unscaled[0]);
}

TEST(userData, testScalingLog) {
    UserData udata(1, 0, 0);
    const double p[1] = {1};
    udata.setParameters(p);

    udata.pscale = AMICI_SCALING_LN;
    double unscaled[1];
    udata.unscaleParameters(unscaled);

    DOUBLES_EQUAL(exp(p[0]), unscaled[0], 1e-16);
}

TEST(userData, testScalingLog10) {
    UserData udata(1, 0, 0);
    const double p[1] = {1};
    udata.setParameters(p);

    udata.pscale = AMICI_SCALING_LOG10;
    double unscaled[1];
    udata.unscaleParameters(unscaled);

    DOUBLES_EQUAL(pow(10, p[0]), unscaled[0], 1e-16);
}


TEST_GROUP(symbolicFunctions)
{
    void setup() {

    }

    void teardown() {

    }
};


TEST(symbolicFunctions, testSign) {
    CHECK_EQUAL(-1, sign(-2));
    CHECK_EQUAL(0, sign(0));
    CHECK_EQUAL(1, sign(2));
}

TEST(symbolicFunctions, testHeaviside) {
    CHECK_EQUAL(0, heaviside(-1));
    CHECK_EQUAL(0, heaviside(0));
    CHECK_EQUAL(1, heaviside(1));
}


TEST(symbolicFunctions, testMin) {
{'fraction_non_alphanumeric': 0.1476904972050603, 'fraction_numerical': 0.029420417769932334, 'mean_word_length': 4.037037037037037, 'pattern_counts': {'":': 0, '<': 15, '<?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': '3293766', 'n_tokens_mistral': 1412, 'n_tokens_neox': 1360, 'n_words': 217}