<commit_before>/*!
\file
	\brief
		<a href="http://om-language.org">Om</a> source file.
	\version
		0.1.2
	\date
		2012-2013
	\copyright
		Copyright (c) <a href="http://sparist.com">Sparist</a>. All rights reserved. This program and the accompanying materials are made available under the terms of the <a href="http://www.eclipse.org/legal/epl-v10.html">Eclipse Public License, Version 1.0</a>, which accompanies this distribution.
	\authors
		<NAME> - Initial API, implementation, and documentation.
*/

#ifndef Om_Literal_

	#include "om/literal.hpp"

	#ifdef Om_Macros_Test_

		#include "om/system.hpp"

		#ifndef Om_Macros_Precompilation_

			#include "boost/test/unit_test.hpp"

		#endif

namespace Om {

	BOOST_AUTO_TEST_SUITE(LiteralTest)

		BOOST_AUTO_TEST_CASE(EqualityTest) {
			// Positive match
			BOOST_CHECK_EQUAL(
				"{{a{b}{c}\nd{e}}}",
				System::Get().Evaluate("= {a{b}{c}\nd{e}} {a{b}{c}\nd{e}}")
			);

			// Negative match
			BOOST_CHECK_EQUAL(
				"{}",
				System::Get().Evaluate("= {a{b}{c}} {a{b}{d}}")
			);

			// Empty match
			BOOST_CHECK_EQUAL(
				"{}",
				System::Get().Evaluate("= {} {a{b}{c}}")
			);

			// Empty match
			BOOST_CHECK_EQUAL(
				"{{}}",
				System::Get().Evaluate("= {} {}")
			);
		}

		BOOST_AUTO_TEST_CASE(RecursionTest) {
			size_t const theDepth = 50000;

			std::string theString;
			for (
				size_t theLevel = theDepth;
				theLevel;
				--theLevel
			) {
				theString = "{" + theString + "}";
			}

			Sources::CodePointSource<std::string::const_iterator> theCodePointSource(
				theString.begin(),
				theString.end()
			);
			Parser theParser(theCodePointSource);
			Literal theLiteral;
			theLiteral.ReadElements(theParser);

			Literal theCopy(theLiteral);
		}

	BOOST_AUTO_TEST_SUITE_END()

}

	#endif

#else

	#include "om/operator.hpp"
	#include "om/separator.hpp"

	#ifndef Om_Macros_Precompilation_

		#include <stack>

	#endif

// MARK: - Om::Literal

	#define Type_ \<commit_msg>Added minor test coverage improvement.<commit_after>/*!
\file
	\brief
		<a href="http://om-language.org">Om</a> source file.
	\version
		0.1.2
	\date
		2012-2013
	\copyright
		Copyright (c) <a href="http://sparist.com">Sparist</a>. All rights reserved. This program and the accompanying materials are made available under the terms of the <a href="http://www.eclipse.org/legal/epl-v10.html">Eclipse Public License, Version 1.0</a>, which accompanies this distribution.
	\authors
		<NAME> - Initial API, implementation, and documentation.
*/

#ifndef Om_Literal_

	#include "om/literal.hpp"

	#ifdef Om_Macros_Test_

		#include "om/system.hpp"

		#ifndef Om_Macros_Precompilation_

			#include "boost/test/unit_test.hpp"

		#endif

namespace Om {

	BOOST_AUTO_TEST_SUITE(LiteralTest)

		BOOST_AUTO_TEST_CASE(EqualityTest) {
			// Positive match
			BOOST_CHECK_EQUAL(
				"{{a{b}{c}\nd{e}}}",
				System::Get().Evaluate("= {a{b}{c}\nd{e}} {a{b}{c}\nd{e}}")
			);

			// Negative match
			BOOST_CHECK_EQUAL(
				"{}",
				System::Get().Evaluate("= {a{b}{c}} {a{b}{d}}")
			);

			// Empty match
			BOOST_CHECK_EQUAL(
				"{}",
				System::Get().Evaluate("= {} {a{b}{c}}")
			);

			// Empty match
			BOOST_CHECK_EQUAL(
				"{{}}",
				System::Get().Evaluate("= {} {}")
			);
		}

		BOOST_AUTO_TEST_CASE(RecursionTest) {
			size_t const theDepth = 50000;

			std::string theString;
			for (
				size_t theLevel = theDepth;
				theLevel;
				--theLevel
			) {
				theString = "{" + theString + "}";
			}

			Sources::CodePointSource<std::string::const_iterator> theCodePointSource(
				theString.begin(),
				theString.end()
			);
			Parser theParser(theCodePointSource);
			Literal theLiteral;
			theLiteral.ReadElements(theParser);

			Literal theCopy;
			theCopy = theLiteral;

			theCopy.Clear();
			BOOST_CHECK(
				theCopy.IsEmpty()
			);
		}

	BOOST_AUTO_TEST_SUITE_END()

}

	#endif

#else

	#include "om/operator.hpp"
	#include "om/separator.hpp"

	#ifndef Om_Macros_Precompilation_

		#include <stack>

	#endif

// MARK: - Om::Literal

	#define Type_ \
{'fraction_non_alphanumeric': 0.1618050361505859, 'fraction_numerical': 0.009972575417601595, 'mean_word_length': 3.457777777777778, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, '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': '2941061', 'n_tokens_mistral': 1759, 'n_tokens_neox': 1438, 'n_words': 271}