<commit_before><?php

require('LLTestCase.php');

class UnMarkupTest extends LLTestCase{


public function testEmpty()
	{
	$this->assertEquals($this->UnMarkup->fromHtml(''), '');
	}

public function testCode()
	{
	$in =
'<pre>
test&quot;&lt;code&gt;
</pre>
';
	$out =
'<code>
test"<code>
</code>
';

	$this->assertEquals($out, $this->UnMarkup->fromHtml($in));
	}

public function testQuote()
	{
	$out = '<quote></quote>';
	$in = htmlspecialchars('<quote></quote>');
	$this->assertEquals($out, $this->UnMarkup->fromHtml($in));

	$out = '<quote>test</quote>';
	$in = '<blockquote><div>test</div></blockquote>';
	$this->assertEquals($out, $this->UnMarkup->fromHtml($in));

	$out = '<quote>test<quote>test2</quote></quote>';
	$in = '<blockquote><div>test<blockquote><div>test2</div></blockquote></div></blockquote>';
	$this->assertEquals($out, $this->UnMarkup->fromHtml($in));

	$out = '<quote=></quote>';
	$in = htmlspecialchars('<quote=></quote>');
	$this->assertEquals($out, $this->UnMarkup->fromHtml($in));

	$out = '<quote=author>test</quote>';
	$in = '<cite>author</cite><blockquote><div>test</div></blockquote>';
	$this->assertEquals($out, $this->UnMarkup->fromHtml($in));

	$out = '<quote=author>test<quote=author2>test2</quote></quote>';
	$in = '<cite>author</cite><blockquote><div>test<cite>author2</cite><blockquote><div>test2</div></blockquote></div></blockquote>';
	$this->assertEquals($out, $this->UnMarkup->fromHtml($in));
	}

public function testList()
	{
	$out =
'* 1
* 2
** 2a
** 2b
*** 2bi
**** 2bii
** 2c
* 3
** 4
';
	$in = '<ul><li>1</li><li>2<ul><li>2a</li><li>2b<ul><li>2bi<ul><li>2bii</li></ul></li></ul></li><li>2c</li></ul></li><li>3<ul><li>4</li></ul></li></ul>';
 	$this->assertEquals($out, $this->UnMarkup->fromHtml($in));

		$out =
'* 1
* 2
** 2a
** 2b
*** 2bi
**** 2bii
** 2c
* 3
** 4
abc';
	$in = '<ul><li>1</li><li>2<ul><li>2a</li><li>2b<ul><li>2bi<ul><li>2bii</li></ul></li></ul></li><li>2c</li></ul></li><li>3<ul><li>4</li></ul></li></ul>abc';
	$this->assertEquals($out, $this->UnMarkup->fromHtml($in));

	$out =
'o
* 1
* 2
** 2a
** 2b
*** 2bi
**** 2bii
** 2c
* 3
** 4
abcd
* 1
* 2
** 2a
** 2b
*** 2bi
**** 2bii
** 2c
* 3
** 4
abc';
	$in = 'o<br /><ul><li>1</li><li>2<ul><li>2a</li><li>2b<ul><li>2bi<ul><li>2bii</li></ul></li></ul></li><li>2c</li></ul></li><li>3<ul><li>4</li></ul></li></ul>abcd<br /><ul><li>1</li><li>2<ul><li>2a</li><li>2b<ul><li>2bi<ul><li>2bii</li></ul></li></ul></li><li>2c</li></ul></li><li>3<ul><li>4</li></ul></li></ul>abc';
  	$this->assertEquals($out, $this->UnMarkup->fromHtml($in));
	}

public function testDel()
	{
	$this->assertEquals('--test--', $this->UnMarkup->fromHtml('<del>test</del>'));
	}

public function testIns()
	{
	$this->assertEquals('++test++', $this->UnMarkup->fromHtml('<ins>test</ins>'));
	}

public function testStrong()<commit_msg>added test which demonstrates bug 25<commit_after><?php

require('LLTestCase.php');

class UnMarkupTest extends LLTestCase{


public function testEmpty()
	{
	$this->assertEquals($this->UnMarkup->fromHtml(''), '');
	}

public function testCode()
	{
	$in =
'<pre>
test&quot;&lt;code&gt;
</pre>
';
	$out =
'<code>
test"<code>
</code>
';

	$this->assertEquals($out, $this->UnMarkup->fromHtml($in));
	}

public function testQuote()
	{
	$out = '<quote></quote>';
	$in = htmlspecialchars('<quote></quote>');
	$this->assertEquals($out, $this->UnMarkup->fromHtml($in));

	$out = '<quote>test</quote>';
	$in = '<blockquote><div>test</div></blockquote>';
	$this->assertEquals($out, $this->UnMarkup->fromHtml($in));

	$out = '<quote>test<quote>test2</quote></quote>';
	$in = '<blockquote><div>test<blockquote><div>test2</div></blockquote></div></blockquote>';
	$this->assertEquals($out, $this->UnMarkup->fromHtml($in));

	$out = '<quote=></quote>';
	$in = htmlspecialchars('<quote=></quote>');
	$this->assertEquals($out, $this->UnMarkup->fromHtml($in));

	$out = '<quote=author>test</quote>';
	$in = '<cite>author</cite><blockquote><div>test</div></blockquote>';
	$this->assertEquals($out, $this->UnMarkup->fromHtml($in));

	$out = '<quote=author>test<quote=author2>test2</quote></quote>';
	$in = '<cite>author</cite><blockquote><div>test<cite>author2</cite><blockquote><div>test2</div></blockquote></div></blockquote>';
	$this->assertEquals($out, $this->UnMarkup->fromHtml($in));
	}

public function testList()
	{
	$out =
'* 1
* 2
** 2a
** 2b
*** 2bi
**** 2bii
** 2c
* 3
** 4
';
	$in = '<ul><li>1</li><li>2<ul><li>2a</li><li>2b<ul><li>2bi<ul><li>2bii</li></ul></li></ul></li><li>2c</li></ul></li><li>3<ul><li>4</li></ul></li></ul>';
 	$this->assertEquals($out, $this->UnMarkup->fromHtml($in));

		$out =
'* 1
* 2
** 2a
** 2b
*** 2bi
**** 2bii
** 2c
* 3
** 4
abc';
	$in = '<ul><li>1</li><li>2<ul><li>2a</li><li>2b<ul><li>2bi<ul><li>2bii</li></ul></li></ul></li><li>2c</li></ul></li><li>3<ul><li>4</li></ul></li></ul>abc';
	$this->assertEquals($out, $this->UnMarkup->fromHtml($in));

	$out =
'o
* 1
* 2
** 2a
** 2b
*** 2bi
**** 2bii
** 2c
* 3
** 4
abcd
* 1
* 2
** 2a
** 2b
*** 2bi
**** 2bii
** 2c
* 3
** 4
abc';
	$in = 'o<br /><ul><li>1</li><li>2<ul><li>2a</li><li>2b<ul><li>2bi<ul><li>2bii</li></ul></li></ul></li><li>2c</li></ul></li><li>3<ul><li>4</li></ul></li></ul>abcd<br /><ul><li>1</li><li>2<ul><li>2a</li><li>2b<ul><li>2bi<ul><li>2bii</li></ul></li></ul></li><li>2c</li></ul></li><li>3<ul><li>4</li></ul></li></ul>abc';
  	$this->assertEquals($out, $this->UnMarkup->fromHtml($in));
	}

public function testLinkInList()
	{
	$out =
'* <http://www.heise.de Heise>
* 2gg
';
	$in = '<ul><li><a href="http://www.heise.de" onclick="openLink(this)" rel="nofollow" class="extlink">Heise</a></li><li>2gg</li></ul>';
  	$this->assertEquals($out, $this->UnMarkup->fromHtml($in));
	}

public function testDel()
	{
	$this->assertEquals('--test--', $this->UnMarkup->fromHtml('<del>test</del>'));
	}

public function testIns()
	{
	$this->assertEquals('++test++', $this->UnMarkup->fromHtml('<ins>test</ins>'));
	}

public function testStrong()
{'fraction_non_alphanumeric': 0.3100252737994945, 'fraction_numerical': 0.02695871946082561, 'mean_word_length': 5.910360884749709, 'pattern_counts': {'":': 0, '<': 360, '<?xml version=': 0, '>': 439, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '2935919', 'n_tokens_mistral': 2624, 'n_tokens_neox': 2524, 'n_words': 289}