<commit_before><?php

require('../Tester.php');
require('../XmlEncode.php');

class XmlEncodeTest extends Tester {
	public function testSimple () {
		$this->assertTrue(is_object(new XmlEncode('a')), 'XmlEncode is object');
		$this->assertClassHasAttribute('data','XmlEncode');
	}

	public function dataXml () {
		return array (
			'string' => array('a'),
			'array' => array(array(1,2,3)),
			'object' => array((object)array('a' => 'b')),
			'self' => array($this),
		);
	}

	public function testXml ($a) {
		$obj = new XmlEncode($a);
		$this->assertValidXml($obj->output());

	}
}

XmlEncodeTest::doTest();
<commit_msg>Improved test for XmlEncode<commit_after><?php

require('../Tester.php');
require('../XmlEncode.php');

class XmlEncodeTest extends Tester {
	public function testSimple () {
		$this->assertTrue(is_object(new XmlEncode('a')), 'XmlEncode is object');
		$this->assertClassHasAttribute('data','XmlEncode');
	}

	public function dataXml () {
		return array (
			'string' => array('a'),
			'array' => array(array(1,2,3)),
			'object' => array((object)array('a' => 'b')),
			'self' => array($this),
		);
	}

	public function testXml ($a) {
		$obj = new XmlEncode($a);
		$output = $obj->output();

		$this->outputLine($output);
		$this->assertValidXml($output);
	}
}

XmlEncodeTest::doTest();

{'fraction_non_alphanumeric': 0.20469552457813647, 'fraction_numerical': 0.004402054292002935, 'mean_word_length': 3.8540925266903914, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 22, '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': '7358435', 'n_tokens_mistral': 510, 'n_tokens_neox': 456, 'n_words': 84}