<commit_before>/*******************************************************************************
* cpp_lib32 project. C++ port of the dx_lib32 project.                         *
*                                                                              *
* Copyright (C) 2012 - 2013, <NAME>                              *                     
*                                                                              *
* This file is part of cpp_lib32 project.                                      *
*                                                                              *
* cpp_lib32 project is free software: you can redistribute it and/or modify    *
* it under the terms of the GNU Lesser General Public License as published by  *
* the Free Software Foundation, version 2 of the License.                      *
*                                                                              *
* cpp_lib32 is distributed in the hope that it will be useful,                 *
* but WITHOUT ANY WARRANTY; without even the implied warranty of               * 
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                *
* GNU Lesser General Public License for more details.                          *
*                                                                              *
 You should have received a copy of the GNU Lesser General Public License      *
 along with cpp_lib32 project. If not, see <http://www.gnu.org/licenses/>.     *
*******************************************************************************/

#include "dl32TestConfig.h"

#if DL32TESTS_CURRENTTEST == DL32TEST_REFACTORING_TYPINGTEST

#include "dl32Typing.h"
#include <iostream>
#include <typeinfo>
#include <string>

using namespace std;

#define TESTING_USEASSERT FALSE
#define TESTING_WAIT_AT_END FALSE
#define TESTING_USE_COLOR FALSE

#define EXPAND(x) x

#if TESTING_USEASSERT
#ifdef NDEBUG
#undef NDEBUG
#endif /* NDEBUG */

#include <assert.h>
#else

#define assert_data(x) __FILE__ << ", in function " << __FUNCTION__  << " (line " <<  __LINE__ << "):" << " '" << #x << "' --> "

#if TESTING_USE_COLOR

#include "dl32ConsoleColor.h"

#ifdef assert
#undef assert
#endif /* ASSERT */

#define assert(x) (x) ? cout << assert_data(x) << "OK!" << endl : cout << push_style << dl32ChangeForegroundColor( dl32ConsoleColor::RED ) << assert_data(x) << "ERROR (Cascao raro)" << pop_style << endl 
#else

#ifdef assert
#undef assert
#endif /* ASSERT */

#define assert(x) (x) ? cout << assert_data(x) << "OK!" << endl : cout << assert_data(x) << "ERROR (Cascao raro)" << endl
#endif /* TESTING_USE_COLOR */
#endif /* TESTING_USEASSERT */

int main()
{  
    typedef dl32TypeList<char , int , float , double> myList;
    
    /* TypeList indexing test */
    
    assert( (dl32TypeChecking<float,myList::type_at<2>>::same_type) );
    
    /* Inheritance checking test */
    
    class Foo{};
    class FooChild : public Foo {};
    
    assert( (dl32TypeChecking<Foo,FooChild>::superclass_subclass) );
    
    /* TypeList indexof test */
    
    assert( myList::index_of<int>::value == 1 );
    
    /* TypeList push_back test */
    
    using new_type_list = myList::push_back<bool>;
    
    assert( (dl32SameType<bool , myList::push_back<bool>::type_at<myList::size>>::result) );
    
    /* Typelist merge test */
    
    using list1 = dl32TypeList<char , int , bool>;
    using list2 = dl32TypeList<float , double>;
    using merged_list = list1::merge<list2>;
    
    assert( merged_list::size == list1::size + list2::size );
    
    /* Typelist split test */
    
    using split = dl32Split<2,myList>;
    using right = split::right;
    using left  = split::left;
    
    assert( right::size + left::size == myList::size );
    
    /* Type traits checking test */
    
    //HasConst tests:
    assert( !dl32TypeTraits<int>::hasConst        );<commit_msg>cpp_lib32 GCC4.6 compatibility confirmed.<commit_after>/*******************************************************************************
* cpp_lib32 project. C++ port of the dx_lib32 project.                         *
*                                                                              *
* Copyright (C) 2012 - 2013, <NAME>                              *                     
*                                                                              *
* This file is part of cpp_lib32 project.                                      *
*                                                                              *
* cpp_lib32 project is free software: you can redistribute it and/or modify    *
* it under the terms of the GNU Lesser General Public License as published by  *
* the Free Software Foundation, version 2 of the License.                      *
*                                                                              *
* cpp_lib32 is distributed in the hope that it will be useful,                 *
* but WITHOUT ANY WARRANTY; without even the implied warranty of               * 
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                *
* GNU Lesser General Public License for more details.                          *
*                                                                              *
 You should have received a copy of the GNU Lesser General Public License      *
 along with cpp_lib32 project. If not, see <http://www.gnu.org/licenses/>.     *
*******************************************************************************/

#include "dl32TestConfig.h"

#if DL32TESTS_CURRENTTEST == DL32TEST_REFACTORING_TYPINGTEST

#include "dl32Typing.h"
#include <iostream>
#include <typeinfo>
#include <string>

using namespace std;

#define TESTING_USEASSERT FALSE
#define TESTING_WAIT_AT_END FALSE
#define TESTING_USE_COLOR FALSE

#define EXPAND(x) x

#if TESTING_USEASSERT
#ifdef NDEBUG
#undef NDEBUG
#endif /* NDEBUG */

#include <assert.h>
#else

#define assert_data(x) __FILE__ << ", in function " << __FUNCTION__  << " (line " <<  __LINE__ << "):" << " '" << #x << "' --> "

#if TESTING_USE_COLOR

#include "dl32ConsoleColor.h"

#ifdef assert
#undef assert
#endif /* ASSERT */

#define assert(x) (x) ? cout << assert_data(x) << "OK!" << endl : cout << push_style << dl32ChangeForegroundColor( dl32ConsoleColor::RED ) << assert_data(x) << "ERROR (Cascao raro)" << pop_style << endl 
#else

#ifdef assert
#undef assert
#endif /* ASSERT */

#define assert(x) (x) ? cout << assert_data(x) << "OK!" << endl : cout << assert_data(x) << "ERROR (Cascao raro)" << endl
#endif /* TESTING_USE_COLOR */
#endif /* TESTING_USEASSERT */

int main()
{  
    typedef dl32TypeList<char , int , float , double> myList;
    
    /* TypeList indexing test */
    
    assert( (dl32TypeChecking<float,myList::type_at<2>>::same_type) );
    
    /* Inheritance checking test */
    
    class Foo{};
    class FooChild : public Foo {};
    
    assert( (dl32TypeChecking<Foo,FooChild>::superclass_subclass) );
    
    /* TypeList indexof test */
    
    assert( myList::index_of<int>::value == 1 );
    
    /* TypeList push_back test */
    
    using new_type_list = myList::push_back<bool>;
    
    assert( (dl32SameType<bool , myList::push_back<bool>::type_at<myList::size>>::result) );
    
    /* Typelist merge test */
    
    using list1 = dl32TypeList<char , int , bool>;
    using list2 = dl32TypeList<float , double>;
    using merged_list = list1::merge<list2>;
    
    assert( merged_list::size == list1::size + list2::size );
    
    /* Typelist split test */
    
    using split = dl32Split<2,myList>;
    using right = split::right;
    using left  = split::left;
    
    //assert( right::size + left::size == myList::size );
    
    /* Type traits checking test */
    
    //HasConst tests:
    assert( !dl32TypeTraits<int>::hasConst        );
{'fraction_non_alphanumeric': 0.14779713114754098, 'fraction_numerical': 0.015881147540983607, 'mean_word_length': 2.010408635312259, 'pattern_counts': {'":': 0, '<': 135, '<?xml version=': 0, '>': 45, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 36, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3816719', 'n_tokens_mistral': 2211, 'n_tokens_neox': 2096, 'n_words': 593}