<commit_before>package fr.insee.eno.test;

import java.io.File;
import java.io.IOException;

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.xmlunit.diff.Diff;

import fr.insee.eno.generation.PoguesXML2DDIGenerator;
import fr.insee.eno.postprocessing.ddi.DDIMarkdown2XhtmlPostprocessor;
import fr.insee.eno.preprocessing.PoguesXMLPreprocessorGoToTreatment;
import fr.insee.eno.service.GenerationService;

public class TestPoguesXMLToDDI {

	private PoguesXMLPreprocessorGoToTreatment poguesXMLPreprocessorGoToTreatment = new PoguesXMLPreprocessorGoToTreatment();
	
	private PoguesXML2DDIGenerator poguesXML2DDI = new PoguesXML2DDIGenerator();
	
	private DDIMarkdown2XhtmlPostprocessor ddiMarkdown2XhtmlPostprocessor = new DDIMarkdown2XhtmlPostprocessor();
	
	private XMLDiff xmlDiff = new XMLDiff();

	@Test
	public void simpleDiffTest() {
		try {
			String basePath = "src/test/resources/pogues-xml-to-ddi";
			GenerationService genService = new GenerationService(poguesXMLPreprocessorGoToTreatment, poguesXML2DDI, ddiMarkdown2XhtmlPostprocessor);

			File in = new File(String.format("%s/in.xml", basePath));
			File outputFile = genService.generateQuestionnaire(in, "xml-pogues-2-ddi-test");<commit_msg>adding PoguesXmlInsertFilterLoopIntoQuestionTree preprocessing into poguesxml2ddi test<commit_after>package fr.insee.eno.test;

import java.io.File;
import java.io.IOException;

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.xmlunit.diff.Diff;

import fr.insee.eno.generation.PoguesXML2DDIGenerator;
import fr.insee.eno.postprocessing.Postprocessor;
import fr.insee.eno.postprocessing.ddi.DDIMarkdown2XhtmlPostprocessor;
import fr.insee.eno.preprocessing.PoguesXMLPreprocessorGoToTreatment;
import fr.insee.eno.preprocessing.PoguesXmlInsertFilterLoopIntoQuestionTree;
import fr.insee.eno.preprocessing.Preprocessor;
import fr.insee.eno.service.GenerationService;

public class TestPoguesXMLToDDI {

	
	private PoguesXML2DDIGenerator poguesXML2DDI = new PoguesXML2DDIGenerator();
	
	private XMLDiff xmlDiff = new XMLDiff();

	@Test
	public void simpleDiffTest() {
		try {
			String basePath = "src/test/resources/pogues-xml-to-ddi";
			
			Preprocessor[] preprocessors = {
					new PoguesXmlInsertFilterLoopIntoQuestionTree(),
					new PoguesXMLPreprocessorGoToTreatment()};
			Postprocessor[] postprocessors = {new DDIMarkdown2XhtmlPostprocessor()};
			
			GenerationService genService = new GenerationService(preprocessors, poguesXML2DDI, postprocessors);

			File in = new File(String.format("%s/in.xml", basePath));
			File outputFile = genService.generateQuestionnaire(in, "xml-pogues-2-ddi-test");
{'fraction_non_alphanumeric': 0.09229624116114626, 'fraction_numerical': 0.00744324525493115, 'mean_word_length': 6.445983379501385, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 11}, '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': '5040908', 'n_tokens_mistral': 945, 'n_tokens_neox': 877, 'n_words': 142}