Example #1
0
bool FTEST_dirname(void) {
	emit_function("function:  condor_dirname(const char *path)");
	emit_comment("comment: A dirname() function that is happy on both Unix and NT. This allocates space for a new string that holds the path of the parent directory of the path it was given.  If the given path has no directory delimiters, or is NULL, we just return '.'.  In all cases, the string we return is new space, and must be deallocated with free().   Derek Wright 9/23/99");
	FunctionDriver driver;
	driver.register_function(test_null);
	driver.register_function(test_empty_string);
	driver.register_function(test_current_directory);
	driver.register_function(test_simple_path_1);
	driver.register_function(test_simple_path_2);
	driver.register_function(test_simple_directory_1);
	driver.register_function(test_simple_directory_2);
	driver.register_function(test_directory_and_file_1);
	driver.register_function(test_directory_and_file_2);
	driver.register_function(test_root_directory);
	driver.register_function(test_directory_and_directory);
	driver.register_function(test_directory_and_directory_in_root);
	driver.register_function(test_forward_slash);
	driver.register_function(test_backslash);
	driver.register_function(test_period_and_forward_slash_1);
	driver.register_function(test_period_and_backslash_1);
	driver.register_function(test_period_and_forward_slash_2);
	driver.register_function(test_period_and_backslash_2);
	driver.register_function(test_backslash_and_period);
	driver.register_function(test_forward_slash_and_file_extension);
	driver.register_function(test_backslash_and_file_extension);
	driver.register_function(test_period_and_forward_slash);
	driver.register_function(test_period_and_backslash);
	driver.register_function(test_period_and_forward_slash_with_special_file);
	driver.register_function(test_period_and_backslash_with_special_file);
	driver.register_function(test_double_forward_slash);
	driver.register_function(test_double_backslash);
	return driver.do_all_functions();
}
Example #2
0
bool FTEST_strlwr(void) {
	emit_function("char* strlwr(char* src)");
	emit_comment("Convert a string, in place, to the lowercase version of it.");
	emit_problem("Function does no error checking on the size of string");
	
		// driver to run the tests and all required setup
	FunctionDriver driver;
	driver.register_function(test_normal_case);
	driver.register_function(test_return_value);
	
		// run the tests
	return driver.do_all_functions();
}
Example #3
0
static void compile(module_t m, struct symbol_list *list)
{
	struct symbol *sym;

	FOR_EACH_PTR(list, sym) {
		struct entrypoint *ep;

		expand_symbol(sym);
		ep = linearize_symbol(sym);
		if (ep)
			emit_function(m, ep);
		else
			emit_toplevel(m, sym);
	} END_FOR_EACH_PTR(sym);
}
bool FTEST_is_valid_sinful(void) {
		// beginning junk for getPortFromAddr(() {
	emit_function("int is_valid_sinful(char* sinful)");
	emit_comment("Determines if a function is a valid sinful string.");
	emit_problem("None");
	
		// driver to run the tests and all required setup
	FunctionDriver driver;
	driver.register_function(test_normal_case);
	driver.register_function(test_hostname);
	driver.register_function(test_no_angle_brackets);
	
		// run the tests
	return driver.do_all_functions();
}
bool FTEST_string_to_sin(void) {
		// beginning junk for getPortFromAddr(() {
	emit_function("string_to_sin(const char*, struct sockaddr_in*)");
	emit_comment("Converts a sinful string to a sockaddr_in.");
	emit_problem("Port numbers must be passed through htons as expected, but IP addresses should not be passed through htonl.");
	emit_problem("Function assumes a well-formatted string if it sees a : anywhere.");
	
		// driver to run the tests and all required setup
	FunctionDriver driver;
#ifdef IPV6_REMOVED
	driver.register_function(test_normal_case);
	driver.register_function(test_alpha_input);
#endif
	
		// run the tests
	return driver.do_all_functions();
}
Example #6
0
bool FTEST_fullpath(void) {
	emit_function("int fullpath( const char* path )");
	emit_comment("return TRUE if the given path is a full pathname, FALSE if not.  by full pathname, we mean it either begins with '/' or '\' or '*:\' (something like 'c:\\...' on windoze).");
	
		// driver to run the tests and all required setup
	FunctionDriver driver;
	driver.register_function(test_forward_slash);
	driver.register_function(test_name);
	driver.register_function(test_drive_path_backslash);
	driver.register_function(test_colon_backslash);
	driver.register_function(test_backslash);
	driver.register_function(test_drive_path_forward_slash);
	driver.register_function(test_colon_forward_slash);
	
		// run the tests
	return driver.do_all_functions();
}
Example #7
0
bool FTEST_tokener(void) {
		// beginning junk for getPortFromAddr(() {
	emit_function("tokener class and SORTED/UNSORTED_TOKENER_TABLE");
	emit_comment("tokenizing and efficient lookup by name in a static const table");

		// driver to run the tests and all required setup
	FunctionDriver driver;
	driver.register_function(test_unsorted_table);
	driver.register_function(test_sorted_table);
	driver.register_function(test_nocase_sorted_table);
	driver.register_function(test_tokener_parse_basic);
	driver.register_function(test_tokener_parse_regex);
	driver.register_function(test_tokener_parse_realistic);

		// run the tests
	return driver.do_all_functions();
}
Example #8
0
bool FTEST_is_ipaddr(void) {
		// beginning junk for getPortFromAddr(() {
	emit_function("int is_ipaddr(char* addr)");
	emit_comment("Determines if a function is an ip address (with wildcards allowed).");
	emit_problem("None");
	
		// driver to run the tests and all required setup
	FunctionDriver driver;
#ifdef IPV6_REMOVED
	driver.register_function(test_normal_case);
	driver.register_function(test_one_octet_wildcard);
	driver.register_function(test_upper_bound);
	driver.register_function(test_lower_bound);
	driver.register_function(test_only_wildcard);
	driver.register_function(test_start_wildcard);
#endif
	
		// run the tests
	return driver.do_all_functions();
}
bool FTEST_sin_to_string(void) {
	const char* h = "<[fe80::862b:2bff:fe98:65f2]:9618>";
	condor_sockaddr addr;
	addr.from_sinful(h);


		// beginning junk for getPortFromAddr(() {
	emit_function("sin_to_string(sockaddr_in)");
	emit_comment("Converts a sockaddr_in to a sinful string.");
	emit_problem("None");
	
		// driver to run the tests and all required setup
	FunctionDriver driver;
#ifdef IPV6_REMOVED
	driver.register_function(test_normal_case);
#endif
	
		// run the tests
	return driver.do_all_functions();
}
bool FTEST_is_valid_network(void) {
		// beginning junk for getPortFromAddr(() {
	emit_function("int is_valid_network(char* network, struct in_addr* ip, struct in_addr* mask)");
	emit_comment("Returns true if the given string is a valid network.");
	emit_problem("Allows the use of wildcards in addresses and netmasks.");
	emit_problem("Doesn't check to see if the netmask is a valid netmask, if it sees something like an IP address it assumes everything works.");
	
		// driver to run the tests and all required setup
	FunctionDriver driver;
#ifdef IPV6_REMOVED
	driver.register_function(test_normal_case);
	driver.register_function(test_slash_notation);
	driver.register_function(test_classless_mask);
	driver.register_function(test_wildcard);
	driver.register_function(test_plain_ip);
#endif
	
		// run the tests
	return driver.do_all_functions();
}
Example #11
0
bool FTEST_stl_string_utils(void) {
		// beginning junk for getPortFromAddr(() {
	emit_function("STL string utils");
	emit_comment("Package of functions/operators to facilitate adoption of std::string");
	
		// driver to run the tests and all required setup
	FunctionDriver driver;
	driver.register_function(test_comparison_ops_lhs_string);
	driver.register_function(test_comparison_ops_lhs_MyString);
	driver.register_function(test_sprintf_string);
	driver.register_function(test_sprintf_MyString);
	driver.register_function(test_sprintf_cat_string);
	driver.register_function(test_sprintf_cat_MyString);
	driver.register_function(test_lower_case_empty);
	driver.register_function(test_lower_case_non_empty);
	driver.register_function(test_upper_case_empty);
	driver.register_function(test_upper_case_non_empty);
	driver.register_function(test_chomp_new_line_end);
	driver.register_function(test_chomp_crlf_end);
	driver.register_function(test_chomp_new_line_beginning);
	driver.register_function(test_chomp_return_false);
	driver.register_function(test_chomp_return_true);
	driver.register_function(test_trim_beginning_and_end);
	driver.register_function(test_trim_end);
	driver.register_function(test_trim_none);
	driver.register_function(test_trim_beginning);
	driver.register_function(test_trim_empty);
	driver.register_function(tokenize_null);
	driver.register_function(tokenize_skip);
	driver.register_function(tokenize_multiple_calls);
	driver.register_function(tokenize_end);
	driver.register_function(tokenize_empty);
	driver.register_function(tokenize_empty_delimiter);
	
		// run the tests
	return driver.do_all_functions();
}