aboutsummaryrefslogtreecommitdiff
path: root/mojo/public/cpp/bindings/tests/hash_unittest.cc
blob: 9ce1f5bc7b7e73cd695df2efb6ec729bd9fa9ec3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Copyright 2016 The Chromium 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 "mojo/public/cpp/bindings/lib/hash_util.h"

#include "mojo/public/interfaces/bindings/tests/test_structs.mojom.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace mojo {
namespace test {
namespace {

using HashTest = testing::Test;

TEST_F(HashTest, NestedStruct) {
  // Just check that this template instantiation compiles.
  ASSERT_EQ(
      ::mojo::internal::Hash(::mojo::internal::kHashSeed,
                             SimpleNestedStruct::New(ContainsOther::New(1))),
      ::mojo::internal::Hash(::mojo::internal::kHashSeed,
                             SimpleNestedStruct::New(ContainsOther::New(1))));
}

TEST_F(HashTest, UnmappedNativeStruct) {
  // Just check that this template instantiation compiles.
  ASSERT_EQ(::mojo::internal::Hash(::mojo::internal::kHashSeed,
                                   UnmappedNativeStruct::New()),
            ::mojo::internal::Hash(::mojo::internal::kHashSeed,
                                   UnmappedNativeStruct::New()));
}

}  // namespace
}  // namespace test
}  // namespace mojo