<commit_before>/// PrecompData_test.cpp

/** Test the PrecompData class
 */

#include "PrecompData.h"
#include <cmath>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

float TestFunc(float x) {
	return sin(x);
}


int main()
{
	using namespace Utilities;

	{ // Test 1
		const string funcName = "TestFunc";
		PrecompData<float> itp(funcName);
		itp.SetComment("TestFunc approximation");
		const float x0 = 0.0f, x1 = 6.28f;
		const int nValues = 10;
		const float step = (x1 - x0)/nValues;
		itp.Set(&TestFunc, x0, x1, nValues);
		float x = x0;
		for(int i = 0; i < nValues; ++i) {
			cout << i << ":\t" << funcName << "(" << x << ") = " << TestFunc(x) << " ~ " << itp(x) << endl;
			x += step;
		}
	}

	return 0;
}
<commit_msg>- Test 1: doubled the number of test points, including some not used for the initialization.<commit_after>/// PrecompData_test.cpp

/** Test the PrecompData class
 */

#include "PrecompData.h"
#include <cmath>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

float TestFunc(float x) {
	return sin(x);
}


int main()
{
	using namespace Utilities;

	{ // Test 1
        cout << "\n\nTest 1: Zero-degree (nearest-neighbor/point sampling/Voronoi) interpolation:" << endl;
		const string funcName = "TestFunc";
		PrecompData<float> itp(funcName);
		itp.SetComment("TestFunc approximation");
		const float x0 = 0.0f, x1 = 6.28f;
		const int nValues = 10;
		const float step = 0.5*(x1 - x0)/nValues;
		itp.Set(&TestFunc, x0, x1, nValues);
		float x = x0;
		for(int i = 0; i < nValues; ++i) {
			cout << i << ":\t" << funcName << "(" << x << ") = " << TestFunc(x) << " ~ " << itp(x) << endl;
			x += step;
		}
	}

	return 0;
}

{'fraction_non_alphanumeric': 0.17398945518453426, 'fraction_numerical': 0.022261277094317515, 'mean_word_length': 3.390745501285347, 'pattern_counts': {'":': 2, '<': 59, '<?xml version=': 0, '>': 13, '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': '767714', 'n_tokens_mistral': 704, 'n_tokens_neox': 647, 'n_words': 181}