From: Tim Kourt <tim.a.kourt@linux.intel.com>
To: ell@lists.01.org
Subject: [PATCH 2/2] unit: Add tests for the suffix check for a string
Date: Fri, 22 Apr 2016 15:06:55 -0700 [thread overview]
Message-ID: <1461362815-57501-2-git-send-email-tim.a.kourt@linux.intel.com> (raw)
In-Reply-To: <1461362815-57501-1-git-send-email-tim.a.kourt@linux.intel.com>
[-- Attachment #1: Type: text/plain, Size: 1001 bytes --]
---
unit/test-util.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/unit/test-util.c b/unit/test-util.c
index d72646f..427c74a 100644
--- a/unit/test-util.c
+++ b/unit/test-util.c
@@ -62,6 +62,18 @@ static void test_from_hexstring(const void *test_data)
assert(!bytes);
}
+static void test_has_suffix(const void *test_data)
+{
+ const char *str = "string";
+ const char *suffix = "ing";
+
+ assert(l_str_has_suffix(str, suffix));
+ assert(l_str_has_suffix(str, str));
+ assert(!l_str_has_suffix(NULL, suffix));
+ assert(!l_str_has_suffix(str, NULL));
+ assert(!l_str_has_suffix(suffix, str));
+}
+
int main(int argc, char *argv[])
{
l_test_init(&argc, &argv);
@@ -69,5 +81,7 @@ int main(int argc, char *argv[])
l_test_add("l_util_hexstring", test_hexstring, NULL);
l_test_add("l_util_from_hexstring", test_from_hexstring, NULL);
+ l_test_add("l_util_has_suffix", test_has_suffix, NULL);
+
return l_test_run();
}
--
2.5.0
next prev parent reply other threads:[~2016-04-22 22:06 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-22 22:06 [PATCH 1/2] util: Add suffix check for a string Tim Kourt
2016-04-22 22:06 ` Tim Kourt [this message]
2016-04-25 16:16 ` Mat Martineau
2016-04-25 17:36 ` Denis Kenzior
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1461362815-57501-2-git-send-email-tim.a.kourt@linux.intel.com \
--to=tim.a.kourt@linux.intel.com \
--cc=ell@lists.01.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.