<commit_before>/*
 * Copyright(c) Records For Living, Inc. 2004-2011.  All rights reserved
 */
#include	"Stroika/Foundation/StroikaPreComp.h"

#include	<iostream>

#include	"Stroika/Foundation/Characters/String.h"
#include	"Stroika/Foundation/Debug/Assertions.h"
#include	"Stroika/Foundation/Containers/Common.h"
#include	"Stroika/Foundation/Time/Realtime.h"

#include	"../TestHarness/TestHarness.h"


using	namespace	Stroika::Foundation;
using	namespace	Stroika::Foundation::Characters;









namespace	{
	unsigned ipow (unsigned n, unsigned toPow)
		{
			// quick hack since pow didnt seem to do what I want - just blindly
			// multiply and dont worry about overflow...
			unsigned result = 1;
			while (toPow-- != 0) {
				result *= n;
			}
			return (result);
		}
}

namespace	{
	namespace	Test2Helpers_ {
		#if qDebug
			//const	int	kLoopEnd = 1000;
			const	int	kLoopEnd = 500;		// 1000 generates stackoverflow (because of String_Catentate stuff) on Windoze - clearly a Stroika bug!!! To use so much stack
		#else
			const	int	kLoopEnd = 2000;
		#endif

		void	StressTest1_ (String big)
			{
				for (int j = 1; j <= kLoopEnd/50; j++) {
					String_ExternalMemoryOwnership	a (L"a");
					for (int i = 0; i <= kLoopEnd; i++) {
						big += a;
						VerifyTestResult ((big.GetLength () -1) == i);
						VerifyTestResult (big[i] == 'a');
					}
					big.SetLength (0);
				}

				String	s1	=	L"test strings";
				for (int i = 1; i <= kLoopEnd; i++) {
					big += s1;<commit_msg>comments, and got rid of hack to String testsuite - can now do full 1000 runs cuz of various string library improvemnets (mostly losing old string cat rep)<commit_after>/*
 * Copyright(c) Records For Living, Inc. 2004-2011.  All rights reserved
 */
#include	"Stroika/Foundation/StroikaPreComp.h"

#include	<iostream>

#include	"Stroika/Foundation/Characters/String.h"
#include	"Stroika/Foundation/Debug/Assertions.h"
#include	"Stroika/Foundation/Containers/Common.h"
#include	"Stroika/Foundation/Time/Realtime.h"

#include	"../TestHarness/TestHarness.h"


using	namespace	Stroika::Foundation;
using	namespace	Stroika::Foundation::Characters;


/*
 * TODO:
 *
 *
 *		(o)	Must write ASAP a performance comparison suite for String class as part of string automated test.
 *			Print a table of results (X/Y – wstring versus String (maybe versus other string types?)).
 *			Compare inserting into start of vector<STRINGTYPE> - to test copying.
 */







namespace	{
	unsigned ipow (unsigned n, unsigned toPow)
		{
			// quick hack since pow didnt seem to do what I want - just blindly
			// multiply and dont worry about overflow...
			unsigned result = 1;
			while (toPow-- != 0) {
				result *= n;
			}
			return (result);
		}
}

namespace	{
	namespace	Test2Helpers_ {
		#if qDebug
			const	int	kLoopEnd = 1000;
		#else
			const	int	kLoopEnd = 2000;
		#endif

		void	StressTest1_ (String big)
			{
				for (int j = 1; j <= kLoopEnd/50; j++) {
					String_ExternalMemoryOwnership	a (L"a");
					for (int i = 0; i <= kLoopEnd; i++) {
						big += a;
						VerifyTestResult ((big.GetLength () -1) == i);
						VerifyTestResult (big[i] == 'a');
					}
					big.SetLength (0);
				}

				String	s1	=	L"test strings";
				for (int i = 1; i <= kLoopEnd; i++) {
					big += s1;
{'fraction_non_alphanumeric': 0.12484624846248463, 'fraction_numerical': 0.021217712177121772, 'mean_word_length': 3.122940430925222, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 6, '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': '3343449', 'n_tokens_mistral': 1342, 'n_tokens_neox': 1115, 'n_words': 341}