Flutter Engine
 
Loading...
Searching...
No Matches
dl_test_equality.h
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef FLUTTER_DISPLAY_LIST_TESTING_DL_TEST_EQUALITY_H_
6#define FLUTTER_DISPLAY_LIST_TESTING_DL_TEST_EQUALITY_H_
7
10#include "gtest/gtest.h"
11
12namespace flutter {
13namespace testing {
14
15template <class T, class U>
16static void TestEquals(const T& source1, const U& source2) {
17 ASSERT_TRUE(source1 == source2);
18 ASSERT_TRUE(source2 == source1);
19 ASSERT_FALSE(source1 != source2);
20 ASSERT_FALSE(source2 != source1);
21 ASSERT_EQ(source1, source2);
22 ASSERT_EQ(source2, source1);
23 ASSERT_TRUE(Equals(&source1, &source2));
24 ASSERT_TRUE(Equals(&source2, &source1));
25}
26
27template <class T, class U>
28static void TestNotEquals(T& source1, U& source2, const std::string& label) {
29 ASSERT_FALSE(source1 == source2) << label;
30 ASSERT_FALSE(source2 == source1) << label;
31 ASSERT_TRUE(source1 != source2) << label;
32 ASSERT_TRUE(source2 != source1) << label;
33 ASSERT_NE(source1, source2) << label;
34 ASSERT_NE(source2, source1) << label;
35 ASSERT_TRUE(NotEquals(&source1, &source2));
36 ASSERT_TRUE(NotEquals(&source2, &source1));
37}
38
39} // namespace testing
40} // namespace flutter
41
42#endif // FLUTTER_DISPLAY_LIST_TESTING_DL_TEST_EQUALITY_H_
static void TestEquals(const T &source1, const U &source2)
static void TestNotEquals(T &source1, U &source2, const std::string &label)
bool Equals(const T *a, const U *b)
bool NotEquals(const T *a, const U *b)