aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libnvxx/const_nv_list.cc2
-rw-r--r--libnvxx/nvxx_base.h2
-rw-r--r--libnvxx/tests/nvxx_basic.cc30
3 files changed, 32 insertions, 2 deletions
diff --git a/libnvxx/const_nv_list.cc b/libnvxx/const_nv_list.cc
index 0098d60..e27554f 100644
--- a/libnvxx/const_nv_list.cc
+++ b/libnvxx/const_nv_list.cc
@@ -94,7 +94,7 @@ __const_nv_list::empty() const noexcept
}
int
-__const_nv_list::flags() const noexcept
+__const_nv_list::flags() const
{
__throw_if_error();
return (::nvlist_flags(__m_nv));
diff --git a/libnvxx/nvxx_base.h b/libnvxx/nvxx_base.h
index 07cd9e7..7c12921 100644
--- a/libnvxx/nvxx_base.h
+++ b/libnvxx/nvxx_base.h
@@ -143,7 +143,7 @@ struct __const_nv_list : virtual __nv_list_base {
/*
* Return the flags used to create this nv_list.
*/
- [[nodiscard]] int flags() const noexcept;
+ [[nodiscard]] int flags() const;
/*
* Returns true if this nv_list is part of an array contained inside
diff --git a/libnvxx/tests/nvxx_basic.cc b/libnvxx/tests/nvxx_basic.cc
index 31d2b11..edd9937 100644
--- a/libnvxx/tests/nvxx_basic.cc
+++ b/libnvxx/tests/nvxx_basic.cc
@@ -319,6 +319,32 @@ TEST_CASE(nvxx_set_error_null)
}
/*
+ * flags
+ */
+
+TEST_CASE(nvxx_flags)
+{
+ auto nvl = bsd::nv_list(NV_FLAG_IGNORE_CASE);
+
+ ATF_REQUIRE_EQ(NV_FLAG_IGNORE_CASE, nvl.flags());
+}
+
+TEST_CASE(nvxx_flags_empty)
+{
+ auto cnv = bsd::const_nv_list();
+
+ ATF_REQUIRE_THROW(std::logic_error, (void)cnv.flags());
+}
+
+TEST_CASE(nvxx_flags_error)
+{
+ auto nvl = bsd::nv_list();
+ nvl.set_error(std::errc::invalid_argument);
+
+ ATF_REQUIRE_THROW(bsd::nv_error_state, (void)nvl.flags());
+}
+
+/*
* pack/unpack
*/
@@ -2007,6 +2033,10 @@ ATF_INIT_TEST_CASES(tcs)
ATF_ADD_TEST_CASE(tcs, nvxx_set_error_null);
ATF_ADD_TEST_CASE(tcs, nvxx_error_null);
+ ATF_ADD_TEST_CASE(tcs, nvxx_flags);
+ ATF_ADD_TEST_CASE(tcs, nvxx_flags_empty);
+ ATF_ADD_TEST_CASE(tcs, nvxx_flags_error);
+
ATF_ADD_TEST_CASE(tcs, nvxx_pack);
ATF_ADD_TEST_CASE(tcs, nvxx_pack_error);
ATF_ADD_TEST_CASE(tcs, nvxx_pack_empty);