示例#1
0
文件: main.c 项目: anonrose/CS260
/* Main function for testing different functions of the assignment */
int main() {
		printf("%u\n",compareValues(2.0,2.0));
    struct BSTree *tree	= newBSTree();

    testAddNode(tree);

    testContainsBSTree(tree);

    printf("printing in-order traversal \n");
    inorderTraversal(tree->root);

    printf("printing pre-order traversal \n");
    preorderTraversal(tree->root);

    printf("printing post-order traversal \n");
    postorderTraversal(tree->root);

    testLeftMost(tree);

    testRemoveNode(tree);

    freeBSTree(tree);

	return 0;
}
示例#2
0
int main(int argc, char *argv[])
{	
    testAddNode();
    testContainsBSTree();
    testLeftMost();
    testRemoveLeftMost();
    testRemoveNode();
    return 0;
}
示例#3
0
int main(int argc, char *argv[]){

    testAddNode();
    printf("\n");
    testContainsBSTree();
    printf("\n");
    testLeftMost();
    printf("\n");
    testRemoveLeftMost();
    printf("\n");
    testRemoveNode();
    return 0;
    getch();

}
示例#4
0
文件: main.c 项目: avisinha1/CS-261
int main(int argc, char *argv[]){	

    /*After implementing your code, please uncommnet the following calls to the test functions and test your code */
    testAddNode();
	
    printf("\n");
    testContainsBSTree();
	
    printf("\n");
    testLeftMost();
	
    printf("\n");
    testRemoveLeftMost();
	
    printf("\n");
    testRemoveNode();
	
    return 0;
}
示例#5
0
int main(int argc, char *argv[]){	

   //After implementing your code, please uncommnet the following calls to the test functions and test your code 
	
	/*
	printf("\nTesting first struct using the first compare function...");

	mydata1->name = "ann";
	mydata1->number = 6;
	mydata2->name = "bob";
	mydata2->number = 5;
	mydata3->name = "jill";
	mydata3->number = 7;
	mydata4->name = "jack";
	mydata4->number = 7;

	printf("\nPopulating tree: 6, 5, 7, 7");
	addBSTree(tree, mydata1);
	addBSTree(tree, mydata2);
	addBSTree(tree, mydata3);
	addBSTree(tree, mydata4);

	printf("\nTesting compare() on nodes 6(root) and 5(root->left), should return 1");
	printf("\nbecause 6 > 5");
	if (compare(tree->root->val, tree->root->left->val) == 1)
		printf("\ncompare() works correctly on nodes 6 and 5");
	 
	else 
		printf("\ncompare() doesnt work correctly with nodes 6 and 5");

	printf("\nTesting compare() on nodes 5(root->left), and 7(root->right), should return -1");
	printf("\nbecause 5 < 7");
	if (compare(tree->root->left->val, tree->root->right->val) == -1)
		printf("\ncompare() works correctly on nodes 5 and 7");
	
	else
		printf("\ncompare() doesnt work correctly with nodes 5 and 7");

	printf("\nTesting compare() on nodes 7(root->right) and duplicate 7 (root->right->left), should return 0");
	printf("\nbecause 7 = 7");
	if (compare(tree->root->right->left->val, tree->root->right->val) == 0)
		printf("\ncompare() works correctly on nodes 7 and 7 duplicate");

	else
		printf("\ncompare() does not work correctly on nodes 7 and 7 duplicate"); */

	printf("\nTesting first struct using the already given functions\n");
    testAddNode();
	
	printf("\n");
    testContainsBSTree();
	
	printf("\n");
    testLeftMost();
	
	printf("\n");
    testRemoveLeftMost();
	
	printf("\n");
    testRemoveNode();
    
	
	return 0;
}