<commit_before>/* test file for Ndime.js */
import Vector from './helper/Ndime';

function test_creation(obj){
	console.log("[" + obj.array + "], [" + obj.shape + "], " + obj.size + ", " + obj.dim);
}


function test_func(){
	/* test add(class) function */
	var arr = Vector.add(new_vector_2,new_vector_2);
	arr.forEach((elem)=>{console.log("1 " + elem);});

	/* test flat method */
	new_vector_2.flat.forEach((elem)=>{console.log("4" + elem);});

	/* test fill and arrange methods */
	var nv = new Vector();
	nv.arrange([1,2,3,4,5,6]);/* correct */
	console.log("*1 : " + nv.shape + " " +  nv.array.length);
	nv.array.forEach((i)=>{console.log("*1 : " + i);});
	var nv2 = new Vector([2,3]);
	nv2.arrange([1,2,3,4,5,6]); /*correct */
	console.log("*2 : " + nv2.shape + " " + nv2.array.length);
	nv2.array.forEach((i)=>{console.log("*2 : " + i);});
	var nv3 = new Vector([2,3]); /*correct */
	nv3.arrange([1]);
	console.log("*3 : " + nv3.shape + " " + nv3.array.length);
	nv3.array.forEach((i)=>{console.log("*3 : " + i);});
	var nv4 = new Vector([3]);
	nv4.arrange();/* correct */
	console.log("*4 : " + nv4.shape + " " + nv4.array.length);
	nv4.array.forEach((i)=>{console.log("*4 : " + i);});
	var nv5 = new Vector([5]);
	nv5.arrange([1,2,3,4,5,6,7,8,9,10]); /* correct */
	console.log("*5 : " + nv5.shape + nv5.array.length);
	nv5.array.forEach((i)=>{console.log("*5 : " + i);});

}
/* test cases : */

var new_vector_1 = new Vector([2,3,4]);
test_creation(new_vector_1);
var new_vector_2 = Vector.array([[[2,3,4],[1,5,7]],[[3,4,9],[0,6,8]]]);
test_creation(new_vector_2);
var new_vector_3= new Vector([2,3],[[1,3,4],[2,5,7],[0,8,9]]);
test_creation(new_vector_3);
var new_vector_4 = Vector.zeroes([2,2,3]);
test_creation(new_vector_4);

/* testing other functions */
test_func();<commit_msg>fixed test_vector acc to the node module sys.<commit_after>/* test file for Ndime.js */
// import Vector from './helper/Ndime';

var vect = require('./vector_js');

function test_creation(obj){
	console.log("[" + obj.array + "], [" + obj.shape + "], " + obj.size + ", " + obj.dim);
}


function test_func(){
	/* test add(class) function */
	var arr = vect.Vector.add(new_vector_2,new_vector_2);
	arr.forEach((elem)=>{console.log("1 " + elem);});

	/* test flat method */
	new_vector_2.flat.forEach((elem)=>{console.log("4" + elem);});

	/* test fill and arrange methods */
	var nv = new vect.Vector();
	nv.arrange([1,2,3,4,5,6]);/* correct */
	console.log("*1 : " + nv.shape + " " +  nv.array.length);
	nv.array.forEach((i)=>{console.log("*1 : " + i);});
	var nv2 = new vect.Vector([2,3]);
	nv2.arrange([1,2,3,4,5,6]); /*correct */
	console.log("*2 : " + nv2.shape + " " + nv2.array.length);
	nv2.array.forEach((i)=>{console.log("*2 : " + i);});
	var nv3 = new vect.Vector([2,3]); /*correct */
	nv3.arrange([1]);
	console.log("*3 : " + nv3.shape + " " + nv3.array.length);
	nv3.array.forEach((i)=>{console.log("*3 : " + i);});
	var nv4 = new vect.Vector([3]);
	nv4.arrange();/* correct */
	console.log("*4 : " + nv4.shape + " " + nv4.array.length);
	nv4.array.forEach((i)=>{console.log("*4 : " + i);});
	var nv5 = new vect.Vector([5]);
	nv5.arrange([1,2,3,4,5,6,7,8,9,10]); /* correct */
	console.log("*5 : " + nv5.shape + nv5.array.length);
	nv5.array.forEach((i)=>{console.log("*5 : " + i);});

}
/* test cases : */

var new_vector_1 = new vect.Vector([2,3,4]);
test_creation(new_vector_1);
var new_vector_2 = vect.Vector.array([[[2,3,4],[1,5,7]],[[3,4,9],[0,6,8]]]);
test_creation(new_vector_2);
var new_vector_3= new vect.Vector([2,3],[[1,3,4],[2,5,7],[0,8,9]]);
test_creation(new_vector_3);
var new_vector_4 = vect.Vector.zeroes([2,2,3]);
test_creation(new_vector_4);

/* testing other functions */
test_func();
{'fraction_non_alphanumeric': 0.26219347884667205, 'fraction_numerical': 0.0549717057396928, 'mean_word_length': 4.532041728763041, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, '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': '4068025', 'n_tokens_mistral': 1591, 'n_tokens_neox': 1550, 'n_words': 239}