<commit_before>/**
	Copyright (C) 2004 <NAME>, <NAME>, <NAME>, <NAME>, <NAME>

	License:  Apache License, Version 2.0  (see LICENSE)
 
	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.
 
	The use of the Apache License does not indicate that this project is
	affiliated with the Apache Software Foundation.
 */

#import <Foundation/Foundation.h>

/**
 * @abstract UKTestHandler implements the test assertions built into UnitKit
 * and support to report the results
 *
 * For each test assertion invoked on the test handler, the handler collects
 * the result and reports it or not based on the reporting settings.
 *
 * At any time, you can query the current test results using -testsPassed,
 * -testsFailed and -exceptionsReported, for all the test assertions invoked
 * since the test handler has been created.
 *
 * A single test handler exists for all UKRunner instances. For multiple run
 * test requests against UKRunner instances, all test results are reported
 * together.
*/
@interface UKTestHandler : NSObject
{
	@private
	id delegate;
	int testsPassed;
	int testsFailed;
	int exceptionsReported;
	BOOL quiet;
}


/** @taskunit Initialization */


/**
 * Returns the shared test handler.
 */
+ (UKTestHandler *)handler;


/** @taskunit Controlling Test Result Reporting */


/**
 * Returns a delegate that can implement the same reporting methods than
 * UKTestHandler.
 *
 * By default, returns nil.
 *
 * For more details, see -setDelegate:.
 */
- (id)delegate;
/**
 * Sets a delegate that can implement the same reporting methods than
 * UKTestHandler.
 *
 * If the delegate implements a reporting method, it takes priority over
 * UKTestHandler.
 * As a result, what was previously reported by UKTestHandler is not going to
 * be automatically logged in the console unless the delegate does it.
 */
- (void)setDelegate: (id)aDelegate;
/**
 * Returns whether the handler to report just the test failures and uncaught
 * exceptions, and nothing on test successes.
 */
- (BOOL)isQuiet;
/**
 * Tells the handler to report just the test failures and uncaught exceptions,
 * and nothing on test successes.
 */
- (void)setQuiet: (BOOL)isQuiet;
/**
 * If we have a delegate, then by all means use it. If we don't, then check to
 * see if we have any errors which should be reported off to std out.
 */
- (void)reportStatus: (BOOL)cond
              inFile: (const char *)filename
                line: (int)line
             message: (NSString *)msg;
/**
 * Reports an uncaught exception and a hint that represents the context in
 * which the exception was raised.
 *
 * To indicate the context, three hints are supported:
 *
 * <deflist>
 * <item>errExceptionOnInit</item><desc>inside -init on a test object</desc>
 * <item>errExceptionOnRelease</item><desc>inside -dealloc on a test object</desc>
 * <item>a test method name</item><desc>inside a test method</desc>
 * </deflist>
 *
 * By default, forwards the message to the delegate if there is one, otherwise
 * uses -reportWarning: to print the exception reason.
 */
- (void)reportException: (NSException *)exception
                inClass: (Class)testClass
                   hint: (NSString *)hint;
/**
 * Reports a warning message.
 *
 * By default, forwards the message to the delegate if there is one, otherwise
 * uses NSLog() to print the message.
 *
 * This method is used by -reportStatus:inFile:line:message: and
 * -reportException:inClass:hint: to report test failures and uncaught exceptions.
 */
- (void)reportWarning: (NSString *)message;


/** @taskunit Test Results */


/**
 * Returns the current number of test successes.
 *
 * See -reportStatus:inFile:line:message:.
 */<commit_msg>Fixed incorrect definition list markup<commit_after>/**
	Copyright (C) 2004 <NAME>, <NAME>, <NAME>, <NAME>, <NAME>

	License:  Apache License, Version 2.0  (see LICENSE)
 
	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.
 
	The use of the Apache License does not indicate that this project is
	affiliated with the Apache Software Foundation.
 */

#import <Foundation/Foundation.h>

/**
 * @abstract UKTestHandler implements the test assertions built into UnitKit
 * and support to report the results
 *
 * For each test assertion invoked on the test handler, the handler collects
 * the result and reports it or not based on the reporting settings.
 *
 * At any time, you can query the current test results using -testsPassed,
 * -testsFailed and -exceptionsReported, for all the test assertions invoked
 * since the test handler has been created.
 *
 * A single test handler exists for all UKRunner instances. For multiple run
 * test requests against UKRunner instances, all test results are reported
 * together.
*/
@interface UKTestHandler : NSObject
{
	@private
	id delegate;
	int testsPassed;
	int testsFailed;
	int exceptionsReported;
	BOOL quiet;
}


/** @taskunit Initialization */


/**
 * Returns the shared test handler.
 */
+ (UKTestHandler *)handler;


/** @taskunit Controlling Test Result Reporting */


/**
 * Returns a delegate that can implement the same reporting methods than
 * UKTestHandler.
 *
 * By default, returns nil.
 *
 * For more details, see -setDelegate:.
 */
- (id)delegate;
/**
 * Sets a delegate that can implement the same reporting methods than
 * UKTestHandler.
 *
 * If the delegate implements a reporting method, it takes priority over
 * UKTestHandler.
 * As a result, what was previously reported by UKTestHandler is not going to
 * be automatically logged in the console unless the delegate does it.
 */
- (void)setDelegate: (id)aDelegate;
/**
 * Returns whether the handler to report just the test failures and uncaught
 * exceptions, and nothing on test successes.
 */
- (BOOL)isQuiet;
/**
 * Tells the handler to report just the test failures and uncaught exceptions,
 * and nothing on test successes.
 */
- (void)setQuiet: (BOOL)isQuiet;
/**
 * If we have a delegate, then by all means use it. If we don't, then check to
 * see if we have any errors which should be reported off to std out.
 */
- (void)reportStatus: (BOOL)cond
              inFile: (const char *)filename
                line: (int)line
             message: (NSString *)msg;
/**
 * Reports an uncaught exception and a hint that represents the context in
 * which the exception was raised.
 *
 * To indicate the context, three hints are supported:
 *
 * <deflist>
 * <term>errExceptionOnInit</term><desc>inside -init on a test object</desc>
 * <term>errExceptionOnRelease</term><desc>inside -dealloc on a test object</desc>
 * <term>a test method name</term><desc>inside a test method</desc>
 * </deflist>
 *
 * By default, forwards the message to the delegate if there is one, otherwise
 * uses -reportWarning: to print the exception reason.
 */
- (void)reportException: (NSException *)exception
                inClass: (Class)testClass
                   hint: (NSString *)hint;
/**
 * Reports a warning message.
 *
 * By default, forwards the message to the delegate if there is one, otherwise
 * uses NSLog() to print the message.
 *
 * This method is used by -reportStatus:inFile:line:message: and
 * -reportException:inClass:hint: to report test failures and uncaught exceptions.
 */
- (void)reportWarning: (NSString *)message;


/** @taskunit Test Results */


/**
 * Returns the current number of test successes.
 *
 * See -reportStatus:inFile:line:message:.
 */
{'fraction_non_alphanumeric': 0.08757367977865993, 'fraction_numerical': 0.0024058703235895584, 'mean_word_length': 3.6945228684359117, 'pattern_counts': {'":': 0, '<': 43, '<?xml version=': 0, '>': 43, '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': '6622119', 'n_tokens_mistral': 2278, 'n_tokens_neox': 2176, 'n_words': 1028}