<commit_before>#include "Session.h"
namespace objck {

void Session::closeSession()
{
	if(isDisabled()) {OK; return;}	
	
	PRECONDITION(_functionList)
	CK_RV rv = (*_functionList->C_CloseSession)(_session);
	if(rv)
	{
		FAILED;
		throw CryptokiException(rv);
	}
	disable();
	OK;
}

SessionInfo Session::getSessionInfo()
{
	PRECONDITION(isEnabled())
	PRECONDITION(_functionList)
	CK_SESSION_INFO a;
	CK_RV rv = (*_functionList->C_GetSessionInfo)(_session, &a);
	SessionInfo inf(a);
    if(rv)
        {
            FAILED;
            throw CryptokiException(rv);
        }
    OK;
	return inf;
}

void Session::getOperationState()
{
	PRECONDITION(isEnabled())
	PRECONDITION(_functionList)
	NOT_IMPLEMENTED;
}

void Session::setOperationState()
{
	PRECONDITION(isEnabled())
	PRECONDITION(_functionList)
	NOT_IMPLEMENTED;
}

void Session::userLogin(std::string& userPin)
{
	PRECONDITION(isEnabled())
	PRECONDITION(_functionList)
	
    CK_ULONG pinLen = userPin.length();

    CK_RV rv = (*_functionList->C_Login)(_session, CKU_USER, (unsigned char*)userPin.c_str(), pinLen);
    if(rv)
    {
        FAILED;
        throw CryptokiException(rv);
    }
    OK;
}

void Session::initPin(std::string& pin)
{
	PRECONDITION(_functionList)
	NOT_IMPLEMENTED;
/*	CK_ULONG pinLen = pin.length();
	CK_UTF8CHAR* utf8pin = new CK_UTF8CHAR[pin.length()];
    strncpy((char*)utf8pin, pin.c_str(), pin.length());

    CK_RV rv = (*_functionList->C_InitPIN)(session, utf8pin, pinLen);
    if(rv)
        {
            FAILED;
            throw CryptokiException(rv);
        }
    OK;*/
}

}/*END NAMESPACE*/<commit_msg>remove FAILED and OK macros, not needed with new test structure.<commit_after>#include "Session.h"
namespace objck {

void Session::closeSession()
{
	if(isDisabled()) {OK; return;}	
	
	PRECONDITION(_functionList)
	CK_RV rv = (*_functionList->C_CloseSession)(_session);
	if(rv)
	{
		throw CryptokiException(rv);
	}
	disable();
}

SessionInfo Session::getSessionInfo()
{
	PRECONDITION(isEnabled())
	PRECONDITION(_functionList)
	CK_SESSION_INFO a;
	CK_RV rv = (*_functionList->C_GetSessionInfo)(_session, &a);
	SessionInfo inf(a);
    if(rv)
        {
            throw CryptokiException(rv);
        }
	return inf;
}

void Session::getOperationState()
{
	PRECONDITION(isEnabled())
	PRECONDITION(_functionList)
	NOT_IMPLEMENTED;
}

void Session::setOperationState()
{
	PRECONDITION(isEnabled())
	PRECONDITION(_functionList)
	NOT_IMPLEMENTED;
}

void Session::userLogin(std::string& userPin)
{
	PRECONDITION(isEnabled())
	PRECONDITION(_functionList)
	
    CK_ULONG pinLen = userPin.length();

    CK_RV rv = (*_functionList->C_Login)(_session, CKU_USER, (unsigned char*)userPin.c_str(), pinLen);
    if(rv)
    {
        throw CryptokiException(rv);
    }
}

void Session::initPin(std::string& pin)
{
	PRECONDITION(_functionList)
	NOT_IMPLEMENTED;
/*	CK_ULONG pinLen = pin.length();
	CK_UTF8CHAR* utf8pin = new CK_UTF8CHAR[pin.length()];
    strncpy((char*)utf8pin, pin.c_str(), pin.length());

    CK_RV rv = (*_functionList->C_InitPIN)(session, utf8pin, pinLen);
    if(rv)
        {
            FAILED;
            throw CryptokiException(rv);
        }
    OK;*/
}

}/*END NAMESPACE*/
{'fraction_non_alphanumeric': 0.13881909547738694, 'fraction_numerical': 0.00314070351758794, 'mean_word_length': 4.096, 'pattern_counts': {'":': 0, '<': 3, '<?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': '3898213', 'n_tokens_mistral': 1167, 'n_tokens_neox': 1141, 'n_words': 193}