<commit_before>/****************************************************************************
 *
 * Copyright 2016 Samsung Electronics All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
 * either express or implied. See the License for the specific
 * language governing permissions and limitations under the License.
 *
 ****************************************************************************/

#ifndef __EXAMPLES_TESTCASE_TESTCASE_COMMON_H
#define __EXAMPLES_TESTCASE_TESTCASE_COMMON_H
#include <stdio.h>
#include <stdlib.h>

int total_pass;
int total_fail;

#define TC_ASSERT_CLEANUP(api_name, var, error, freeResource) \
{\
	if (!(var)) {\
		printf("\n[%s][Line : %d] FAIL, %s : API error returned = %s [%s]\n", __func__, __LINE__, api_name, error, #var); \
		total_fail++; \
		freeResource; \
		return; \
	} \
}

#define TC_ASSERT(api_name, var) \
{\
	if (!(var)) {\
		printf("\n[%s][Line : %d] FAIL, %s : Following expression is not true: %s\n", __func__, __LINE__, api_name, #var); \
		total_fail++; \
		return; \
	} \
}

#define TC_ASSERT_EQ_CLEANUP(api_name, var, ref, error, freeResource) \
{\
	if ((var) != (ref)) {\
		printf("\n[%s][Line : %d] FAIL, %s : API error returned = %s [%d] ", __func__, __LINE__, api_name, error, #var); \
		total_fail++; \
		freeResource; \
		return; \
	} \
}

#define TC_ASSERT_EQ(api_name, var, ref) \
{\
	if ((var) != (ref)) {\
		printf("\n[%s][Line : %d] FAIL, %s : Values (%s == 0x%x) and (%s == 0x%x) are not equal\n", __func__, __LINE__, api_name, #var, (int)(var), #ref, (int)(ref)); \
		total_fail++; \
	} \
}

#define TC_ASSERT_NEQ_CLEANUP(api_name, var, ref, error, freeResource) \<commit_msg>Add omitted return in TC_ASSERT_EQ in tc_common.h<commit_after>/****************************************************************************
 *
 * Copyright 2016 Samsung Electronics All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
 * either express or implied. See the License for the specific
 * language governing permissions and limitations under the License.
 *
 ****************************************************************************/

#ifndef __EXAMPLES_TESTCASE_TESTCASE_COMMON_H
#define __EXAMPLES_TESTCASE_TESTCASE_COMMON_H
#include <stdio.h>
#include <stdlib.h>

int total_pass;
int total_fail;

#define TC_ASSERT_CLEANUP(api_name, var, error, freeResource) \
{\
	if (!(var)) {\
		printf("\n[%s][Line : %d] FAIL, %s : API error returned = %s [%s]\n", __func__, __LINE__, api_name, error, #var); \
		total_fail++; \
		freeResource; \
		return; \
	} \
}

#define TC_ASSERT(api_name, var) \
{\
	if (!(var)) {\
		printf("\n[%s][Line : %d] FAIL, %s : Following expression is not true: %s\n", __func__, __LINE__, api_name, #var); \
		total_fail++; \
		return; \
	} \
}

#define TC_ASSERT_EQ_CLEANUP(api_name, var, ref, error, freeResource) \
{\
	if ((var) != (ref)) {\
		printf("\n[%s][Line : %d] FAIL, %s : API error returned = %s [%d] ", __func__, __LINE__, api_name, error, #var); \
		total_fail++; \
		freeResource; \
		return; \
	} \
}

#define TC_ASSERT_EQ(api_name, var, ref) \
{\
	if ((var) != (ref)) {\
		printf("\n[%s][Line : %d] FAIL, %s : Values (%s == 0x%x) and (%s == 0x%x) are not equal\n", __func__, __LINE__, api_name, #var, (int)(var), #ref, (int)(ref)); \
		total_fail++; \
		return; \
	} \
}

#define TC_ASSERT_NEQ_CLEANUP(api_name, var, ref, error, freeResource) \
{'fraction_non_alphanumeric': 0.21971899224806202, 'fraction_numerical': 0.0048449612403100775, 'mean_word_length': 4.314028314028314, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '3291270', 'n_tokens_mistral': 1443, 'n_tokens_neox': 1359, 'n_words': 413}