From: Tim Kourt <tim.a.kourt@linux.intel.com>
To: ell@lists.01.org
Subject: [PATCH 2/2] unit: Sanity check for NULL l_uintset
Date: Thu, 28 Feb 2019 16:51:30 -0800 [thread overview]
Message-ID: <20190301005130.29851-2-tim.a.kourt@linux.intel.com> (raw)
In-Reply-To: <20190301005130.29851-1-tim.a.kourt@linux.intel.com>
[-- Attachment #1: Type: text/plain, Size: 1103 bytes --]
---
unit/test-uintset.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/unit/test-uintset.c b/unit/test-uintset.c
index 35fc935..9f20939 100644
--- a/unit/test-uintset.c
+++ b/unit/test-uintset.c
@@ -120,6 +120,20 @@ static void test_uintset_3(const void *data)
l_uintset_free(set);
}
+static void test_uintset_4(const void *data)
+{
+ struct l_uintset *set;
+
+ set = l_uintset_new(2);
+ assert(set);
+
+ assert(!l_uintset_take(NULL, 1));
+ assert(!l_uintset_put(NULL, 1));
+ assert(!l_uintset_contains(NULL, 1));
+
+ l_uintset_free(set);
+}
+
static void test_uintset_find_unused(const void *data)
{
struct l_uintset *set;
@@ -167,6 +181,7 @@ int main(int argc, char *argv[])
l_test_add("l_uintset sanity check", test_uintset, NULL);
l_test_add("l_uintset sanity check #2", test_uintset_2, NULL);
l_test_add("l_uintset sanity check #3", test_uintset_3, NULL);
+ l_test_add("l_uintset sanity check #4", test_uintset_4, NULL);
l_test_add("l_uintset find unused tests", test_uintset_find_unused,
NULL);
--
2.13.6
prev parent reply other threads:[~2019-03-01 0:51 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-01 0:51 [PATCH 1/2] uintset: NULL-check before use Tim Kourt
2019-03-01 0:51 ` Tim Kourt [this message]
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=20190301005130.29851-2-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.