int main() { test_trim(); test_toupper_tolower(); test_compare_icase(); test_sstream(); test_prefix_suffix(); test_replace(); test_split_ws(); test_split(); test_join(); test_contains(); test_extract_between(); test_random(); test_hexdump(); test_base64(); test_uri_decode(); test_levenshtein(); #if HAVE_OPENSSL test_crypto_digest(); #endif return 0; }
int main(){ int i; int a[] = {8, 2, 7, 9, 11, 3, 2, 6}; BST_PTR t = bst_create(); for(i=0; i<8; i++) bst_insert(t, a[i]); assert(bst_size(t) == 7); test_insert(t); test_contains(t); bst_inorder(t); bst_preorder(t); bst_postorder(t); bst_ith_smallest(t, 1) bst_size(t); bst_free(t); }
int test_main(int, char*[]) { test_has_member_find(); test_contains(); return 0; }
int main(int argc, char **argv) { JNX_LOG(NULL,"Running stack tests...\n"); test_stack_grow(); test_stack_pop(); test_contains(); JNX_LOG(NULL,"Stack tests completed.\n"); return 0; }
int main() { test_basic_operations(); test_set_and_get_for_all_data_types(); test_contains_and_find_one_for_all_data_types(); test_internal_type_conversion(); test_contains(); test_find_one(); return 0; }
int test_jnxlist() { JNXLOG(LDEBUG,"Running list tests...\n"); test_list_creation(); test_data_removal(); test_list_index(); test_list_tail(); test_removal_front(); test_removal_from(); test_removal_returns_correct_data(); test_contains(); JNXLOG(LDEBUG,"List tests completed.\n"); return 0; }
/* Program entry point */ int main(int argc, char **argv) { cb_tree_t tree = cb_tree_make(); printf("%d ", ++tnum); fflush(stdout); test_insert(&tree); printf("%d ", ++tnum); fflush(stdout); test_complete(&tree, sizeof(dict) / sizeof(const char *)); printf("%d ", ++tnum); fflush(stdout); test_insert_dup(&tree); printf("%d ", ++tnum); fflush(stdout); test_contains(&tree); printf("%d ", ++tnum); fflush(stdout); test_delete(&tree); printf("%d ", ++tnum); fflush(stdout); cb_tree_clear(&tree); test_insert(&tree); test_complete(&tree, sizeof(dict) / sizeof(const char *)); printf("%d ", ++tnum); fflush(stdout); test_delete_all(&tree); printf("%d ", ++tnum); fflush(stdout); test_complete(&tree, 0); printf("%d ", ++tnum); fflush(stdout); cb_tree_clear(&tree); test_empty(&tree); printf("%d ", ++tnum); fflush(stdout); test_insert(&tree); test_prefixes(&tree); cb_tree_clear(&tree); printf("ok\n"); return 0; }
int main() { Tree *tree = NULL; IntList *list = NULL; int nums[12] = {10, 15, 5, 3, 14, 7, 2, 11, 9, 0, 16, 15}; // NULL Tree. printf("Attempting to make and print a NULL Tree...\n"); tree = new_tree_from_list(list); print_tree(tree); // Few elements at a time. printf("Adding a few elements at a time...\n"); tree = new_tree(); insert(tree, 5); printf("One leaf...\n"); print_tree(tree); insert(tree, 3); printf("Two leaves...\n"); print_tree(tree); insert(tree, 7); printf("Three leaves...\n"); print_tree(tree); // From a list. printf("Making a Tree from an IntList...\n"); list = wrap_array(nums, 12); tree = new_tree_from_list(list); print_tree(tree); // Testing contains. test_contains(tree, 1); test_contains(tree, 16); test_contains(tree, 15); test_contains(tree, 5); test_contains(tree, 7); test_contains(tree, 0); test_contains(tree, 6); return 0; }
void VectorTest::run_test_case(void) { message += "Running vector test case...\n"; // Constructor and destructor methods test_constructor(); test_destructor(); // Arithmetic operators test_sum_operator(); test_rest_operator(); test_multiplication_operator(); test_division_operator(); // Operation and assignment operators test_sum_assignment_operator(); test_rest_assignment_operator(); test_multiplication_assignment_operator(); test_division_assignment_operator(); // Equality and relational operators test_equal_to_operator(); test_not_equal_to_operator(); test_greater_than_operator(); test_greater_than_or_equal_to_operator(); test_less_than_operator(); test_less_than_or_equal_to_operator(); // Output operator test_output_operator(); // Get methods test_get_display(); // Set methods test_set(); test_set_display(); // Resize methods test_resize(); test_tuck_in(); test_take_out(); test_remove_element(); test_get_assembly(); // Initialization methods test_initialize(); test_initialize_sequential(); test_randomize_uniform(); test_randomize_normal(); // Checking methods test_contains(); test_is_in(); test_is_constant(); test_is_crescent(); test_is_decrescent(); // Mathematical methods test_dot_vector(); test_dot_matrix(); test_calculate_sum(); test_calculate_partial_sum(); test_calculate_product(); test_calculate_mean(); test_calculate_standard_deviation(); test_calculate_covariance(); test_calculate_mean_standard_deviation(); test_calculate_minimum(); test_calculate_maximum(); test_calculate_minimum_maximum(); test_calculate_minimum_missing_values(); test_calculate_maximum_missing_values(); test_calculate_minimum_maximum_missing_values(); test_calculate_explained_variance(); test_calculate_histogram(); test_calculate_bin(); test_calculate_frequency(); test_calculate_total_frequencies(); test_calculate_minimal_index(); test_calculate_maximal_index(); test_calculate_minimal_indices(); test_calculate_maximal_indices(); test_calculate_minimal_maximal_index(); test_calculate_cumulative_index(); test_calculate_closest_index(); test_calculate_norm(); test_calculate_normalized(); test_calculate_sum_squared_error(); test_calculate_mean_squared_error(); test_calculate_root_mean_squared_error(); test_apply_absolute_value(); test_calculate_lower_bounded(); test_calculate_upper_bounded(); test_calculate_lower_upper_bounded(); test_apply_lower_bound(); test_apply_upper_bound(); test_apply_lower_upper_bounds(); test_calculate_less_rank(); test_calculate_greater_rank(); test_calculate_linear_correlation(); test_calculate_linear_correlation_missing_values(); test_calculate_linear_regression_parameters(); // Scaling and unscaling test_scale_minimum_maximum(); test_scale_mean_standard_deviation(); // Parsing methods test_parse(); // Serialization methods test_save(); test_load(); message += "End vector test case\n"; }
static bool contains_test(void) { bool success = true; success &= test_contains(0x12345678U, 32, 0x12345677U, false); success &= test_contains(0x12345678U, 32, 0x12345678U, true); success &= test_contains(0x12345678U, 32, 0x12345679U, false); success &= test_contains(0x01020300U, 24, 0x010202FFU, false); success &= test_contains(0x01020300U, 24, 0x01020300U, true); success &= test_contains(0x01020300U, 24, 0x010203FFU, true); success &= test_contains(0x01020300U, 24, 0x01020400U, false); success &= test_contains(0x01020304U, 30, 0x01020303U, false); success &= test_contains(0x01020304U, 30, 0x01020304U, true); success &= test_contains(0x01020304U, 30, 0x01020305U, true); success &= test_contains(0x01020304U, 30, 0x01020306U, true); success &= test_contains(0x01020304U, 30, 0x01020307U, true); success &= test_contains(0x01020304U, 30, 0x01020308U, false); success &= test_contains(0x00000000U, 0, 0x00000000U, true); success &= test_contains(0x00000000U, 0, 0x12345678U, true); success &= test_contains(0x00000000U, 0, 0xFFFFFFFFU, true); return success; }
int main(int argc , char ** argv) { int_vector_type * int_vector = int_vector_alloc( 0 , 99); test_abort(); test_assert_int_equal( -1 , int_vector_index(int_vector , 100)); test_assert_int_equal( -1 , int_vector_index_sorted(int_vector , 100)); test_assert_true( int_vector_is_instance( int_vector )); test_assert_false( double_vector_is_instance( int_vector )); int_vector_iset( int_vector , 2 , 0); int_vector_insert( int_vector , 2 , 77 ); int_vector_iset( int_vector , 5 , -10); assert_equal( int_vector_iget(int_vector , 0 ) == 99 ); assert_equal( int_vector_iget(int_vector , 1 ) == 99 ); assert_equal( int_vector_iget(int_vector , 2 ) == 77 ); assert_equal( int_vector_iget(int_vector , 3 ) == 00 ); assert_equal( int_vector_iget(int_vector , 4 ) == 99 ); assert_equal( int_vector_iget(int_vector , 5 ) == -10 ); { int N1 = 100000; int N2 = 10*N1; int_vector_type * v1 = int_vector_alloc( N1 , 0 ); int_vector_type * v2; int * data1 = int_vector_get_ptr( v1 ); int_vector_iset( v1 , N1 - 1, 99); int_vector_free_container( v1 ); v2 = int_vector_alloc( N2 , 0 ); int_vector_iset(v2 , N2 - 1, 77 ); test_assert_int_equal( data1[N1-1] , 99); int_vector_free( v2 ); free( data1 ); } test_assert_true( int_vector_init_range( int_vector , 100 , 1000 , 115 ) ); test_assert_int_equal( int_vector_iget( int_vector , 0 ) , 100); test_assert_int_equal( int_vector_iget( int_vector , 1 ) , 215); test_assert_int_equal( int_vector_iget( int_vector , 2 ) , 330); test_assert_int_equal( int_vector_iget( int_vector , 3 ) , 445); test_assert_int_equal( int_vector_get_last( int_vector ) , 1000); test_assert_false( int_vector_init_range( int_vector , 100 , -1000 , 115 ) ); test_assert_int_equal( int_vector_iget( int_vector , 0 ) , 100); test_assert_int_equal( int_vector_iget( int_vector , 1 ) , 215); test_assert_int_equal( int_vector_iget( int_vector , 2 ) , 330); test_assert_int_equal( int_vector_iget( int_vector , 3 ) , 445); test_assert_int_equal( int_vector_get_last( int_vector ) , 1000); { int_vector_type * v1 = int_vector_alloc(0,0); int_vector_type * v2 = int_vector_alloc(0,0); int_vector_append(v1 , 10); int_vector_append(v1 , 15); int_vector_append(v1 , 20); int_vector_append(v2 , 1); int_vector_append(v2 , 2); int_vector_append(v2 , 3); int_vector_append_vector( v1 , v2 ); test_assert_int_equal( int_vector_size( v1 ) , 6 ); test_assert_int_equal( int_vector_iget (v1 , 0 ), 10 ); test_assert_int_equal( int_vector_iget (v1 , 1 ), 15 ); test_assert_int_equal( int_vector_iget (v1 , 2 ), 20 ); test_assert_int_equal( int_vector_iget (v1 , 3 ), 1 ); test_assert_int_equal( int_vector_iget (v1 , 4 ), 2 ); test_assert_int_equal( int_vector_iget (v1 , 5 ), 3 ); int_vector_free( v1 ); int_vector_free( v2 ); } test_contains(); test_contains_sorted(); test_shift(); test_alloc(); test_div(); test_memcpy_from_data(); test_idel_insert(); test_del(); test_range_fill(); test_iset_block(); test_resize(); test_empty(); test_insert_double(); exit(0); }