blob: c47a88df4e8dd9f4929ba178757f3ed46bd95ca0 [file] [log] [blame]
// Copyright 2017 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "src/connectivity/bluetooth/core/bt-host/common/manufacturer_names.h"
#include <gtest/gtest.h>
namespace bt {
namespace {
TEST(ManufacturerNamesTest, ExhaustiveLookUp) {
constexpr uint16_t kReservedId = 0x049E;
// Looking up beyond the maximum entry shouldn't crash.
EXPECT_EQ("", GetManufacturerName(kReservedId));
// Do an incremental look up of all entries up to |kReservedId|. The
// code shouldn't crash. We don't make an exact comparison of all entries
// since this is a resiliency test.
for (uint16_t i = 0; i < kReservedId; ++i) {
std::string result = GetManufacturerName(i);
EXPECT_FALSE(result.empty()) << "Failed for id: " << i;
}
}
} // namespace
} // namespace bt