<commit_before>/** \example src/testHelp/test.cpp
 *
 * This examples shows how to use the help mechanism
 */
#include <commonOptions/commonOptions.h>
#include <iostream>
#include <selfTest/selfTest.h>
#include <vector>

namespace {
	auto optPara = commonOptions::make_option("para1", 0, "an option");
	auto swtPara = commonOptions::make_switch("para2", "just a simple switch");
	auto swtHelp = commonOptions::make_switch("help",  "prints this help");
}

int main(int argc, char** argv) {
	SELFTESTMAIN(argv); // Only for unittesting

	/** Parse options, if something goes wrong print help message **/
	if (not commonOptions::parse(argc, argv)) {
		commonOptions::print();
		exit(0);
	}
	if (*swtHelp) {
		commonOptions::print();
		exit(0);
	}
	return 0;
}

SELFTEST(Test1, "", 0, "", "")
SELFTEST(Test2, "--help", 0, "--help                          prints this help\n"
                             "--para1 0                       an option\n"
                             "--para2                         just a simple switch\n", "")


<commit_msg>fixing testhelp<commit_after>/** \example src/testHelp/test.cpp
 *
 * This examples shows how to use the help mechanism
 */
#include <commonOptions/commonOptions.h>
#include <iostream>
#include <selfTest/selfTest.h>
#include <vector>

namespace {
	auto optPara = commonOptions::make_option("para1", 0, "an option");
	auto swtPara = commonOptions::make_switch("para2", "just a simple switch");
	auto swtHelp = commonOptions::make_switch("help",  "prints this help");
}

int main(int argc, char** argv) {
	SELFTESTMAIN(argv); // Only for unittesting

	/** Parse options, if something goes wrong print help message **/
	if (not commonOptions::parse(argc, argv)) {
		commonOptions::print();
		exit(0);
	}
	if (*swtHelp) {
		commonOptions::print();
		exit(0);
	}
	return 0;
}

SELFTEST(Test1, "", 0, "", "")
SELFTEST(Test2, "--help", 0, "--help                                    prints this help\n"
                             "--para1 0                                 an option\n"
                             "--para2                                   just a simple switch\n", "")
{'fraction_non_alphanumeric': 0.14547160957297042, 'fraction_numerical': 0.012200844673862036, 'mean_word_length': 2.4893617021276597, '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': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3355763', 'n_tokens_mistral': 667, 'n_tokens_neox': 639, 'n_words': 177}