<commit_before>#define BOOST_TEST_MODULE FOLParser
#ifdef HAVE_CONFIG_H
#include "../config.h"
#endif
#ifdef HAVE_BOOST_UNIT_TEST_FRAMEWORK
#define BOOST_TEST_DYN_LINK
#include <boost/test/unit_test.hpp>
#else
#include <boost/test/included/unit_test.hpp>
#endif
#include <boost/test/unit_test.hpp>
#include <boost/tuple/tuple.hpp>
#include "../src/fol/folparser.h"
#include "../src/fol/follexer.h"
#include "../src/fol/foltoken.h"
#include "../src/fol/constant.h"
#include "../src/spaninterval.h"
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>

BOOST_AUTO_TEST_CASE( parser_test )
{
	std::istringstream stream("flying(a,theAir) @ [1,11] # this is a test of a comment \n");

	std::vector<FOLToken> tokens = FOLParse::tokenize(&stream);
	boost::shared_ptr<Atom> a = FOLParse::parseGroundAtom(tokens.begin(), tokens.end());
	BOOST_CHECK_EQUAL(a->name(), "flying");
	BOOST_CHECK_EQUAL(a->arity(), 2);
}

BOOST_AUTO_TEST_CASE( interval_test )
{
	std::istringstream stream("[1,11]");
	std::vector<FOLToken> tokens = FOLParse::tokenize(&stream);
	SpanInterval interval = FOLParse::parseInterval(tokens.begin(), tokens.end());
	BOOST_CHECK_EQUAL(interval.start().start(), 1);
	BOOST_CHECK_EQUAL(interval.start().end(), 1);
	BOOST_CHECK_EQUAL(interval.end().start(), 11);
	BOOST_CHECK_EQUAL(interval.end().end(), 11);
}

BOOST_AUTO_TEST_CASE( event_test) 
{
	std::istringstream stream("mrManager(georgeMichael, bananaStand) @ [10:20]");
	std::vector<FOLToken> tokens = FOLParse::tokenize(&stream);
	boost::shared_ptr<Event> e = FOLParse::parseEvent(tokens.begin(), tokens.end());
	BOOST_CHECK_EQUAL(e->fact()->name(), "mrManager");
	BOOST_CHECK_EQUAL(e->fact()->at(0)->name(), "georgeMichael");
	BOOST_CHECK_EQUAL(e->fact()->at(1)->name(), "bananaStand");

}

BOOST_AUTO_TEST_CASE( atom_test) 
{
	std::istringstream stream("love(?cats, meowmix)");
	std::vector<FOLToken> tokens = FOLParse::tokenize(&stream);
	boost::shared_ptr<Atom> a = FOLParse::parseAtom(tokens.begin(), tokens.end());<commit_msg>whoops, forgot to fix the test file<commit_after>#define BOOST_TEST_MODULE FOLParser
#ifdef HAVE_CONFIG_H
#include "../config.h"
#endif
#ifdef HAVE_BOOST_UNIT_TEST_FRAMEWORK
#define BOOST_TEST_DYN_LINK
#include <boost/test/unit_test.hpp>
#else
#include <boost/test/included/unit_test.hpp>
#endif
#include <boost/test/unit_test.hpp>
#include <boost/tuple/tuple.hpp>
#include "../src/fol/folparser.h"
#include "../src/fol/follexer.h"
#include "../src/fol/foltoken.h"
#include "../src/fol/constant.h"
#include "../src/spaninterval.h"
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>

BOOST_AUTO_TEST_CASE( parser_test )
{
	std::istringstream stream("flying(a,theAir) @ [1,11] # this is a test of a comment \n");

	std::vector<FOLToken> tokens = FOLParse::tokenize(&stream);
	boost::shared_ptr<Atom> a = FOLParse::parseGroundAtom(tokens.begin(), tokens.end());
	BOOST_CHECK_EQUAL(a->name(), "flying");
	BOOST_CHECK_EQUAL(a->arity(), 2);
}

BOOST_AUTO_TEST_CASE( interval_test )
{
	std::istringstream stream("[1,11]");
	std::vector<FOLToken> tokens = FOLParse::tokenize(&stream);
	SpanInterval interval = FOLParse::parseInterval(tokens.begin(), tokens.end());
	BOOST_CHECK_EQUAL(interval.start().start(), 1);
	BOOST_CHECK_EQUAL(interval.start().end(), 1);
	BOOST_CHECK_EQUAL(interval.end().start(), 11);
	BOOST_CHECK_EQUAL(interval.end().end(), 11);
}

BOOST_AUTO_TEST_CASE( event_test) 
{
	std::istringstream stream("mrManager(georgeMichael, bananaStand) @ [10:20]");
	std::vector<FOLToken> tokens = FOLParse::tokenize(&stream);
	boost::tuple<boost::shared_ptr<Atom>, SpanInterval> e = FOLParse::parseEvent(tokens.begin(), tokens.end());
	BOOST_CHECK_EQUAL(e.get<0>()->name(), "mrManager");
	BOOST_CHECK_EQUAL(e.get<0>()->at(0)->name(), "georgeMichael");
	BOOST_CHECK_EQUAL(e.get<0>()->at(1)->name(), "bananaStand");

}

BOOST_AUTO_TEST_CASE( atom_test) 
{
	std::istringstream stream("love(?cats, meowmix)");
	std::vector<FOLToken> tokens = FOLParse::tokenize(&stream);
	boost::shared_ptr<Atom> a = FOLParse::parseAtom(tokens.begin(), tokens.end());
{'fraction_non_alphanumeric': 0.18783585735222277, 'fraction_numerical': 0.010014655593551539, 'mean_word_length': 7.566945606694561, 'pattern_counts': {'":': 0, '<': 37, '<?xml version=': 0, '>': 54, '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': '4589331', 'n_tokens_mistral': 1544, 'n_tokens_neox': 1490, 'n_words': 234}