diff --git a/unit/test-eir.c b/unit/test-eir.c
index e05a37d..49ce65f 100644
--- a/unit/test-eir.c
+++ b/unit/test-eir.c
#include "lib/sdp.h"
#include "src/shared/tester.h"
#include "src/shared/util.h"
+#include "src/shared/ad.h"
#include "src/eir.h"
struct test_data {
tester_debug("%s%s", prefix, str);
}
+static void test_ad(const struct test_data *test, struct eir_data *eir)
+{
+ struct bt_ad *ad;
+ GSList *list;
+
+ ad = bt_ad_new_with_data(test->eir_size, test->eir_data);
+ g_assert(ad);
+
+ g_assert_cmpint(bt_ad_get_flags(ad), ==, test->flags);
+ g_assert_cmpstr(bt_ad_get_name(ad), ==, test->name);
+ g_assert_cmpint(bt_ad_get_tx_power(ad), ==, test->tx_power);
+
+ if (test->uuid) {
+ int i;
+
+ for (i = 0; test->uuid[i]; i++) {
+ bt_uuid_t uuid;
+
+ bt_string_to_uuid(&uuid, test->uuid[i]);
+ g_assert(bt_ad_has_service_uuid(ad, &uuid));
+ }
+ }
+
+ for (list = eir->msd_list; list; list = list->next) {
+ struct eir_msd *msd = list->data;
+ struct bt_ad_manufacturer_data adm;
+
+ adm.manufacturer_id = msd->company;
+ adm.data = msd->data;
+ adm.len = msd->data_len;
+
+ g_assert(bt_ad_has_manufacturer_data(ad, &adm));
+ }
+
+ for (list = eir->sd_list; list; list = list->next) {
+ struct eir_sd *sd = list->data;
+ struct bt_ad_service_data ads;
+
+ bt_string_to_uuid(&ads.uuid, sd->uuid);
+ ads.data = sd->data;
+ ads.len = sd->data_len;
+
+ g_assert(bt_ad_has_service_data(ad, &ads));
+ }
+
+ bt_ad_unref(ad);
+}
+
static void test_parsing(gconstpointer data)
{
const struct test_data *test = data;
"Service Data:");
}
+ test_ad(data, &eir);
+
eir_data_free(&eir);
tester_test_passed();