summaryrefslogtreecommitdiff
path: root/tests/get_domainpart.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/get_domainpart.c')
-rw-r--r--tests/get_domainpart.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/get_domainpart.c b/tests/get_domainpart.c
new file mode 100644
index 0000000..e05aee1
--- /dev/null
+++ b/tests/get_domainpart.c
@@ -0,0 +1,23 @@
+
+
+#include <string.h>
+#include <stdio.h>
+
+#include "xmpp.h"
+
+
+int main(void)
+{
+ char *input = "test@example.org/3f";
+ const char *expected = "example.org";
+
+ char *result = get_domainpart(input);
+
+ if (strcmp(result, expected) == 0) {
+ printf("Unit test passed - ok\n");
+ return 0;
+ } else {
+ printf("'%s' != '%s'!\n", result, expected);
+ return 1;
+ }
+}