| 1 |
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
| 2 |
/* |
| 3 |
* This program is free software; you can redistribute it and/or modify |
| 4 |
* it under the terms of the GNU General Public License as published by |
| 5 |
* the Free Software Foundation; either version 2 of the License, or |
| 6 |
* (at your option) any later version. |
| 7 |
* |
| 8 |
* This program is distributed in the hope that it will be useful, |
| 9 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 |
* GNU General Public License for more details: |
| 12 |
* |
| 13 |
* Copyright (C) 2014 Aleksander Morgado <[email protected]> |
| 14 |
*/ |
| 15 |
|
| 16 |
#ifndef TEST_FIXTURE_H |
| 17 |
#define TEST_FIXTURE_H |
| 18 |
|
| 19 |
#include <gio/gio.h> |
| 20 |
#include <libqmi-glib.h> |
| 21 |
|
| 22 |
#include "test-port-context.h" |
| 23 |
|
| 24 |
/*****************************************************************************/ |
| 25 |
/* Test fixture setup */ |
| 26 |
|
| 27 |
typedef struct { |
| 28 |
QmiClient *client; |
| 29 |
guint16 transaction_id; |
| 30 |
} TestServiceInfo; |
| 31 |
|
| 32 |
typedef struct { |
| 33 |
GMainLoop *loop; |
| 34 |
gchar *path; |
| 35 |
TestPortContext *ctx; |
| 36 |
QmiDevice *device; |
| 37 |
TestServiceInfo service_info[255]; |
| 38 |
} TestFixture; |
| 39 |
|
| 40 |
void test_fixture_setup (TestFixture *fixture); |
| 41 |
void test_fixture_teardown (TestFixture *fixture); |
| 42 |
void test_fixture_loop_run (TestFixture *fixture); |
| 43 |
void test_fixture_loop_stop (TestFixture *fixture); |
| 44 |
|
| 45 |
typedef void (*TCFunc) (TestFixture *, gconstpointer); |
| 46 |
#define TEST_ADD(path,method) \ |
| 47 |
g_test_add (path, \ |
| 48 |
TestFixture, \ |
| 49 |
NULL, \ |
| 50 |
(TCFunc)test_fixture_setup, \ |
| 51 |
(TCFunc)method, \ |
| 52 |
(TCFunc)test_fixture_teardown) |
| 53 |
|
| 54 |
#endif /* TEST_FIXTURE_H */ |