Exemple #1
0
        /*! @brief Return the relative ordering of two Values.
         @param[in] other The Value to be compared with.
         @returns The relative ordering of the two Values. */
        inline bool
        operator !=
            (const Value &  other)
        {
            bool    valid = false;
            bool    result = ! equalTo(other, valid);

            return (valid && result);
        } // operator !=
bool IpfixExporterCfg::deriveFrom(IpfixExporterCfg* other)
{
	return equalTo(other);
}
Exemple #3
0
bool CEntityItem::operator != (const CEntityItem& item) const
{
    return !equalTo(&item);
}
Exemple #4
0
 inline bool operator != ( const Vector2& vector ) const
 {
     return ! equalTo( vector );
 }
Exemple #5
0
int main(void) {

	int result;

	person * person1;
	person * person2;
	person * person3 = NULL;

	/*Start createPerson Test*/
	printf("\nTesting createPerson function...\n");

	person1 = createPerson();
	printf("person1 pointer value: %p\n", &person1);

	person2 = createPerson();
	printf("person2 pointer value: %p\n", &person2);

	if(&person1 != &person2) {
		printf("Success! pointers are referencing different mem locations. EXPECTED\n\n");
	}
	else {
		printf("Fail... pointers are referencing same mem location.\n\n");
	}
	/*End createPerson Test*/


	/*Start destroyPerson Test*/
	printf("Testing destroyPerson function...\n");
	destroyPerson(person1);
	person1 = NULL;

	printf("person1 deleted... ptr value: %p\n", &person1);
	printf("trying to delete again...\n");

	destroyPerson(person1);
	printf("NOTE: must set the pointer to NULL after using destroyPerson, or program will crash due to invalid pointer\n\n");
	/*End destroyPerson Test*/


	/*Start printPerson Test*/
	printf("Testing printPerson function...\n");

	printf("printing the destroyed person1...\n");
	printPerson(person1);
	
	printf("printing the valid person2...\n");
	printPerson(person2);

	printf("\n");
	/*End printPerson Test*/


	/*Start changeInfo Test*/
	printf("Testing changeInfo function...\n")
;
	printf("Attempting to changeInfo on destroyed person1...\n");
	if(changeInfo(person1, "Justin","Fuerth",25)) {
		printf("Error! person1 is NULL\n");
	}
	else {
		printf("Successfully changed info... something went wrong...\n");
	}

	printf("Attempting to changeInfo on valid person2...\n");
	if(changeInfo(person2, "Justin","Fuerth",25)) {
		printf("Error! person2 is NULL... that's not right\n");
	}
	else {
		printf("Successfully changed info for person2!\n");
	}

	printf("Printing person2 again...\n");
	printPerson(person2);

	printf("\n");
	/*End changeInfo Test*/


	/*recreating person1 for further testing purposes*/
	printf("Creating person1 again and giving it values: Stephen, Fuerth, 62\n\n");
	person1 = createPerson();
	changeInfo(person1, "Stephen", "Fuerth", 62);


	/*Start equalTo Test*/
	printf("Testing the equalTo function...\n");

	printf("Testing equalTo with NULL pointer person3...\n");
	if((result = equalTo(person3,person3))>-1) {
		if(result == 0) {
			printf("the two people are different!\n");
		}
		else {
			printf("the two people are equal!\n");
		}
	}
	else {
		printf("There was an error with the equalTo function. EXPECTED\n");
	}

	printf("Testing equalTo with one NULL and one valid...\n");
	if((result = equalTo(person1,person3))>-1) {
		if(result == 0) {
			printf("the two people are different!\n");
		}
		else {
			printf("the two people are equal!\n");
		}
	}
	else {
		printf("There was an error with the equalTo function. EXPECTED\n");
	}
	printf("Testing equalTo function with two valid, different people...\n");
	if((result = equalTo(person1,person2))>-1) {
		if(result == 0) {
			printf("the two people are different! EXPECTED\n");
		}
		else {
			printf("the two people are equal!\n");
		}
	}
	else {
		printf("There was an error with the equalTo function.\n");
	}

	printf("Testing equalTo function with two valid, equal people...\n");
	if((result = equalTo(person1,person1))>-1) {
		if(result == 0) {
			printf("the two people are different!\n");
		}
		else {
			printf("the two people are equal! EXPECTED\n");
		}
	}
	else {
		printf("There was an error with the equalTo function.\n");
	}
	
	printf("\n");
	/*End equalTo Test*/

	
	/*Start copyInfo Test*/
	printf("Testing copyInfo function...\n");

	printf("Attempting to copy into a NULL pointer...\n");
	if(copyInfo(person1,person3)) {
		printf("there was an error with the copyInfo function... EXPECTED\n");
	}

	printf("Attempting to copy from a NULL pointer...\n");
	if(copyInfo(person3,person1)) {
		printf("there was an error with the copyInfo function... EXPECTED\n");
	}

	/*creating an empty person3 to copy info into*/
	person3 = createPerson();

	printf("Attempting to copy from valid person1 to valid person3...\n");
	if(copyInfo(person1,person3)) {
		printf("there was an error with the copyInfo function...\n");
	}
	else {
		printf("SUCCESS! EXPECTED\n");
	}

	printf("Printing person3... expected: Stephen Fuerth, 62\n");
	printPerson(person3);
	/*End copyInfo Test*/

	/*freeing all memory to check memleaks with valgrind*/
	destroyPerson(person1);
	destroyPerson(person2);
	destroyPerson(person3);
	/*Aug 26 8:53 - valgrind shows no memory leaks*/

	printf("\n");
	return 0;

}
Exemple #6
0
 inline bool operator == ( const Vector4& vector ) const
 {
     return equalTo( vector );
 }