Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8959d2a7 authored by Kokoa Matsuda's avatar Kokoa Matsuda Committed by Gerrit Code Review
Browse files

Merge "Replace libchrome StringPrintf in system/bta/test/ files" into main

parents 353ccd4c 8f53a23f
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -18,6 +18,7 @@


#include <base/functional/bind.h>
#include <base/functional/bind.h>
#include <base/location.h>
#include <base/location.h>
#include <fmt/format.h>
#include <gtest/gtest.h>
#include <gtest/gtest.h>


#include <cstdint>
#include <cstdint>
@@ -46,7 +47,7 @@ TEST_F(BtaApiTest, bta_status_text) {
  for (const auto& status : statuses) {
  for (const auto& status : statuses) {
    ASSERT_STREQ(status.second.c_str(), bta_status_text(status.first).c_str());
    ASSERT_STREQ(status.second.c_str(), bta_status_text(status.first).c_str());
  }
  }
  auto unknown = base::StringPrintf("UNKNOWN[%d]", std::numeric_limits<uint8_t>::max());
  auto unknown = fmt::format("UNKNOWN[{}]", std::numeric_limits<uint8_t>::max());
  ASSERT_STREQ(
  ASSERT_STREQ(
          unknown.c_str(),
          unknown.c_str(),
          bta_status_text(static_cast<tBTA_STATUS>(std::numeric_limits<uint8_t>::max())).c_str());
          bta_status_text(static_cast<tBTA_STATUS>(std::numeric_limits<uint8_t>::max())).c_str());
+1 −1
Original line number Original line Diff line number Diff line
@@ -16,11 +16,11 @@


#define LOG_TAG "bt_bta_dm_test"
#define LOG_TAG "bt_bta_dm_test"


#include <base/strings/stringprintf.h>
#include <base/test/bind_test_util.h>
#include <base/test/bind_test_util.h>
#include <bluetooth/log.h>
#include <bluetooth/log.h>
#include <com_android_bluetooth_flags.h>
#include <com_android_bluetooth_flags.h>
#include <flag_macros.h>
#include <flag_macros.h>
#include <fmt/format.h>
#include <gmock/gmock.h>
#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include <gtest/gtest.h>
#include <sys/socket.h>
#include <sys/socket.h>
+6 −4
Original line number Original line Diff line number Diff line
@@ -19,6 +19,7 @@
#include <bluetooth/log.h>
#include <bluetooth/log.h>
#include <com_android_bluetooth_flags.h>
#include <com_android_bluetooth_flags.h>
#include <flag_macros.h>
#include <flag_macros.h>
#include <fmt/format.h>
#include <gmock/gmock.h>
#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include <gtest/gtest.h>


@@ -426,7 +427,8 @@ TEST_F(BtaDmTest, bta_dm_search_evt_text) {
  for (const auto& event : events) {
  for (const auto& event : events) {
    ASSERT_STREQ(event.second.c_str(), bta_dm_search_evt_text(event.first).c_str());
    ASSERT_STREQ(event.second.c_str(), bta_dm_search_evt_text(event.first).c_str());
  }
  }
  ASSERT_STREQ(base::StringPrintf("UNKNOWN[%hhu]", std::numeric_limits<uint8_t>::max()).c_str(),
  ASSERT_STREQ(
          fmt::format("UNKNOWN[{}]", std::numeric_limits<uint8_t>::max()).c_str(),
          bta_dm_search_evt_text(
          bta_dm_search_evt_text(
                  static_cast<tBTA_DM_SEARCH_EVT>(std::numeric_limits<uint8_t>::max()))
                  static_cast<tBTA_DM_SEARCH_EVT>(std::numeric_limits<uint8_t>::max()))
                  .c_str());
                  .c_str());
+3 −3
Original line number Original line Diff line number Diff line
@@ -14,7 +14,7 @@
 * limitations under the License.
 * limitations under the License.
 */
 */


#include <base/strings/stringprintf.h>
#include <fmt/format.h>
#include <gmock/gmock.h>
#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include <gtest/gtest.h>
#include <sys/socket.h>
#include <sys/socket.h>
@@ -54,11 +54,11 @@ TEST_F(BtaDiscTest, gatt_history_callback) {
  };
  };


  // C string
  // C string
  gatt_history_callback(base::StringPrintf("%s", a[0].c_str()));
  gatt_history_callback(fmt::format("{}", a[0].c_str()));
  // Cpp string
  // Cpp string
  gatt_history_callback(a[1]);
  gatt_history_callback(a[1]);
  // Third entry for "fun"
  // Third entry for "fun"
  gatt_history_callback(base::StringPrintf("%s", a[2].c_str()));
  gatt_history_callback(fmt::format("{}", a[2].c_str()));


  std::vector<bluetooth::common::TimestampedEntry<std::string>> history =
  std::vector<bluetooth::common::TimestampedEntry<std::string>> history =
          bluetooth::legacy::testing::PullCopyOfGattHistory();
          bluetooth::legacy::testing::PullCopyOfGattHistory();
+1 −1
Original line number Original line Diff line number Diff line
@@ -14,7 +14,7 @@
 * limitations under the License.
 * limitations under the License.
 */
 */


#include <base/strings/stringprintf.h>
#include <fmt/format.h>
#include <gmock/gmock.h>
#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include <gtest/gtest.h>
#include <sys/socket.h>
#include <sys/socket.h>