<commit_before><?php
// (c) Copyright 2002-2010 by authors of the Tiki Wiki/CMS/Groupware Project
// 
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
// $Id$

require_once 'lib/freetag/freetaglib.php';

class FreetagTest extends TikiTestCase
{

	private $lib;

	function setUp() {
		$this->lib = new FreetagLib();
	}

	function testDumbParseTagsShouldReturnEmptyArray() {
		$this->assertEquals(array(), $this->lib->dumb_parse_tags(null));
		$this->assertEquals(array(), $this->lib->dumb_parse_tags(array()));
		$this->assertEquals(array(), $this->lib->dumb_parse_tags(''));
	}

	function testDumbParseTagsShouldReturnParsedArray() {
		//TODO: mock FreetagLib::_parse_tag() and FreetagLib::normalize_tag()
		$expectedResult = array(
			'data' => array(
				0 => array('tag' => 'first'),
				1 => array('tag' => 'multiple word tag'),
				2 => array('tag' => 'third'),
				3 => array('tag' => 'another Multiple Word tag')
			),
			'cant' => 4,
		);

		$tagString = 'first "multiple word tag" third "another Multiple Word tag"';

		$this->assertEquals($expectedResult, $this->lib->dumb_parse_tags($tagString));
	}

}

<commit_msg>using only lower case tags to test until we have a way for the tests to be independent of the tiki instance preferences<commit_after><?php
// (c) Copyright 2002-2010 by authors of the Tiki Wiki/CMS/Groupware Project
// 
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
// $Id$

require_once 'lib/freetag/freetaglib.php';

class FreetagTest extends TikiTestCase
{

	private $lib;

	function setUp() {
		$this->lib = new FreetagLib();
	}

	function testDumbParseTagsShouldReturnEmptyArray() {
		$this->assertEquals(array(), $this->lib->dumb_parse_tags(null));
		$this->assertEquals(array(), $this->lib->dumb_parse_tags(array()));
		$this->assertEquals(array(), $this->lib->dumb_parse_tags(''));
	}

	function testDumbParseTagsShouldReturnParsedArray() {
		//TODO: mock FreetagLib::_parse_tag() and FreetagLib::normalize_tag()
		$expectedResult = array(
			'data' => array(
				0 => array('tag' => 'first'),
				1 => array('tag' => 'multiple word tag'),
				2 => array('tag' => 'third'),
				3 => array('tag' => 'another multiple word tag')
			),
			'cant' => 4,
		);

		$tagString = 'first "multiple word tag" third "another Multiple Word tag"';

		$this->assertEquals($expectedResult, $this->lib->dumb_parse_tags($tagString));
	}

}


{'fraction_non_alphanumeric': 0.15732924021488873, 'fraction_numerical': 0.009976976208749041, 'mean_word_length': 4.488421052631579, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 49, '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': '3808565', 'n_tokens_mistral': 933, 'n_tokens_neox': 836, 'n_words': 222}