summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorxengineering <me@xengineering.eu>2022-11-29 21:02:16 +0100
committerxengineering <me@xengineering.eu>2022-11-30 21:28:51 +0100
commit533619c27d9cc3919bed540ea7f04bebddc71cbe (patch)
tree96496208d135ceb1c5557565fd2c697de962c5b3 /tests
parentc233d1b454efc50f913dd48fa11d223950f48947 (diff)
downloadlimox-533619c27d9cc3919bed540ea7f04bebddc71cbe.tar
limox-533619c27d9cc3919bed540ea7f04bebddc71cbe.tar.zst
limox-533619c27d9cc3919bed540ea7f04bebddc71cbe.zip
Add first unit test
This should kick off the infrastructure for unit tests. This can still be improved but getting started is important to make it easier to add unit tests and thus improving the quality.
Diffstat (limited to 'tests')
-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;
+ }
+}