<commit_before>// iutest_mfc_sample.cpp : R\[ AvP[ṼGg |Cg`܂B
//

#include "stdafx.h"
#include "iutest_mfc_sample.h"
#include "iutest.hpp"

#ifdef _DEBUG
#define new DEBUG_NEW
#endif


// B̃AvP[V IuWFNgłB

CWinApp theApp;

using namespace std;

int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
	int nRetCode = 0;

	HMODULE hModule = ::GetModuleHandle(NULL);

	if (hModule != NULL)
	{
		// MFC āAG[̏ꍇ͌ʂ܂B
		if (!AfxWinInit(hModule, NULL, ::GetCommandLine(), 0))
		{
			// TODO: KvɉăG[ R[hύXĂB
			_tprintf(_T("vIȃG[: MFC ̏ł܂łB\n"));
			nRetCode = 1;
		}
		else
		{
			// TODO: AvP[V̓LqR[hɑ}ĂB
			IUTEST_INIT(&argc, argv);
			nRetCode = IUTEST_RUN_ALL_TESTS();
		}
	}
	else
	{
		// TODO: KvɉăG[ R[hύXĂB
		_tprintf(_T("vIȃG[: GetModuleHandle s܂\n"));
		nRetCode = 1;
	}

	return nRetCode;
}

IUTEST(MFC, String)
{
	CString str = _T("Test");
	IUTEST_ASSERT_EQ(_T("Test"), str);
	IUTEST_ASSERT_STREQ(_T("Test"), str);
	IUTEST_ASSERT_STREQ(str, str);

	IUTEST_ASSERT_STRIN(str, _T("Test"));
}

IUTEST(MFC, Rect)
{
	CRect r = { 0, 0, 100, 100 };
	IUTEST_ASSERT_EQ(r, r);
}

IUTEST(MFC, List)
{
	int a[10];
	CList<int> list;
	for(int i = 0; i < IUTEST_PP_COUNTOF(a); ++i)
	{
		a[i] = i;
		list.AddTail(i);
	}
	IUTEST_ASSERT_EQ_COLLECTIONS(
		  ::iutest::mfc::begin(list)
		, ::iutest::mfc::end(list)
		, ::std::begin(a)
		, ::std::end(a)
	);
}

IUTEST(MFC, Array)
{
	int a[10];
	CArray<int> ar;
	ar.SetSize(IUTEST_PP_COUNTOF(a));
	for(int i = 0; i < IUTEST_PP_COUNTOF(a); ++i)
	{
		a[i] = i;
		ar[i] = i;
	}
	IUTEST_ASSERT_EQ_COLLECTIONS(
		  ::iutest::mfc::begin(ar)
		, ::iutest::mfc::end(ar)
		, ::std::begin(a)
		, ::std::end(a)
		);
}

IUTEST(MFC, Map)
{
	CMap<int, int, int, int> map;
	CMapStringToOb ms;
}

template<typename T>
struct test_value
{
	static T get(int index) { return index; }
};
template<typename T>
struct test_value< T* >
{
	static T* get(int index) { return NULL; }
};

template<typename T>
class MFCArrayTypedTest : public ::iutest::Test {};
IUTEST_TYPED_TEST_CASE(MFCArrayTypedTest, ::iutest::Types<CByteArray, CWordArray, CDWordArray, CUIntArray, CPtrArray, CObArray>);

IUTEST_TYPED_TEST(MFCArrayTypedTest, EqCollections)
{
	struct X : public TypeParam { using TypeParam::BASE_TYPE; };
	typename X::BASE_TYPE a[10];
	TypeParam ar;
	ar.SetSize(IUTEST_PP_COUNTOF(a));
	for(int i = 0; i < IUTEST_PP_COUNTOF(a); ++i)
	{
		a[i] = test_value<X::BASE_TYPE>::get(i);
		ar[i] = test_value<X::BASE_TYPE>::get(i);
	}
	IUTEST_ASSERT_EQ_COLLECTIONS(
		  ::iutest::mfc::begin(ar)
		, ::iutest::mfc::end(ar)
		, ::std::begin(a)
		, ::std::end(a)
		);
}

template<typename T>
class MFCListTypedTest : public ::iutest::Test {};
IUTEST_TYPED_TEST_CASE(MFCListTypedTest, ::iutest::Types<CPtrList, CObList>);

IUTEST_TYPED_TEST(MFCListTypedTest, EqCollections)
{
	struct X : public TypeParam { using TypeParam::BASE_TYPE; };
	typename X::BASE_TYPE a[10];
	TypeParam list;
	for(int i = 0; i < IUTEST_PP_COUNTOF(a); ++i)
	{
		a[i] = test_value<X::BASE_TYPE>::get(i);
		list.AddTail(test_value<X::BASE_TYPE>::get(i));
	}
	IUTEST_ASSERT_EQ_COLLECTIONS(
		  ::iutest::mfc::begin(list)
		, ::iutest::mfc::end(list)
		, ::std::begin(a)
		, ::std::end(a)
		);<commit_msg>update r890<commit_after>// iutest_mfc_sample.cpp : R\[ AvP[ṼGg |Cg`܂B
//

#include "stdafx.h"
#include "iutest_mfc_sample.h"
#include "iutest.hpp"

#ifdef _DEBUG
#define new DEBUG_NEW
#endif


// B̃AvP[V IuWFNgłB

CWinApp theApp;

using namespace std;

int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
	int nRetCode = 0;

	HMODULE hModule = ::GetModuleHandle(NULL);

	if (hModule != NULL)
	{
		// MFC āAG[̏ꍇ͌ʂ܂B
		if (!AfxWinInit(hModule, NULL, ::GetCommandLine(), 0))
		{
			// TODO: KvɉăG[ R[hύXĂB
			_tprintf(_T("vIȃG[: MFC ̏ł܂łB\n"));
			nRetCode = 1;
		}
		else
		{
			// TODO: AvP[V̓LqR[hɑ}ĂB
			IUTEST_INIT(&argc, argv);
			nRetCode = IUTEST_RUN_ALL_TESTS();
		}
	}
	else
	{
		// TODO: KvɉăG[ R[hύXĂB
		_tprintf(_T("vIȃG[: GetModuleHandle s܂\n"));
		nRetCode = 1;
	}

	return nRetCode;
}

IUTEST(MFC, String)
{
	CString str = _T("Test");
	IUTEST_ASSERT_EQ(_T("Test"), str);
	IUTEST_ASSERT_STREQ(_T("Test"), str);
	IUTEST_ASSERT_STREQ(str, str);

	IUTEST_ASSERT_STRIN(str, _T("Test"));
}

IUTEST(MFC, Rect)
{
	CRect r = { 0, 0, 100, 100 };
	IUTEST_ASSERT_EQ(r, r);
}

IUTEST(MFC, List)
{
	int a[10];
	CList<int> list;
	for(int i = 0; i < IUTEST_PP_COUNTOF(a); ++i)
	{
		a[i] = i;
		list.AddTail(i);
	}
	IUTEST_ASSERT_EQ_COLLECTIONS(
		  ::iutest::mfc::begin(list)
		, ::iutest::mfc::end(list)
		, ::std::begin(a)
		, ::std::end(a)
	);
}

IUTEST(MFC, Array)
{
	int a[10];
	CArray<int> ar;
	ar.SetSize(IUTEST_PP_COUNTOF(a));
	for(int i = 0; i < IUTEST_PP_COUNTOF(a); ++i)
	{
		a[i] = i;
		ar[i] = i;
	}
	IUTEST_ASSERT_EQ_COLLECTIONS(
		  ::iutest::mfc::begin(ar)
		, ::iutest::mfc::end(ar)
		, ::std::begin(a)
		, ::std::end(a)
		);
}

IUTEST(MFC, Map)
{
	CMap<int, int, int, int> map;
	CMapStringToOb ms;
}

template<typename T>
struct test_value
{
	static T get(int index) { return index; }
};
template<typename T>
struct test_value< T* >
{
	static T* get(int index) { return NULL; }
};
template<>
struct test_value < CString >
{
	static CString get(int index) { CString s; s.Format(_T("%d"), index); return s; }
};

template<typename T>
class MFCArrayTypedTest : public ::iutest::Test {};
IUTEST_TYPED_TEST_CASE(MFCArrayTypedTest, ::iutest::Types<CByteArray, CWordArray, CDWordArray, CUIntArray, CStringArray, CPtrArray, CObArray>);

IUTEST_TYPED_TEST(MFCArrayTypedTest, EqCollections)
{
	struct X : public TypeParam { using TypeParam::BASE_TYPE; };
	typename X::BASE_TYPE a[10];
	TypeParam ar;
	ar.SetSize(IUTEST_PP_COUNTOF(a));
	for(int i = 0; i < IUTEST_PP_COUNTOF(a); ++i)
	{
		a[i] = test_value<X::BASE_TYPE>::get(i);
		ar[i] = test_value<X::BASE_TYPE>::get(i);
	}
	IUTEST_ASSERT_EQ_COLLECTIONS(
		  ::iutest::mfc::begin(ar)
		, ::iutest::mfc::end(ar)
		, ::std::begin(a)
		, ::std::end(a)
		);
}

template<typename T>
class MFCListTypedTest : public ::iutest::Test {};
IUTEST_TYPED_TEST_CASE(MFCListTypedTest, ::iutest::Types<CStringList, CPtrList, CObList>);

IUTEST_TYPED_TEST(MFCListTypedTest, EqCollections)
{
	struct X : public TypeParam { using TypeParam::BASE_TYPE; };
	typename X::BASE_TYPE a[10];
	TypeParam list;
	for(int i = 0; i < IUTEST_PP_COUNTOF(a); ++i)
	{
		a[i] = test_value<X::BASE_TYPE>::get(i);
		list.AddTail(test_value<X::BASE_TYPE>::get(i));
	}
	IUTEST_ASSERT_EQ_COLLECTIONS(
		  ::iutest::mfc::begin(list)
		, ::iutest::mfc::end(list)
		, ::std::begin(a)
		, ::std::end(a)
		);
{'fraction_non_alphanumeric': 0.187268803945746, 'fraction_numerical': 0.007860665844636251, 'mean_word_length': 4.899090909090909, 'pattern_counts': {'":': 0, '<': 41, '<?xml version=': 0, '>': 33, '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': '6876147', 'n_tokens_mistral': 3252, 'n_tokens_neox': 3098, 'n_words': 509}