skia2/tests/AbseilTest.cpp
John Stiles 816226e822 Add Abseil to third_party.
At present, this is a proof-of-concept which only supports a small
subset of absl modules:
- Base
- Hash
- Numeric
- String

This is only used by one unit test, which builds a string and then
hashes it.

Bug: skia:10165
Bug: b/154848688

Change-Id: I016250bf700b522c7a6bc78cf1844abff2260c35
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/284805
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2020-04-24 19:53:21 +00:00

26 lines
789 B
C++

/*
* Copyright 2020 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "tests/Test.h"
#ifndef SK_BUILD_FOR_ANDROID_FRAMEWORK
#include "absl/hash/hash.h"
#include "absl/strings/substitute.h"
DEF_TEST(AbseilTest, reporter) {
// Tests that Abseil can be compiled, linked and run. Can be removed once Abseil is in use
// elsewhere.
const void* nullVoid = nullptr;
const std::string kStringToHash = absl::Substitute("$0 $1 $2 $3", "absl", 0, false, nullVoid);
REPORTER_ASSERT(reporter, kStringToHash == "absl 0 false NULL");
const size_t hashValue = absl::Hash<std::string>{}(kStringToHash);
REPORTER_ASSERT(reporter, hashValue != 0);
}
#endif // SK_BUILD_FOR_ANDROID_FRAMEWORK