<commit_before>#include "tests.h"
#include <math.h>
#include <stdio.h>

#define TRUE 1
#define FALSE 0

int main(int arcg, char **argv){
	errorMessage = "";
	errorValue = 1337;
	if(!testAll()){
		printf("Test Failed: %s with value: %f\n", errorMessage, errorValue);
	}else{
		printf("Tests Passed\n");
	}
}

int testAll(){
	return testHaar() && testLog2();
}

// Haar tests
int testHaarWave(){
	if(haar_wavelet(-1.0) != 0.0){
		errorValue = haar_wavelet(-1.0);
		errorMessage = "Haar Wavelet function for -1.0";
		return FALSE;
	}else if(haar_wavelet(-0.0) != 1.0){
		errorValue = haar_wavelet(-0.0);
		errorMessage = "Haar Wavelet function for -0.0";
		return FALSE;
	}else if(haar_wavelet(0.25) != 1.0){
		errorValue = haar_wavelet(0.25);
		errorMessage = "Haar Wavelet function for 0.25";
		return FALSE;
	}else if(haar_wavelet(0.5) != -1.0){
		errorValue = haar_wavelet(0.5);
		errorMessage = "Haar Wavelet function for 0.5";
		return FALSE;
	}else if(haar_wavelet(0.75) != -1.0){
		errorValue = haar_wavelet(0.75);
		errorMessage = "Haar Wavelet function for 0.75";
		return FALSE;
	}else if(haar_wavelet(1.0) != 0.0){
		errorValue = haar_wavelet(1.0);
		errorMessage = "Haar Wavelet function for 1.0";
		return FALSE;
	}else if(haar_wavelet(HUGE_VAL) != 0.0){
		errorValue = haar_wavelet(HUGE_VAL);
		errorMessage = "Haar Wavelet function for infinty";
		return FALSE;
	}
	return TRUE;
}

int testHaarScale(){
	
	return TRUE;
}

int testHaar(){
	return testHaarScale() && testHaarWave();
}

int testLog2(){
	int position = 32;
	for(int i = 0x100000000; i > 0; i >>= 1){
		if(logBase2(i) != position){
			errorValue = logBase2(i);
			errorMessage = "logBase2 Failed";<commit_msg>Add tests for the Haar scaling function<commit_after>#include "tests.h"
#include <math.h>
#include <stdio.h>

#define TRUE 1
#define FALSE 0

int main(int arcg, char **argv){
	errorMessage = "";
	errorValue = 1337;
	if(!testAll()){
		printf("Test Failed: %s with value: %f\n", errorMessage, errorValue);
	}else{
		printf("Tests Passed\n");
	}
}

int testAll(){
	return testHaar() && testLog2();
}

// Haar tests
int testHaarWave(){
	if(haar_wavelet(-1.0) != 0.0){
		errorValue = haar_wavelet(-1.0);
		errorMessage = "Haar Wavelet function for -1.0";
		return FALSE;
	}else if(haar_wavelet(-0.0) != 1.0){
		errorValue = haar_wavelet(-0.0);
		errorMessage = "Haar Wavelet function for -0.0";
		return FALSE;
	}else if(haar_wavelet(0.25) != 1.0){
		errorValue = haar_wavelet(0.25);
		errorMessage = "Haar Wavelet function for 0.25";
		return FALSE;
	}else if(haar_wavelet(0.5) != -1.0){
		errorValue = haar_wavelet(0.5);
		errorMessage = "Haar Wavelet function for 0.5";
		return FALSE;
	}else if(haar_wavelet(0.75) != -1.0){
		errorValue = haar_wavelet(0.75);
		errorMessage = "Haar Wavelet function for 0.75";
		return FALSE;
	}else if(haar_wavelet(1.0) != 0.0){
		errorValue = haar_wavelet(1.0);
		errorMessage = "Haar Wavelet function for 1.0";
		return FALSE;
	}else if(haar_wavelet(HUGE_VAL) != 0.0){
		errorValue = haar_wavelet(HUGE_VAL);
		errorMessage = "Haar Wavelet function for infinty";
		return FALSE;
	}
	return TRUE;
}

int testHaarScale(){
	if(haar_scaling(-1.0) != 0){
		errorValue = haar_scaling(-1.0);
		errorMessage = "Haar Scale function for -1.0";
		return FALSE;
	}else if(haar_scaling(0.0) != 1){
		errorValue = haar_scaling(0.0);
		errorMessage = "Haar Scale function for 0.0";
		return FALSE;
	}else if(haar_scaling(-0.0) != 1){
		errorValue = haar_scaling(-0.0);
		errorMessage = "Haar Scale function for -0.0";
		return FALSE;
	}else if(haar_scaling(0.25) != 1){
		errorValue = haar_scaling(0.25);
		errorMessage = "Haar Scale function for 0.25";
		return FALSE;
	}else if(haar_scaling(1.0) != 0){
		errorValue = haar_scaling(1.0);
		errorMessage = "Haar Scale function for 1.0";
		return FALSE;
	}
	return TRUE;
}

int testHaar(){
	return testHaarScale() && testHaarWave();
}

int testLog2(){
	int position = 32;
	for(int i = 0x100000000; i > 0; i >>= 1){
		if(logBase2(i) != position){
			errorValue = logBase2(i);
			errorMessage = "logBase2 Failed";
{'fraction_non_alphanumeric': 0.1604725572237263, 'fraction_numerical': 0.049224710804824025, 'mean_word_length': 4.157360406091371, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, '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': '1603522', 'n_tokens_mistral': 1791, 'n_tokens_neox': 1616, 'n_words': 391}