Home | History | Annotate | Download | only in xla
      1 /* Copyright 2017 The TensorFlow Authors. All Rights Reserved.
      2 
      3 Licensed under the Apache License, Version 2.0 (the "License");
      4 you may not use this file except in compliance with the License.
      5 You may obtain a copy of the License at
      6 
      7     http://www.apache.org/licenses/LICENSE-2.0
      8 
      9 Unless required by applicable law or agreed to in writing, software
     10 distributed under the License is distributed on an "AS IS" BASIS,
     11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     12 See the License for the specific language governing permissions and
     13 limitations under the License.
     14 ==============================================================================*/
     15 
     16 #ifndef TENSORFLOW_COMPLIER_XLA_TEST_H_
     17 #define TENSORFLOW_COMPLIER_XLA_TEST_H_
     18 
     19 // This header includes gmock.h and enables the use of gmock matchers in tests
     20 // in third_party/tensorflow/compiler/xla.
     21 //
     22 // Test including this header can use the macros EXPECT_THAT(...) and
     23 // ASSERT_THAT(...) in combination with gmock matchers.
     24 // Example:
     25 //  std::vector<int> vec = Foo();
     26 //  EXPECT_THAT(vec, ::testing::ElementsAre(1,2,3));
     27 //
     28 // For more details on gmock matchers see:
     29 // https://github.com/google/googletest/blob/master/googlemock/docs/CheatSheet.md#matchers
     30 //
     31 // The advantages of using gmock matchers instead of self defined matchers are
     32 // better error messages, more maintainable tests and more test coverage.
     33 //
     34 // Note that while the use of gmock matchers is allowed in the xla project, the
     35 // use of mocks is disallowed in the whole tensorflow project!
     36 
     37 #include "tensorflow/core/platform/platform.h"
     38 
     39 #if defined(PLATFORM_GOOGLE) || defined(PLATFORM_GOOGLE_ANDROID)
     40 #include "testing/base/public/gmock.h"
     41 #else
     42 #include <gmock/gmock-generated-matchers.h>
     43 #include <gmock/gmock-matchers.h>
     44 #endif
     45 
     46 #include "tensorflow/core/platform/test.h"
     47 
     48 #endif  // TENSORFLOW_COMPLIER_XLA_TEST_H_
     49