<commit_before>/***********************************************************************************************************************
 * PartialNodeTests.cpp
 *
 *  Created on: Dec 8, 2010
 *      Author: <NAME>
 **********************************************************************************************************************/

#include "filepersistence.h"
#include "FileStore.h"
#include "ModelBase/headers/test_nodes/PartialList.h"
#include "SelfTest/headers/SelfTestSuite.h"
#include "ModelBase/headers/Model.h"
#include "ModelBase/headers/nodes/Text.h"
#include "ModelBase/headers/nodes/List.h"
#include "ModelBase/headers/nodes/TypedList.h"

#include <QtCore/QTextStream>
#include <QtCore/QFile>

namespace FilePersistence {

TEST(FilePersistence, LoadingTypedList)
{
	QString testDir = ":/FilePersistence/test/persisted";
	Model::Model model;
	FileStore store;
	store.setBaseFolder(testDir);

	model.load(&store, "typedList");
	Model::TypedList<Model::Text>* list = dynamic_cast<Model::TypedList<Model::Text>*> (model.root());
	CHECK_CONDITION(list != NULL);

	CHECK_STR_EQUAL("TypedListOfText", list->typeName() );
	CHECK_STR_EQUAL("TypedList", list->referenceName() );
	CHECK_INT_EQUAL(0, list->id());
	CHECK_INT_EQUAL(2, list->size());
<commit_msg>Updated to use the new instantiation header file.<commit_after>/***********************************************************************************************************************
 * PartialNodeTests.cpp
 *
 *  Created on: Dec 8, 2010
 *      Author: <NAME>
 **********************************************************************************************************************/

#include "filepersistence.h"
#include "FileStore.h"
#include "ModelBase/headers/test_nodes/PartialList.h"
#include "SelfTest/headers/SelfTestSuite.h"
#include "ModelBase/headers/Model.h"
#include "ModelBase/headers/nodes/Text.h"
#include "ModelBase/headers/nodes/List.h"
#include "ModelBase/headers/TypedListInstantiations.h"

#include <QtCore/QTextStream>
#include <QtCore/QFile>

namespace FilePersistence {

TEST(FilePersistence, LoadingTypedList)
{
	QString testDir = ":/FilePersistence/test/persisted";
	Model::Model model;
	FileStore store;
	store.setBaseFolder(testDir);

	model.load(&store, "typedList");
	Model::TypedList<Model::Text>* list = dynamic_cast<Model::TypedList<Model::Text>*> (model.root());
	CHECK_CONDITION(list != NULL);

	CHECK_STR_EQUAL("TypedListOfText", list->typeName() );
	CHECK_STR_EQUAL("TypedList", list->referenceName() );
	CHECK_INT_EQUAL(0, list->id());
	CHECK_INT_EQUAL(2, list->size());

{'fraction_non_alphanumeric': 0.31157731157731156, 'fraction_numerical': 0.005439005439005439, 'mean_word_length': 8.196428571428571, 'pattern_counts': {'":': 2, '<': 15, '<?xml version=': 0, '>': 23, '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': '511395', 'n_tokens_mistral': 771, 'n_tokens_neox': 753, 'n_words': 121}