<commit_before>/*
Copyright libCellML Contributors

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

#include "test_utils.h"

#include "gtest/gtest.h"

#include <libcellml>

TEST(Reset, create)
{
    libcellml::ResetPtr r = std::make_shared<libcellml::Reset>();

    EXPECT_NE(nullptr, r);
}

TEST(Reset, order)
{
    libcellml::ResetPtr r = std::make_shared<libcellml::Reset>();

    EXPECT_FALSE(r->isOrderSet());
    r->setOrder(1);

    EXPECT_EQ(1, r->order());
    EXPECT_TRUE(r->isOrderSet());

    r->unsetOrder();
    EXPECT_FALSE(r->isOrderSet());
}

// TEST(Reset, removeWhenMethods)
// {
//     libcellml::Reset r;
//     libcellml::WhenPtr w1 = std::make_shared<libcellml::When>();
//     libcellml::WhenPtr w2 = std::make_shared<libcellml::When>();
//     libcellml::WhenPtr w3 = std::make_shared<libcellml::When>();
//     r.addWhen(w1);
//     r.addWhen(w2);

//     EXPECT_TRUE(r.removeWhen(0));
//     EXPECT_EQ(size_t(1), r.whenCount());

//     EXPECT_FALSE(r.removeWhen(1));

//     r.addWhen(w1);
//     r.addWhen(w1);
//     r.addWhen(w1);
//     r.removeWhen(w1);
//     r.removeWhen(w1);
//     EXPECT_EQ(size_t(2), r.whenCount());

//     // Expect no change
//     EXPECT_FALSE(r.removeWhen(w3));
//     EXPECT_EQ(size_t(2), r.whenCount());

//     r.removeAllWhens();
//     EXPECT_EQ(size_t(0), r.whenCount());
// }

// TEST(Reset, whenMethods)
// {
//     libcellml::Reset r;
//     libcellml::WhenPtr c1 = std::make_shared<libcellml::When>();
//     libcellml::WhenPtr c2 = std::make_shared<libcellml::When>();

//     r.addWhen(c1);
//     r.addWhen(c2);

//     libcellml::WhenPtr cA = r.when(0);

//     // Using const version of overloaded method
//     const libcellml::WhenPtr cS = static_cast<const libcellml::Reset>(r).when(0);
//     EXPECT_EQ(int(0), cS->order());

//     // Can do this as we just have a const pointer
//     EXPECT_EQ(nullptr, r.when(4));
// }

// TEST(Reset, takeWhenMethods)
// {
//     libcellml::Reset r;
//     libcellml::WhenPtr c1 = std::make_shared<libcellml::When>();
//     libcellml::WhenPtr c2 = std::make_shared<libcellml::When>();

//     r.addWhen(c1);
//     r.addWhen(c2);

//     libcellml::WhenPtr c02 = r.takeWhen(1);
//     EXPECT_EQ(size_t(1), r.whenCount());
//     EXPECT_EQ(int(0), c02->order());

//     EXPECT_EQ(nullptr, r.takeWhen(4));
// }

// TEST(Reset, replaceWhenMethods)
// {
//     libcellml::Reset r;
//     libcellml::WhenPtr c1 = std::make_shared<libcellml::When>();
//     libcellml::WhenPtr c2 = std::make_shared<libcellml::When>();
//     libcellml::WhenPtr c3 = std::make_shared<libcellml::When>();

//     r.addWhen(c1);
//     r.addWhen(c2);

//     EXPECT_FALSE(r.replaceWhen(5, c3));

//     EXPECT_TRUE(r.replaceWhen(1, c3));
// }

TEST(Reset, constructors)
{
    libcellml::Reset r;
    libcellml::Reset r1;
    libcellml::Reset r2;

    r.setOrder(1);
    // Testing assignment for Reset
    r1 = r;
    EXPECT_EQ(size_t(1), r1.order());

    // Testing move assignment for Reset
    r2 = std::move(r1);
    EXPECT_EQ(size_t(1), r2.order());

    // Testing move constructor for Reset
    libcellml::Reset r3 = std::move(r2);
    EXPECT_EQ(size_t(1), r3.order());
}

TEST(Reset, printResetWithVariable)
{
    const std::string e =<commit_msg>Coverage for reset.cpp (take 2)<commit_after>/*
Copyright libCellML Contributors

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

#include "test_utils.h"

#include "gtest/gtest.h"

#include <libcellml>

TEST(Reset, create)
{
    libcellml::ResetPtr r = std::make_shared<libcellml::Reset>();

    EXPECT_NE(nullptr, r);
}

TEST(Reset, order)
{
    libcellml::ResetPtr r = std::make_shared<libcellml::Reset>();

    EXPECT_FALSE(r->isOrderSet());
    r->setOrder(1);

    EXPECT_EQ(1, r->order());
    EXPECT_TRUE(r->isOrderSet());

    r->unsetOrder();
    EXPECT_FALSE(r->isOrderSet());
}

// TEST(Reset, removeWhenMethods)
// {
//     libcellml::Reset r;
//     libcellml::WhenPtr w1 = std::make_shared<libcellml::When>();
//     libcellml::WhenPtr w2 = std::make_shared<libcellml::When>();
//     libcellml::WhenPtr w3 = std::make_shared<libcellml::When>();
//     r.addWhen(w1);
//     r.addWhen(w2);

//     EXPECT_TRUE(r.removeWhen(0));
//     EXPECT_EQ(size_t(1), r.whenCount());

//     EXPECT_FALSE(r.removeWhen(1));

//     r.addWhen(w1);
//     r.addWhen(w1);
//     r.addWhen(w1);
//     r.removeWhen(w1);
//     r.removeWhen(w1);
//     EXPECT_EQ(size_t(2), r.whenCount());

//     // Expect no change
//     EXPECT_FALSE(r.removeWhen(w3));
//     EXPECT_EQ(size_t(2), r.whenCount());

//     r.removeAllWhens();
//     EXPECT_EQ(size_t(0), r.whenCount());
// }

// TEST(Reset, whenMethods)
// {
//     libcellml::Reset r;
//     libcellml::WhenPtr c1 = std::make_shared<libcellml::When>();
//     libcellml::WhenPtr c2 = std::make_shared<libcellml::When>();

//     r.addWhen(c1);
//     r.addWhen(c2);

//     libcellml::WhenPtr cA = r.when(0);

//     // Using const version of overloaded method
//     const libcellml::WhenPtr cS = static_cast<const libcellml::Reset>(r).when(0);
//     EXPECT_EQ(int(0), cS->order());

//     // Can do this as we just have a const pointer
//     EXPECT_EQ(nullptr, r.when(4));
// }

// TEST(Reset, takeWhenMethods)
// {
//     libcellml::Reset r;
//     libcellml::WhenPtr c1 = std::make_shared<libcellml::When>();
//     libcellml::WhenPtr c2 = std::make_shared<libcellml::When>();

//     r.addWhen(c1);
//     r.addWhen(c2);

//     libcellml::WhenPtr c02 = r.takeWhen(1);
//     EXPECT_EQ(size_t(1), r.whenCount());
//     EXPECT_EQ(int(0), c02->order());

//     EXPECT_EQ(nullptr, r.takeWhen(4));
// }

// TEST(Reset, replaceWhenMethods)
// {
//     libcellml::Reset r;
//     libcellml::WhenPtr c1 = std::make_shared<libcellml::When>();
//     libcellml::WhenPtr c2 = std::make_shared<libcellml::When>();
//     libcellml::WhenPtr c3 = std::make_shared<libcellml::When>();

//     r.addWhen(c1);
//     r.addWhen(c2);

//     EXPECT_FALSE(r.replaceWhen(5, c3));

//     EXPECT_TRUE(r.replaceWhen(1, c3));
// }

TEST(Reset, constructors)
{
    libcellml::Reset r;
    libcellml::Reset r1;
    libcellml::Reset r2;

    r.setOrder(1);
    // Testing assignment for Reset
    r1 = r;
    EXPECT_EQ(1, r1.order());

    // Testing move assignment for Reset
    r2 = std::move(r1);
    EXPECT_EQ(1, r2.order());

    // Testing move constructor for Reset
    libcellml::Reset r3 = std::move(r2);
    EXPECT_EQ(1, r3.order());
}

TEST(Reset, printResetWithVariable)
{
    const std::string e =
{'fraction_non_alphanumeric': 0.17824570815450644, 'fraction_numerical': 0.017837982832618025, 'mean_word_length': 3.236931818181818, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 47, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '6501003', 'n_tokens_mistral': 2718, 'n_tokens_neox': 2728, 'n_words': 530}