aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChad Versace <chad.versace@linux.intel.com>2013-05-09 22:24:25 -0700
committerChad Versace <chad.versace@linux.intel.com>2013-05-09 22:26:18 -0700
commitce982b5978771a7341ac61e687bc7b2c712047c3 (patch)
tree75dc927dba5978c118286b2885cd87d73d083506
parent61f68b29eba91b6312b588fbe94d9e7b933fc2aa (diff)
core: Update unittests for wcore_attrib_list
Update waffle_attrib_list unittests to become wcore_attrib_list unittests. If possible, we should avoid unittesting public API. Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
-rw-r--r--src/waffle/core/wcore_attrib_list_unittest.c (renamed from src/waffle/api/waffle_attrib_list_unittest.c)129
-rw-r--r--tests/unittests/CMakeLists.txt2
-rw-r--r--tests/unittests/waffle-unittest.c4
3 files changed, 68 insertions, 67 deletions
diff --git a/src/waffle/api/waffle_attrib_list_unittest.c b/src/waffle/core/wcore_attrib_list_unittest.c
index 8d0ff05..520fc4a 100644
--- a/src/waffle/api/waffle_attrib_list_unittest.c
+++ b/src/waffle/core/wcore_attrib_list_unittest.c
@@ -1,4 +1,4 @@
-// Copyright 2012 Intel Corporation
+// Copyright 2013 Intel Corporation
//
// All rights reserved.
//
@@ -25,31 +25,32 @@
#include <string.h>
-#include "waffle.h"
-
#include "waffle_test/waffle_test.h"
-TESTGROUP_SIMPLE(waffle_attrib_list_get)
+#include "waffle.h"
+#include "wcore_attrib_list.h"
+
+TESTGROUP_SIMPLE(wcore_attrib_list_get)
-TEST(waffle_attrib_list_get, null)
+TEST(wcore_attrib_list_get, null)
{
int32_t *attrib_list = NULL;
int32_t key = 0;
int32_t value;
- EXPECT_TRUE(!waffle_attrib_list_get(attrib_list, key, &value));
+ EXPECT_TRUE(!wcore_attrib_list_get(attrib_list, key, &value));
}
-TEST(waffle_attrib_list_get, empty)
+TEST(wcore_attrib_list_get, empty)
{
int32_t attrib_list[] = { 0 };
int32_t key = 0;
int32_t value;
- EXPECT_TRUE(!waffle_attrib_list_get(attrib_list, key, &value));
+ EXPECT_TRUE(!wcore_attrib_list_get(attrib_list, key, &value));
}
-TEST(waffle_attrib_list_get, missing_value)
+TEST(wcore_attrib_list_get, missing_value)
{
int32_t attrib_list[] = {
1, 11,
@@ -58,10 +59,10 @@ TEST(waffle_attrib_list_get, missing_value)
int32_t key = 2;
int32_t value;
- ASSERT_TRUE(!waffle_attrib_list_get(attrib_list, key, &value));
+ ASSERT_TRUE(!wcore_attrib_list_get(attrib_list, key, &value));
}
-TEST(waffle_attrib_list_get, trailing_items)
+TEST(wcore_attrib_list_get, trailing_items)
{
int32_t attrib_list[] = {
1, 11,
@@ -71,10 +72,10 @@ TEST(waffle_attrib_list_get, trailing_items)
int32_t key = 2;
int32_t value;
- ASSERT_TRUE(!waffle_attrib_list_get(attrib_list, key, &value));
+ ASSERT_TRUE(!wcore_attrib_list_get(attrib_list, key, &value));
}
-TEST(waffle_attrib_list_get, value_not_modified_if_not_found)
+TEST(wcore_attrib_list_get, value_not_modified_if_not_found)
{
int32_t attrib_list[] = {
1, 11,
@@ -82,11 +83,11 @@ TEST(waffle_attrib_list_get, value_not_modified_if_not_found)
};
int32_t value = 17;
- ASSERT_TRUE(!waffle_attrib_list_get(attrib_list, 2, &value));
+ ASSERT_TRUE(!wcore_attrib_list_get(attrib_list, 2, &value));
ASSERT_TRUE(value == 17);
}
-TEST(waffle_attrib_list_get, key_is_first)
+TEST(wcore_attrib_list_get, key_is_first)
{
int32_t attrib_list[] = {
1, 11,
@@ -97,11 +98,11 @@ TEST(waffle_attrib_list_get, key_is_first)
int32_t key = 1;
int32_t value;
- ASSERT_TRUE(waffle_attrib_list_get(attrib_list, key, &value));
+ ASSERT_TRUE(wcore_attrib_list_get(attrib_list, key, &value));
ASSERT_TRUE(value == 11);
}
-TEST(waffle_attrib_list_get, key_is_last)
+TEST(wcore_attrib_list_get, key_is_last)
{
int32_t attrib_list[] = {
1, 11,
@@ -112,53 +113,53 @@ TEST(waffle_attrib_list_get, key_is_last)
int32_t key = 3;
int32_t value;
- ASSERT_TRUE(waffle_attrib_list_get(attrib_list, key, &value));
+ ASSERT_TRUE(wcore_attrib_list_get(attrib_list, key, &value));
ASSERT_TRUE(value == 33);
}
-TESTGROUP_SIMPLE(waffle_attrib_list_length)
+TESTGROUP_SIMPLE(wcore_attrib_list_length)
-TEST(waffle_attrib_list_length, null)
+TEST(wcore_attrib_list_length, null)
{
int32_t *attrib_list = NULL;
- ASSERT_TRUE(waffle_attrib_list_length(attrib_list) == 0);
+ ASSERT_TRUE(wcore_attrib_list_length(attrib_list) == 0);
}
-TEST(waffle_attrib_list_length, is_0)
+TEST(wcore_attrib_list_length, is_0)
{
int32_t attrib_list[] = {0};
- ASSERT_TRUE(waffle_attrib_list_length(attrib_list) == 0);
+ ASSERT_TRUE(wcore_attrib_list_length(attrib_list) == 0);
}
-TEST(waffle_attrib_list_length, is_1)
+TEST(wcore_attrib_list_length, is_1)
{
int32_t attrib_list[] = {
1, 1,
0,
};
- ASSERT_TRUE(waffle_attrib_list_length(attrib_list) == 1);
+ ASSERT_TRUE(wcore_attrib_list_length(attrib_list) == 1);
}
-TEST(waffle_attrib_list_length, is_2)
+TEST(wcore_attrib_list_length, is_2)
{
int32_t attrib_list[] = {
1, 1,
2, 2,
0,
};
- ASSERT_TRUE(waffle_attrib_list_length(attrib_list) == 2);
+ ASSERT_TRUE(wcore_attrib_list_length(attrib_list) == 2);
}
-TEST(waffle_attrib_list_length, is_37)
+TEST(wcore_attrib_list_length, is_37)
{
int32_t attrib_list[75];
memset(attrib_list, 0xff, 74 * sizeof(int32_t));
attrib_list[74] = 0;
- ASSERT_TRUE(waffle_attrib_list_length(attrib_list) == 37);
+ ASSERT_TRUE(wcore_attrib_list_length(attrib_list) == 37);
}
-TEST(waffle_attrib_list_length, trailing_items)
+TEST(wcore_attrib_list_length, trailing_items)
{
int32_t attrib_list[] = {
1, 1,
@@ -170,24 +171,24 @@ TEST(waffle_attrib_list_length, trailing_items)
0,
};
- ASSERT_TRUE(waffle_attrib_list_length(attrib_list) == 3);
+ ASSERT_TRUE(wcore_attrib_list_length(attrib_list) == 3);
}
-TESTGROUP_SIMPLE(waffle_attrib_list_update)
+TESTGROUP_SIMPLE(wcore_attrib_list_update)
-TEST(waffle_attrib_list_update, null)
+TEST(wcore_attrib_list_update, null)
{
int32_t *attrib_list = NULL;
- ASSERT_TRUE(!waffle_attrib_list_update(attrib_list, 7, 7));
+ ASSERT_TRUE(!wcore_attrib_list_update(attrib_list, 7, 7));
}
-TEST(waffle_attrib_list_update, empty_list)
+TEST(wcore_attrib_list_update, empty_list)
{
int32_t attrib_list[] = {0};
- ASSERT_TRUE(!waffle_attrib_list_update(attrib_list, 7, 7));
+ ASSERT_TRUE(!wcore_attrib_list_update(attrib_list, 7, 7));
}
-TEST(waffle_attrib_list_update, at_0)
+TEST(wcore_attrib_list_update, at_0)
{
int32_t v;
int32_t attrib_list[] = {
@@ -197,12 +198,12 @@ TEST(waffle_attrib_list_update, at_0)
0,
};
- ASSERT_TRUE(waffle_attrib_list_update(attrib_list, 10, 99));
- ASSERT_TRUE(waffle_attrib_list_get(attrib_list, 10, &v));
+ ASSERT_TRUE(wcore_attrib_list_update(attrib_list, 10, 99));
+ ASSERT_TRUE(wcore_attrib_list_get(attrib_list, 10, &v));
ASSERT_TRUE(v == 99);
}
-TEST(waffle_attrib_list_update, at_1)
+TEST(wcore_attrib_list_update, at_1)
{
int32_t v;
int32_t attrib_list[] = {
@@ -212,12 +213,12 @@ TEST(waffle_attrib_list_update, at_1)
0,
};
- ASSERT_TRUE(waffle_attrib_list_update(attrib_list, 20, 99));
- ASSERT_TRUE(waffle_attrib_list_get(attrib_list, 20, &v));
+ ASSERT_TRUE(wcore_attrib_list_update(attrib_list, 20, 99));
+ ASSERT_TRUE(wcore_attrib_list_get(attrib_list, 20, &v));
ASSERT_TRUE(v == 99);
}
-TEST(waffle_attrib_list_update, missing_key)
+TEST(wcore_attrib_list_update, missing_key)
{
int32_t attrib_list[] = {
10, 10,
@@ -226,31 +227,31 @@ TEST(waffle_attrib_list_update, missing_key)
0,
};
- ASSERT_TRUE(!waffle_attrib_list_update(attrib_list, 50, 99));
+ ASSERT_TRUE(!wcore_attrib_list_update(attrib_list, 50, 99));
}
void
-testsuite_waffle_attrib_list(void);
+testsuite_wcore_attrib_list(void);
void
-testsuite_waffle_attrib_list(void)
+testsuite_wcore_attrib_list(void)
{
- TEST_RUN(waffle_attrib_list_get, null);
- TEST_RUN(waffle_attrib_list_get, empty);
- TEST_RUN(waffle_attrib_list_get, missing_value);
- TEST_RUN(waffle_attrib_list_get, trailing_items);
- TEST_RUN(waffle_attrib_list_get, value_not_modified_if_not_found);
- TEST_RUN(waffle_attrib_list_get, key_is_first);
- TEST_RUN(waffle_attrib_list_get, key_is_last);
- TEST_RUN(waffle_attrib_list_length, null);
- TEST_RUN(waffle_attrib_list_length, is_0);
- TEST_RUN(waffle_attrib_list_length, is_1);
- TEST_RUN(waffle_attrib_list_length, is_2);
- TEST_RUN(waffle_attrib_list_length, is_37);
- TEST_RUN(waffle_attrib_list_length, trailing_items);
- TEST_RUN(waffle_attrib_list_update, null);
- TEST_RUN(waffle_attrib_list_update, empty_list);
- TEST_RUN(waffle_attrib_list_update, at_0);
- TEST_RUN(waffle_attrib_list_update, at_1);
- TEST_RUN(waffle_attrib_list_update, missing_key);
+ TEST_RUN(wcore_attrib_list_get, null);
+ TEST_RUN(wcore_attrib_list_get, empty);
+ TEST_RUN(wcore_attrib_list_get, missing_value);
+ TEST_RUN(wcore_attrib_list_get, trailing_items);
+ TEST_RUN(wcore_attrib_list_get, value_not_modified_if_not_found);
+ TEST_RUN(wcore_attrib_list_get, key_is_first);
+ TEST_RUN(wcore_attrib_list_get, key_is_last);
+ TEST_RUN(wcore_attrib_list_length, null);
+ TEST_RUN(wcore_attrib_list_length, is_0);
+ TEST_RUN(wcore_attrib_list_length, is_1);
+ TEST_RUN(wcore_attrib_list_length, is_2);
+ TEST_RUN(wcore_attrib_list_length, is_37);
+ TEST_RUN(wcore_attrib_list_length, trailing_items);
+ TEST_RUN(wcore_attrib_list_update, null);
+ TEST_RUN(wcore_attrib_list_update, empty_list);
+ TEST_RUN(wcore_attrib_list_update, at_0);
+ TEST_RUN(wcore_attrib_list_update, at_1);
+ TEST_RUN(wcore_attrib_list_update, missing_key);
}
diff --git a/tests/unittests/CMakeLists.txt b/tests/unittests/CMakeLists.txt
index 7eade43..cb4d6ba 100644
--- a/tests/unittests/CMakeLists.txt
+++ b/tests/unittests/CMakeLists.txt
@@ -5,7 +5,7 @@
add_executable(waffle-unittest
waffle-unittest.c
- ${CMAKE_SOURCE_DIR}/src/waffle/api/waffle_attrib_list_unittest.c
+ ${CMAKE_SOURCE_DIR}/src/waffle/core/wcore_attrib_list_unittest.c
${CMAKE_SOURCE_DIR}/src/waffle/core/wcore_error_unittest.c
${CMAKE_SOURCE_DIR}/src/waffle/core/wcore_config_attrs_unittest.c
)
diff --git a/tests/unittests/waffle-unittest.c b/tests/unittests/waffle-unittest.c
index 041967a..f2f9d15 100644
--- a/tests/unittests/waffle-unittest.c
+++ b/tests/unittests/waffle-unittest.c
@@ -25,12 +25,12 @@
#include "waffle_test/waffle_test.h"
-void testsuite_waffle_attrib_list(void);
+void testsuite_wcore_attrib_list(void);
void testsuite_wcore_config_attrs(void);
void testsuite_wcore_error(void);
static void (*test_suites[])(void) = {
- testsuite_waffle_attrib_list,
+ testsuite_wcore_attrib_list,
testsuite_wcore_config_attrs,
testsuite_wcore_error,
0,