<commit_before>#include "aquila/global.h"
#include "aquila/source/generator/SquareGenerator.h"
#include <unittestpp.h>
#include <algorithm>
#include <cstddef>

SUITE(SquareGenerator)
{
    // sample frequency is fixed at 1 kHz, signal frequency at 10 Hz
    Aquila::SquareGenerator gen(1000);
    auto isPositive = [](double x) { return x > 0; };

    // prints number of positive samples in generated signal
    TEST(DutyCycle05)
    {
        double duty = 0.5;
        gen.setDuty(duty).setAmplitude(1).setFrequency(10).generate(1000);
        int samplesCount = std::count_if(gen.begin(), gen.end(), isPositive);
        CHECK_EQUAL(500, samplesCount);
    }

    TEST(DutyCycle025)
    {
        double duty = 0.25;
        gen.setDuty(duty).setAmplitude(1).setFrequency(10).generate(1000);
        int samplesCount = std::count_if(gen.begin(), gen.end(), isPositive);
        CHECK_EQUAL(250, samplesCount);<commit_msg>Improved comments in SquareGenerator tests.<commit_after>#include "aquila/global.h"
#include "aquila/source/generator/SquareGenerator.h"
#include <unittestpp.h>
#include <algorithm>
#include <cstddef>

SUITE(SquareGenerator)
{
    // sample frequency is fixed at 1 kHz
    Aquila::SquareGenerator gen(1000);
    auto isPositive = [](double x) { return x > 0; };

    // counts number of positive samples in generated signal
    TEST(DutyCycle05)
    {
        double duty = 0.5;
        gen.setDuty(duty).setAmplitude(1).setFrequency(10).generate(1000);
        int samplesCount = std::count_if(gen.begin(), gen.end(), isPositive);
        CHECK_EQUAL(500, samplesCount);
    }

    TEST(DutyCycle025)
    {
        double duty = 0.25;
        gen.setDuty(duty).setAmplitude(1).setFrequency(10).generate(1000);
        int samplesCount = std::count_if(gen.begin(), gen.end(), isPositive);
        CHECK_EQUAL(250, samplesCount);
{'fraction_non_alphanumeric': 0.13275769023205614, 'fraction_numerical': 0.03993524015110631, 'mean_word_length': 3.510948905109489, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, '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': '7238347', 'n_tokens_mistral': 659, 'n_tokens_neox': 590, 'n_words': 126}