Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/tests/lib/libprop Ensure copy_data_create_copy() is tolerant...
details: https://anonhg.NetBSD.org/src/rev/6b2d9b00d4cc
branches: trunk
changeset: 1010834:6b2d9b00d4cc
user: thorpej <thorpej%NetBSD.org@localhost>
date: Mon Jun 08 21:31:17 2020 +0000
description:
Ensure copy_data_create_copy() is tolerant of creating empty data objects.
diffstat:
tests/lib/libprop/t_proplib.c | 24 ++++++++++++++++++++++--
1 files changed, 22 insertions(+), 2 deletions(-)
diffs (45 lines):
diff -r 6b9332a727ac -r 6b2d9b00d4cc tests/lib/libprop/t_proplib.c
--- a/tests/lib/libprop/t_proplib.c Mon Jun 08 20:19:50 2020 +0000
+++ b/tests/lib/libprop/t_proplib.c Mon Jun 08 21:31:17 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: t_proplib.c,v 1.2 2020/06/06 21:45:07 thorpej Exp $ */
+/* $NetBSD: t_proplib.c,v 1.3 2020/06/08 21:31:17 thorpej Exp $ */
/*
* Copyright (c) 2008, 2020 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
#include <sys/cdefs.h>
__COPYRIGHT("@(#) Copyright (c) 2008, 2020\
The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_proplib.c,v 1.2 2020/06/06 21:45:07 thorpej Exp $");
+__RCSID("$NetBSD: t_proplib.c,v 1.3 2020/06/08 21:31:17 thorpej Exp $");
#include <limits.h>
#include <stdlib.h>
@@ -224,6 +224,26 @@
* API contract.
*/
+ d1 = prop_data_create_copy(const_data1, 0);
+ ATF_REQUIRE(d1 != NULL);
+ ATF_REQUIRE(prop_data_value(d1) == NULL);
+ prop_object_release(d1);
+
+ d1 = prop_data_create_copy(NULL, sizeof(const_data1));
+ ATF_REQUIRE(d1 != NULL);
+ ATF_REQUIRE(prop_data_value(d1) == NULL);
+ prop_object_release(d1);
+
+ d1 = prop_data_create_nocopy(const_data1, 0);
+ ATF_REQUIRE(d1 != NULL);
+ ATF_REQUIRE(prop_data_value(d1) == NULL);
+ prop_object_release(d1);
+
+ d1 = prop_data_create_nocopy(NULL, sizeof(const_data1));
+ ATF_REQUIRE(d1 != NULL);
+ ATF_REQUIRE(prop_data_value(d1) == NULL);
+ prop_object_release(d1);
+
d1 = prop_data_create_nocopy(const_data1, sizeof(const_data1));
ATF_REQUIRE(d1 != NULL);
ATF_REQUIRE(prop_data_value(d1) == const_data1);
Home |
Main Index |
Thread Index |
Old Index