<commit_before>#include <stdlib.h> // EXIT_SUCCESS
#include "ua_base64.h"

#include "check.h"


START_TEST(base64_test_basic)
{


	//this is base64'd ASCII string "open62541"
	UA_String encodedString = {12, (UA_Byte*)"b3BlbjYyNTQx"};

	//assure that we allocate at least 9 bytes
	ck_assert_int_ge(UA_base64_getDecodedSizeUB(&encodedString), 9);

	UA_Byte* decodedData = (UA_Byte*)malloc(UA_base64_getDecodedSizeUB(&encodedString));
	UA_base64_decode(&encodedString, decodedData);

	//check the string
	ck_assert_int_eq(decodedData[0], 'o');
	ck_assert_int_eq(decodedData[1], 'p');
	ck_assert_int_eq(decodedData[2], 'e');
	ck_assert_int_eq(decodedData[3], 'n');
	ck_assert_int_eq(decodedData[4], '6');
	ck_assert_int_eq(decodedData[5], '2');
	ck_assert_int_eq(decodedData[6], '5');
	ck_assert_int_eq(decodedData[7], '4');
	ck_assert_int_eq(decodedData[8], '1');
}
END_TEST

Suite*base64_testSuite(void)
{<commit_msg>fixed memleak in a test<commit_after>#include <stdlib.h> // EXIT_SUCCESS
#include "ua_base64.h"

#include "check.h"


START_TEST(base64_test_basic)
{


	//this is base64'd ASCII string "open62541"
	UA_String encodedString = {12, (UA_Byte*)"b3BlbjYyNTQx"};

	//assure that we allocate at least 9 bytes
	ck_assert_int_ge(UA_base64_getDecodedSizeUB(&encodedString), 9);

	UA_Byte* decodedData = (UA_Byte*)malloc(UA_base64_getDecodedSizeUB(&encodedString));
	UA_base64_decode(&encodedString, decodedData);

	//check the string
	ck_assert_int_eq(decodedData[0], 'o');
	ck_assert_int_eq(decodedData[1], 'p');
	ck_assert_int_eq(decodedData[2], 'e');
	ck_assert_int_eq(decodedData[3], 'n');
	ck_assert_int_eq(decodedData[4], '6');
	ck_assert_int_eq(decodedData[5], '2');
	ck_assert_int_eq(decodedData[6], '5');
	ck_assert_int_eq(decodedData[7], '4');
	ck_assert_int_eq(decodedData[8], '1');

	free(decodedData);
}
END_TEST

Suite*base64_testSuite(void)
{
{'fraction_non_alphanumeric': 0.1509940891993552, 'fraction_numerical': 0.04083825900053734, 'mean_word_length': 8.217821782178218, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '313133', 'n_tokens_mistral': 824, 'n_tokens_neox': 768, 'n_words': 117}