<commit_before>/** @file
 *
 * @ingroup foundationLibrary
 *
 * @brief #TTDictionaryTest is an class used for unit tests of the #TTDictionary class.
 *
 * @details
 *
 * @authors <NAME>, <NAME>
 *
 * @copyright Copyright © 2013, <NAME>, <NAME> @n
 * This code is licensed under the terms of the "New BSD License" @n
 * http://creativecommons.org/licenses/BSD/
 */

#include "TTDictionary.test.h"

#define thisTTClass			TTDictionaryTest
#define thisTTClassName		"dictionary.test"
#define thisTTClassTags		"test, foundation"


TT_OBJECT_CONSTRUCTOR
{;}


TTDictionaryTest::~TTDictionaryTest()
{;}


void TTDictionaryTestBasic(int& errorCount, int& testAssertionCount)
{
	TTTestLog("\n");
	TTTestLog("Testing something");
	
	TTTestAssertion("TTDictionary: Test fails if ...",
					NO,
					testAssertionCount,
					errorCount);
}


TTErr TTDictionaryTest::test(TTValue& returnedTestInfo)
{
	int	errorCount = 0;
	int testAssertionCount = 0;
	
	TTDictionaryTestBasic(errorCount, testAssertionCount);
		
	return TTTestFinish(testAssertionCount, errorCount, returnedTestInfo);
}<commit_msg>Adding some test on creation, schema access and value access<commit_after>/** @file
 *
 * @ingroup foundationLibrary
 *
 * @brief #TTDictionaryTest is an class used for unit tests of the #TTDictionary class.
 *
 * @details
 *
 * @authors <NAME>, <NAME>
 *
 * @copyright Copyright © 2013, <NAME>, <NAME> @n
 * This code is licensed under the terms of the "New BSD License" @n
 * http://creativecommons.org/licenses/BSD/
 */

#include "TTDictionary.test.h"

#define thisTTClass			TTDictionaryTest
#define thisTTClassName		"dictionary.test"
#define thisTTClassTags		"test, foundation"


TT_OBJECT_CONSTRUCTOR
{;}


TTDictionaryTest::~TTDictionaryTest()
{;}


void TTDictionaryTestBasic(int& errorCount, int& testAssertionCount)
{
	TTTestLog("\n");
	TTTestLog("Testing dictionary creation");
    
    // creation using a random name
    TTDictionary d1;

	TTTestAssertion("TTDictionary random name : Test fails if the dictionary have no name",
					d1.name() != kTTSymEmpty,
					testAssertionCount,
					errorCount);
    
    // creation using a specific string name
    //TTDictionary   d2("dictionary2");         // theo - is this should be possible ?
    
    // creation using a specific symbol name
    //TTDictionary   d3(kTTSym_symbol);         // theo - is this should be possible ?
    
    
    
    TTTestLog("\n");
	TTTestLog("Testing dictionary schema");
    
    TTTestAssertion("TTDictionary schema : Test fails if the dictionary schema is not empty",
					d1.getSchema() == kTTSymEmpty,
					testAssertionCount,
					errorCount);
    
    d1.setSchema(TTSymbol("aSchemaName"));
    
    TTTestAssertion("TTDictionary schema : Test fails if the dictionary schema is not \"aSchemaName\"",
					d1.getSchema() == TTSymbol("aSchemaName"),
					testAssertionCount,
					errorCount);
    
    
    
    TTTestLog("\n");
	TTTestLog("Testing dictionary value");
    
    TTValue v;
    d1.getValue(v);
    
    TTTestAssertion("TTDictionary value : Test fails if the dictionary value is not empty",
					v == kTTValNONE,
					testAssertionCount,
					errorCount);
    
    d1.setValue(kTTVal1);
    d1.getValue(v);
    
    TTTestAssertion("TTDictionary value : Test fails if the dictionary value is not kTTVal1",
					v == kTTVal1,
					testAssertionCount,
					errorCount);
}


TTErr TTDictionaryTest::test(TTValue& returnedTestInfo)
{
	int	errorCount = 0;
	int testAssertionCount = 0;
	
	TTDictionaryTestBasic(errorCount, testAssertionCount);
		
	return TTTestFinish(testAssertionCount, errorCount, returnedTestInfo);
}
{'fraction_non_alphanumeric': 0.10664819944598337, 'fraction_numerical': 0.007202216066481994, 'mean_word_length': 3.7701453104359315, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '1076239', 'n_tokens_mistral': 1223, 'n_tokens_neox': 1097, 'n_words': 299}