aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/core/lib/core/status_test_util.h
blob: b3b4db429f1e2c61dd257d9991ef1806fb456532 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#ifndef TENSORFLOW_LIB_CORE_STATUS_TEST_UTIL_H_
#define TENSORFLOW_LIB_CORE_STATUS_TEST_UTIL_H_

#include <gtest/gtest.h>
#include "tensorflow/core/public/status.h"

// Macros for testing the results of functions that return util::Status.

#define EXPECT_OK(statement) EXPECT_EQ(::tensorflow::Status::OK(), (statement))
#define ASSERT_OK(statement) ASSERT_EQ(::tensorflow::Status::OK(), (statement))

// There are no EXPECT_NOT_OK/ASSERT_NOT_OK macros since they would not
// provide much value (when they fail, they would just print the OK status
// which conveys no more information than EXPECT_FALSE(status.ok());
// If you want to check for particular errors, better alternatives are:
// EXPECT_EQ(::util::Status(...expected error...), status.StripMessage());
// EXPECT_THAT(status.ToString(), HasSubstr("expected error"));
// Also, see testing/lib/util/status_util.h.

#endif  // TENSORFLOW_LIB_CORE_STATUS_TEST_UTIL_H_