[waffle] [PATCH 4/4] core: Add unittests for boolean waffle_config attrs

Chad Versace chad.versace at linux.intel.com
Tue Sep 25 16:48:51 PDT 2012


This patch adds two unittests. Both tests pass.
    wcore_config_attrs.sample_buffers_is_bad
    wcore_config_attrs.accum_buffer_is_bad

Of the three boolean waffle_config attributes (WAFFLE_DOUBLE_BUFFERED,
WAFFLE_SAMPLE_BUFFERS, WAFFLE_ACCUM_BUFFER), only for
WAFFLE_DOUBLE_BUFFERED did a unittest exist that checked that an error was
thrown on bad values. This patch adds such a test for the other two.

Signed-off-by: Chad Versace <chad.versace at linux.intel.com>
---
 src/waffle/core/wcore_config_attrs_unittest.c | 30 +++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/src/waffle/core/wcore_config_attrs_unittest.c b/src/waffle/core/wcore_config_attrs_unittest.c
index f9cb866..66ec9cb 100644
--- a/src/waffle/core/wcore_config_attrs_unittest.c
+++ b/src/waffle/core/wcore_config_attrs_unittest.c
@@ -171,6 +171,34 @@ TEST(wcore_config_attrs, double_buffered_is_bad)
     EXPECT_TRUE(strstr(wcore_error_get_info()->message, "0x31415926"));
 }
 
+TEST(wcore_config_attrs, sample_buffers_is_bad)
+{
+    const int32_t attrib_list[] = {
+        WAFFLE_CONTEXT_API,     WAFFLE_CONTEXT_OPENGL,
+        WAFFLE_SAMPLE_BUFFERS,  0x31415926,
+        0,
+    };
+
+    ASSERT_TRUE(!wcore_config_attrs_parse(attrib_list, &actual_attrs));
+    EXPECT_TRUE(wcore_error_get_code() == WAFFLE_ERROR_BAD_ATTRIBUTE);
+    EXPECT_TRUE(strstr(wcore_error_get_info()->message, "WAFFLE_SAMPLE_BUFFERS"));
+    EXPECT_TRUE(strstr(wcore_error_get_info()->message, "0x31415926"));
+}
+
+TEST(wcore_config_attrs, accum_buffer_is_bad)
+{
+    const int32_t attrib_list[] = {
+        WAFFLE_CONTEXT_API,     WAFFLE_CONTEXT_OPENGL,
+        WAFFLE_ACCUM_BUFFER,    0x31415926,
+        0,
+    };
+
+    ASSERT_TRUE(!wcore_config_attrs_parse(attrib_list, &actual_attrs));
+    EXPECT_TRUE(wcore_error_get_code() == WAFFLE_ERROR_BAD_ATTRIBUTE);
+    EXPECT_TRUE(strstr(wcore_error_get_info()->message, "WAFFLE_ACCUM_BUFFER"));
+    EXPECT_TRUE(strstr(wcore_error_get_info()->message, "0x31415926"));
+}
+
 TEST(wcore_config_attrs, core_profile_and_accum_buffer)
 {
     const int32_t attrib_list[] = {
@@ -296,6 +324,8 @@ testsuite_wcore_config_attrs(void)
     TEST_RUN(wcore_config_attrs, double_buffered_is_true);
     TEST_RUN(wcore_config_attrs, double_buffered_is_false);
     TEST_RUN(wcore_config_attrs, double_buffered_is_bad);
+    TEST_RUN(wcore_config_attrs, sample_buffers_is_bad);
+    TEST_RUN(wcore_config_attrs, accum_buffer_is_bad);
     TEST_RUN(wcore_config_attrs, core_profile_and_accum_buffer);
     TEST_RUN(wcore_config_attrs, negative_red);
     TEST_RUN(wcore_config_attrs, negative_green);
-- 
1.7.12.1



More information about the waffle mailing list