Added a character string compare function to be able to unit test.

This commit is contained in:
skarg
2006-02-03 15:39:46 +00:00
parent adb2ef1b5a
commit 463fee881e
2 changed files with 39 additions and 8 deletions
+27
View File
@@ -235,6 +235,33 @@ bool characterstring_copy(
characterstring_length(src)); characterstring_length(src));
} }
bool characterstring_same(
BACNET_CHARACTER_STRING *dest,
BACNET_CHARACTER_STRING *src)
{
size_t i; /* counter */
bool same_status = false;
if (src && dest)
{
if ((src->length == dest->length) &&
(src->encoding == dest->encoding))
{
same_status = true;
for (i = 0; i < src->length; i++)
{
if (src->value[i] != dest->value[i])
{
same_status = false;
break;
}
}
}
}
return same_status;
}
/* returns false if the string exceeds capacity */ /* returns false if the string exceeds capacity */
bool characterstring_append( bool characterstring_append(
BACNET_CHARACTER_STRING *char_string, BACNET_CHARACTER_STRING *char_string,
+4
View File
@@ -102,6 +102,10 @@ bool characterstring_init_ansi(
bool characterstring_copy( bool characterstring_copy(
BACNET_CHARACTER_STRING *dest, BACNET_CHARACTER_STRING *dest,
BACNET_CHARACTER_STRING *src); BACNET_CHARACTER_STRING *src);
/* returns true if the strings are the same length, encoding, value */
bool characterstring_same(
BACNET_CHARACTER_STRING *dest,
BACNET_CHARACTER_STRING *src);
/* returns false if the string exceeds capacity */ /* returns false if the string exceeds capacity */
bool characterstring_append( bool characterstring_append(
BACNET_CHARACTER_STRING *char_string, BACNET_CHARACTER_STRING *char_string,