<commit_before>//  
// Copyright (C) 2007 SIPez LLC. 
// Licensed to SIPfoundry under a Contributor Agreement. 
//
// Copyright (C) 2007 SIPfoundry Inc.
// Licensed by SIPfoundry under the LGPL license.
//
// $$
///////////////////////////////////////////////////////////////////////////////

#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/TestCase.h>
#include <sipxunit/TestUtilities.h>

#include <mp/MpAudioBuf.h>

#define AUDIOBUF_TEST_SAMPLES_PER_FRAME 80
#define BUFFER_NUM    5

/**
 * Unittest for MpAudioBuf
 */
class MpAudioBufTest : public CppUnit::TestCase
{
    CPPUNIT_TEST_SUITE(MpAudioBufTest);
    CPPUNIT_TEST(testSampleCompare);
    CPPUNIT_TEST_SUITE_END();


public:

    void setUp()
    {
        // Create pool for data buffers
        mpPool = 
            new MpBufPool((AUDIOBUF_TEST_SAMPLES_PER_FRAME * sizeof(MpAudioSample)), 
                          BUFFER_NUM);
        CPPUNIT_ASSERT(mpPool != NULL);

        // Create pool for buffer headers
        mpHeadersPool = new MpBufPool(sizeof(MpAudioBuf), BUFFER_NUM);
        CPPUNIT_ASSERT(mpHeadersPool != NULL);

        // Set mpHeadersPool as default pool for audio and data pools.<commit_msg>Fix MpAudioBufTest: memory for MpArrayBuf header should be reserved when creating pool.<commit_after>//  
// Copyright (C) 2007 SIPez LLC. 
// Licensed to SIPfoundry under a Contributor Agreement. 
//
// Copyright (C) 2007 SIPfoundry Inc.
// Licensed by SIPfoundry under the LGPL license.
//
// $$
///////////////////////////////////////////////////////////////////////////////

#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/TestCase.h>
#include <sipxunit/TestUtilities.h>

#include <mp/MpAudioBuf.h>

#define AUDIOBUF_TEST_SAMPLES_PER_FRAME 80
#define BUFFER_NUM    5

/**
 * Unittest for MpAudioBuf
 */
class MpAudioBufTest : public CppUnit::TestCase
{
    CPPUNIT_TEST_SUITE(MpAudioBufTest);
    CPPUNIT_TEST(testSampleCompare);
    CPPUNIT_TEST_SUITE_END();


public:

    void setUp()
    {
        // Create pool for data buffers
        mpPool = 
            new MpBufPool((AUDIOBUF_TEST_SAMPLES_PER_FRAME * sizeof(MpAudioSample))
                             + MpArrayBuf::getHeaderSize(), 
                          BUFFER_NUM);
        CPPUNIT_ASSERT(mpPool != NULL);

        // Create pool for buffer headers
        mpHeadersPool = new MpBufPool(sizeof(MpAudioBuf), BUFFER_NUM);
        CPPUNIT_ASSERT(mpHeadersPool != NULL);

        // Set mpHeadersPool as default pool for audio and data pools.
{'fraction_non_alphanumeric': 0.1519238397461325, 'fraction_numerical': 0.00872669575565252, 'mean_word_length': 2.318421052631579, 'pattern_counts': {'":': 0, '<': 11, '<?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': '4142331', 'n_tokens_mistral': 794, 'n_tokens_neox': 755, 'n_words': 181}