<commit_before><?php

namespace estvoyage\value\tests\units;

require __DIR__ . '/../runner.php';

use
	estvoyage\value\tests\units
;

class float extends units\test
{
	function testClass()
	{
		$this->testedClass
			->isAbstract
		;
	}

	function testBuildWithNoArgument()
	{
		$this->float((new float\testedClass)->asFloat)->isZero;
	}

	/**
	 * @dataProvider validValueDataProvider
	 */
	function testBuildWithValidValue($value)
	{
		$this->float((new float\testedClass($value))->asFloat)->isEqualTo((float) $value);
	}

	/**
	 * @dataProvider invalidValueDataProvider
	 */
	function testBuildWithInvalidValue($value)
	{
		$this
			->exception(function() use ($value) { new float\testedClass($value); })
				->isInstanceOf('domainException')
				->hasMessage('Value should be numeric')
		;
	}

	/**
	 * @dataProvider validValueDataProvider
	 */
	function testValidateWithValidValue($value)
	{
		$this->boolean(float\testedClass::validate($value))->isTrue;
	}

	/**
	 * @dataProvider invalidValueDataProvider
	 */
	function testValidateWithInvalidValue($value)
	{
		$this->boolean(float\testedClass::validate($value))->isFalse;
	}

	/**
	 * @dataProvider validValueDataProvider
	 */<commit_msg>Add missing unit test about cast to string for float.<commit_after><?php

namespace estvoyage\value\tests\units;

require __DIR__ . '/../runner.php';

use
	estvoyage\value\tests\units
;

class float extends units\test
{
	function testClass()
	{
		$this->testedClass
			->isAbstract
		;
	}

	function testConstructorWithNoArgument()
	{
		$this->float((new float\testedClass)->asFloat)->isZero;
	}

	/**
	 * @dataProvider validValueDataProvider
	 */
	function testConstructorWithValidValue($value)
	{
		$this
			->if(
				$float = new float\testedClass($value)
			)
			->then
				->float($float->asFloat)->isEqualTo((float) $value)
				->castToString($float)->isEqualTo((string) (float) $value)
		;
	}

	/**
	 * @dataProvider invalidValueDataProvider
	 */
	function testConstructorWithInvalidValue($value)
	{
		$this
			->exception(function() use ($value) { new float\testedClass($value); })
				->isInstanceOf('domainException')
				->hasMessage('Value should be numeric')
		;
	}

	/**
	 * @dataProvider validValueDataProvider
	 */
	function testValidateWithValidValue($value)
	{
		$this->boolean(float\testedClass::validate($value))->isTrue;
	}

	/**
	 * @dataProvider invalidValueDataProvider
	 */
	function testValidateWithInvalidValue($value)
	{
		$this->boolean(float\testedClass::validate($value))->isFalse;
	}

	/**
	 * @dataProvider validValueDataProvider
	 */
{'fraction_non_alphanumeric': 0.15294576667967225, 'fraction_numerical': 0.0, 'mean_word_length': 4.3752620545073375, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 37, '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': '2860359', 'n_tokens_mistral': 906, 'n_tokens_neox': 816, 'n_words': 125}