Beispiel #1
0
void seatest_assert_string_equal(char* expected, char* actual, const char* function, unsigned int line)
{
        int comparison;
	char s[SEATEST_PRINT_BUFFER_SIZE];
	
	if ((expected == (char *)0) && (actual == (char *)0))
	{
          sprintf(s, "Expected <NULL> but was <NULL>");
	  comparison = 1;
	}
        else if ((expected == (char *)0))
	{
	  sprintf(s, "Expected <NULL> but was %s", actual);
	  comparison = 0;
	}
        else if ((actual == (char *)0))
	{
	  sprintf(s, "Expected %s but was <NULL>", expected);
	  comparison = 0;
	}
	else
	{
	  comparison = strcmp(expected, actual) == 0;
	  sprintf(s, "Expected %s but was %s", expected, actual);	
	}

	seatest_simple_test_result(comparison, s, function, line);	
}
Beispiel #2
0
void seatest_assert_double_equal( double expected, double actual, double delta, const char* function, unsigned int line )
{
	char s[SEATEST_PRINT_BUFFER_SIZE];
	double result = expected-actual;
	sprintf(s, "Expected %f but was %f", expected, actual);
	if(result < 0.0) result = 0.0 - result;
	seatest_simple_test_result( result <= delta, s, function, line);	
}
Beispiel #3
0
void seatest_assert_float_equal( float expected, float actual, float delta, const char* function, unsigned int line )
{
	char s[SEATEST_PRINT_BUFFER_SIZE];
	float result = expected-actual;
	sprintf(s, "Expected %f but was %f", expected, actual);
	if(result < 0.0) result = 0.0f - result;
	seatest_simple_test_result( result <= delta, s, function, line);	
}
Beispiel #4
0
void seatest_assert_int_equal(int expected, int actual, const char* function, unsigned int line)
{
	char s[SEATEST_PRINT_BUFFER_SIZE];
	sprintf(s, "Expected %d but was %d", expected, actual);
	seatest_simple_test_result(expected==actual, s, function, line);	
}
Beispiel #5
0
void seatest_assert_false(int test, const char* function, unsigned int line)
{
	seatest_simple_test_result(!test, "Should of been false", function, line);	
}
Beispiel #6
0
void seatest_assert_string_doesnt_contain(const char* expected, const char* actual, const char* function, unsigned int line)
{
	char s[SEATEST_PRINT_BUFFER_SIZE];
	sprintf(s, "Expected \"%s\" not to have \"%s\" in it", actual, expected);
	seatest_simple_test_result(strstr(actual, expected)==0, s, function, line);	
}
Beispiel #7
0
void seatest_assert_string_contains(const char* expected, const char* actual, const char* function, unsigned int line)
{
	char s[SEATEST_PRINT_BUFFER_SIZE];
	sprintf(s, "Expected \"%s\" to be in \"%s\"", expected, actual);
	seatest_simple_test_result(strstr(actual, expected)!=0, s, function, line);	
}
Beispiel #8
0
void seatest_assert_string_starts_with(const char* expected, const char* actual, const char* function, unsigned int line)
{
	char s[SEATEST_PRINT_BUFFER_SIZE];
	sprintf(s, "Expected \"%s\" to start with \"%s\"", actual, expected);
	seatest_simple_test_result(strncmp(expected, actual, strlen(expected))==0, s, function, line);	
}
Beispiel #9
0
void seatest_assert_string_equal(const char* expected, const char* actual, const char* function, unsigned int line)
{
	char s[SEATEST_PRINT_BUFFER_SIZE];
	sprintf(s, "Expected \"%s\" but was \"%s\"", expected, actual);
	seatest_simple_test_result(strcmp(expected, actual)==0, s, function, line);	
}
Beispiel #10
0
void seatest_assert_ulong_equal(unsigned long expected, unsigned long actual, const char* function, unsigned int line)
{
	char s[SEATEST_PRINT_BUFFER_SIZE];
	sprintf(s, "Expected %lu but was %lu", expected, actual);
	seatest_simple_test_result(expected==actual, s, function, line);	
}
Beispiel #11
0
void seatest_assert_string_ends_with(char* expected, char* actual, const char* function, unsigned int line)
{
	char s[SEATEST_PRINT_BUFFER_SIZE];
	sprintf(s, "Expected %s to end with %s", actual, expected);
	seatest_simple_test_result(strcmp(expected, actual+(strlen(actual)-strlen(expected)))==0, s, function, line);	
}
Beispiel #12
0
void seatest_assert_true(int test, const char* function, unsigned int line)
{
	seatest_simple_test_result(test, "Should have been true", function, line);

}