<commit_before>//=======================================================================
// Copyright (c) 2014 <NAME>
// Distributed under the terms of the MIT License.
// (See accompanying file LICENSE or copy at
//  http://opensource.org/licenses/MIT)
//=======================================================================

#include "catch.hpp"

#include "etl/fast_matrix.hpp"
#include "etl/fast_vector.hpp"
#include "etl/dyn_matrix.hpp"
#include "etl/dyn_vector.hpp"

///{{{ sequence_generator

TEST_CASE( "sequence/fast_vector_1", "generator" ) {
    etl::fast_vector<double, 3> b;

    b = etl::sequence_generator();

    REQUIRE(b[0] == 0.0);
    REQUIRE(b[1] == 1.0);
    REQUIRE(b[2] == 2.0);
}

TEST_CASE( "sequence/fast_vector_2", "generator" ) {
    etl::fast_vector<double, 3> b;

    b = etl::sequence_generator(99);

    REQUIRE(b[0] == 99.0);
    REQUIRE(b[1] == 100.0);
    REQUIRE(b[2] == 101.0);
}

TEST_CASE( "sequence/fast_matrix_1", "generator" ) {
    etl::fast_matrix<double, 3,2> b;

    b = etl::sequence_generator();

    REQUIRE(b(0,0) == 0.0);
    REQUIRE(b(0,1) == 1.0);
    REQUIRE(b(1,0) == 2.0);
    REQUIRE(b(1,1) == 3.0);
    REQUIRE(b(2,0) == 4.0);
    REQUIRE(b(2,1) == 5.0);
}

TEST_CASE( "sequence/fast_matrix_2", "generator" ) {
    etl::fast_matrix<double, 3,2> b;

    b = 0.1 * etl::sequence_generator();

    REQUIRE(b(0,0) == Approx(0.0));
    REQUIRE(b(0,1) == Approx(0.1));
    REQUIRE(b(1,0) == Approx(0.2));
    REQUIRE(b(1,1) == Approx(0.3));
    REQUIRE(b(2,0) == Approx(0.4));
    REQUIRE(b(2,1) == Approx(0.5));
}

TEST_CASE( "sequence/dyn_vector_1", "generator" ) {
    etl::dyn_vector<double> b(3);

    b = etl::sequence_generator();

    REQUIRE(b[0] == 0.0);
    REQUIRE(b[1] == 1.0);
    REQUIRE(b[2] == 2.0);
}

TEST_CASE( "sequence/dyn_matrix_1", "generator" ) {
    etl::dyn_matrix<double> b(3,2);

    b = etl::sequence_generator();

    REQUIRE(b(0,0) == 0.0);
    REQUIRE(b(0,1) == 1.0);
    REQUIRE(b(1,0) == 2.0);
    REQUIRE(b(1,1) == 3.0);
    REQUIRE(b(2,0) == 4.0);
    REQUIRE(b(2,1) == 5.0);
}

///}}}

///{{{ normal_generator<commit_msg>New test case<commit_after>//=======================================================================
// Copyright (c) 2014 <NAME>
// Distributed under the terms of the MIT License.
// (See accompanying file LICENSE or copy at
//  http://opensource.org/licenses/MIT)
//=======================================================================

#include "catch.hpp"

#include "etl/fast_matrix.hpp"
#include "etl/fast_vector.hpp"
#include "etl/dyn_matrix.hpp"
#include "etl/dyn_vector.hpp"

///{{{ sequence_generator

TEST_CASE( "sequence/fast_vector_1", "generator" ) {
    etl::fast_vector<double, 3> b;

    b = etl::sequence_generator();

    REQUIRE(b[0] == 0.0);
    REQUIRE(b[1] == 1.0);
    REQUIRE(b[2] == 2.0);
}

TEST_CASE( "sequence/fast_vector_2", "generator" ) {
    etl::fast_vector<double, 3> b;

    b = etl::sequence_generator(99);

    REQUIRE(b[0] == 99.0);
    REQUIRE(b[1] == 100.0);
    REQUIRE(b[2] == 101.0);
}

TEST_CASE( "sequence/fast_matrix_1", "generator" ) {
    etl::fast_matrix<double, 3,2> b;

    b = etl::sequence_generator();

    REQUIRE(b(0,0) == 0.0);
    REQUIRE(b(0,1) == 1.0);
    REQUIRE(b(1,0) == 2.0);
    REQUIRE(b(1,1) == 3.0);
    REQUIRE(b(2,0) == 4.0);
    REQUIRE(b(2,1) == 5.0);
}

TEST_CASE( "sequence/fast_matrix_2", "generator" ) {
    etl::fast_matrix<double, 3,2> b;

    b = 0.1 * etl::sequence_generator();

    REQUIRE(etl::etl_traits<std::decay_t<decltype(0.1 * etl::sequence_generator())>>::is_generator);

    REQUIRE(b(0,0) == Approx(0.0));
    REQUIRE(b(0,1) == Approx(0.1));
    REQUIRE(b(1,0) == Approx(0.2));
    REQUIRE(b(1,1) == Approx(0.3));
    REQUIRE(b(2,0) == Approx(0.4));
    REQUIRE(b(2,1) == Approx(0.5));
}

TEST_CASE( "sequence/fast_matrix_3", "generator" ) {
    etl::fast_matrix<double, 3,2> b(1.0);

    b = 0.1 * etl::sequence_generator() + b;

    REQUIRE(b(0,0) == Approx(1.0));
    REQUIRE(b(0,1) == Approx(1.1));
    REQUIRE(b(1,0) == Approx(1.2));
    REQUIRE(b(1,1) == Approx(1.3));
    REQUIRE(b(2,0) == Approx(1.4));
    REQUIRE(b(2,1) == Approx(1.5));
}

TEST_CASE( "sequence/dyn_vector_1", "generator" ) {
    etl::dyn_vector<double> b(3);

    b = etl::sequence_generator();

    REQUIRE(b[0] == 0.0);
    REQUIRE(b[1] == 1.0);
    REQUIRE(b[2] == 2.0);
}

TEST_CASE( "sequence/dyn_matrix_1", "generator" ) {
    etl::dyn_matrix<double> b(3,2);

    b = etl::sequence_generator();

    REQUIRE(b(0,0) == 0.0);
    REQUIRE(b(0,1) == 1.0);
    REQUIRE(b(1,0) == 2.0);
    REQUIRE(b(1,1) == 3.0);
    REQUIRE(b(2,0) == 4.0);
    REQUIRE(b(2,1) == 5.0);
}

///}}}

///{{{ normal_generator
{'fraction_non_alphanumeric': 0.27937726594156537, 'fraction_numerical': 0.06120708040093837, 'mean_word_length': 3.805327868852459, 'pattern_counts': {'":': 0, '<': 20, '<?xml version=': 0, '>': 20, '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': '6051215', 'n_tokens_mistral': 2208, 'n_tokens_neox': 2026, 'n_words': 293}