public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 01/10] android/tester-ng: Use loop for adding cases to the queue
@ 2014-07-15  8:24 Jakub Tyszkowski
  2014-07-15  8:24 ` [PATCH 02/10] android/tester-ng: Fix for not checking callback count in step Jakub Tyszkowski
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: Jakub Tyszkowski @ 2014-07-15  8:24 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Jakub Tyszkowski

It will be simplier to add new cases.
---
 android/tester-bluetooth.c | 35 +++++++++++++++--------------------
 android/tester-gatt.c      | 11 +++++++++--
 android/tester-hidhost.c   | 11 +++++++++--
 android/tester-socket.c    | 11 +++++++++--
 4 files changed, 42 insertions(+), 26 deletions(-)

diff --git a/android/tester-bluetooth.c b/android/tester-bluetooth.c
index 56518ea..202d085 100644
--- a/android/tester-bluetooth.c
+++ b/android/tester-bluetooth.c
@@ -235,30 +235,25 @@ static struct test_case bluetooth_setprop_disctimeout_success_tc = {
 				bluetooth_setprop_disctimeout_success_steps),
 };
 
+static struct test_case *test_cases[] = {
+	&bluetooth_init,
+	&bluetooth_enable_success_tc,
+	&bluetooth_enable_success2_tc,
+	&bluetooth_disable_success_tc,
+	&bluetooth_setprop_bdname_success_tc,
+	&bluetooth_setprop_scanmode_success_tc,
+	&bluetooth_setprop_disctimeout_success_tc,
+};
+
 struct queue *get_bluetooth_tests(void)
 {
-	list = queue_new();
-
-	if (!queue_push_tail(list, &bluetooth_init))
-		return NULL;
-
-	if (!queue_push_tail(list, &bluetooth_enable_success_tc))
-		return NULL;
+	uint16_t i = 0;
 
-	if (!queue_push_tail(list, &bluetooth_enable_success2_tc))
-		return NULL;
-
-	if (!queue_push_tail(list, &bluetooth_disable_success_tc))
-		return NULL;
-
-	if (!queue_push_tail(list, &bluetooth_setprop_bdname_success_tc))
-		return NULL;
-
-	if (!queue_push_tail(list, &bluetooth_setprop_scanmode_success_tc))
-		return NULL;
+	list = queue_new();
 
-	if (!queue_push_tail(list, &bluetooth_setprop_disctimeout_success_tc))
-		return NULL;
+	for (; i < sizeof(test_cases) / sizeof(test_cases[0]); ++i)
+		if (!queue_push_tail(list, test_cases[i]))
+			return NULL;
 
 	return list;
 }
diff --git a/android/tester-gatt.c b/android/tester-gatt.c
index b58886f..4a7c9b1 100644
--- a/android/tester-gatt.c
+++ b/android/tester-gatt.c
@@ -30,12 +30,19 @@ static struct test_case gatt_init = {
 	.step_num = get_test_case_step_num(dummy_steps),
 };
 
+static struct test_case *test_cases[] = {
+	&gatt_init,
+};
+
 struct queue *get_gatt_tests(void)
 {
+	uint16_t i = 0;
+
 	list = queue_new();
 
-	if (!queue_push_tail(list, &gatt_init))
-		return NULL;
+	for (; i < sizeof(test_cases) / sizeof(test_cases[0]); ++i)
+		if (!queue_push_tail(list, test_cases[i]))
+			return NULL;
 
 	return list;
 }
diff --git a/android/tester-hidhost.c b/android/tester-hidhost.c
index 87c9452..413c6b8 100644
--- a/android/tester-hidhost.c
+++ b/android/tester-hidhost.c
@@ -30,12 +30,19 @@ static struct test_case hidhost_init = {
 	.step_num = get_test_case_step_num(dummy_steps),
 };
 
+static struct test_case *test_cases[] = {
+	&hidhost_init,
+};
+
 struct queue *get_hidhost_tests(void)
 {
+	uint16_t i = 0;
+
 	list = queue_new();
 
-	if (!queue_push_tail(list, &hidhost_init))
-		return NULL;
+	for (; i < sizeof(test_cases) / sizeof(test_cases[0]); ++i)
+		if (!queue_push_tail(list, test_cases[i]))
+			return NULL;
 
 	return list;
 }
diff --git a/android/tester-socket.c b/android/tester-socket.c
index 8e8b6d2..a57b324 100644
--- a/android/tester-socket.c
+++ b/android/tester-socket.c
@@ -30,12 +30,19 @@ static struct test_case socket_init = {
 	.step_num = get_test_case_step_num(dummy_steps),
 };
 
+static struct test_case *test_cases[] = {
+	&socket_init,
+};
+
 struct queue *get_socket_tests(void)
 {
+	uint16_t i = 0;
+
 	list = queue_new();
 
-	if (!queue_push_tail(list, &socket_init))
-		return NULL;
+	for (; i < sizeof(test_cases) / sizeof(test_cases[0]); ++i)
+		if (!queue_push_tail(list, test_cases[i]))
+			return NULL;
 
 	return list;
 }
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2014-07-16 15:31 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-15  8:24 [PATCH 01/10] android/tester-ng: Use loop for adding cases to the queue Jakub Tyszkowski
2014-07-15  8:24 ` [PATCH 02/10] android/tester-ng: Fix for not checking callback count in step Jakub Tyszkowski
2014-07-15  8:24 ` [PATCH 03/10] android/tester-ng: Set proper callback count Jakub Tyszkowski
2014-07-15  8:24 ` [PATCH 04/10] android/tester-ng: Verify action results also for success case Jakub Tyszkowski
2014-07-15  8:24 ` [PATCH 05/10] android/tester-bluetooth: Add get bdaddr and bdname success cases Jakub Tyszkowski
2014-07-15  8:24 ` [PATCH 06/10] android/tester-bluetooth: Add various property set fail cases Jakub Tyszkowski
2014-07-15  8:24 ` [PATCH 07/10] android/tester-bluetooth: Add set scan mode success case Jakub Tyszkowski
2014-07-15  8:24 ` [PATCH 08/10] android/tester-bluetooth: Add get properties success cases Jakub Tyszkowski
2014-07-15  8:24 ` [PATCH 09/10] android/tester-bluetooth: Add set scan mode none succes case Jakub Tyszkowski
2014-07-15  8:24 ` [PATCH 10/10] android/tester: Remove old cases Jakub Tyszkowski
2014-07-16 15:31 ` [PATCH 01/10] android/tester-ng: Use loop for adding cases to the queue Szymon Janc

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox