config_test.cc
Go to the documentation of this file.
00001 //  Copyright 2019 The Abseil Authors.
00002 //
00003 // Licensed under the Apache License, Version 2.0 (the "License");
00004 // you may not use this file except in compliance with the License.
00005 // You may obtain a copy of the License at
00006 //
00007 //      https://www.apache.org/licenses/LICENSE-2.0
00008 //
00009 // Unless required by applicable law or agreed to in writing, software
00010 // distributed under the License is distributed on an "AS IS" BASIS,
00011 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00012 // See the License for the specific language governing permissions and
00013 // limitations under the License.
00014 
00015 #include "absl/flags/config.h"
00016 
00017 #ifdef __APPLE__
00018 #include <TargetConditionals.h>
00019 #endif
00020 
00021 #include "gtest/gtest.h"
00022 
00023 #ifndef ABSL_FLAGS_STRIP_NAMES
00024 #error ABSL_FLAGS_STRIP_NAMES is not defined
00025 #endif
00026 
00027 #ifndef ABSL_FLAGS_STRIP_HELP
00028 #error ABSL_FLAGS_STRIP_HELP is not defined
00029 #endif
00030 
00031 namespace {
00032 
00033 // Test that ABSL_FLAGS_STRIP_NAMES and ABSL_FLAGS_STRIP_HELP are configured how
00034 // we expect them to be configured by default. If you override this
00035 // configuration, this test will fail, but the code should still be safe to use.
00036 TEST(FlagsConfigTest, Test) {
00037 #if defined(__ANDROID__)
00038   EXPECT_EQ(ABSL_FLAGS_STRIP_NAMES, 1);
00039   EXPECT_EQ(ABSL_FLAGS_STRIP_HELP, 1);
00040 #elif defined(__myriad2__)
00041   EXPECT_EQ(ABSL_FLAGS_STRIP_NAMES, 0);
00042   EXPECT_EQ(ABSL_FLAGS_STRIP_HELP, 0);
00043 #elif defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
00044   EXPECT_EQ(ABSL_FLAGS_STRIP_NAMES, 1);
00045   EXPECT_EQ(ABSL_FLAGS_STRIP_HELP, 1);
00046 #elif defined(TARGET_OS_EMBEDDED) && TARGET_OS_EMBEDDED
00047   EXPECT_EQ(ABSL_FLAGS_STRIP_NAMES, 1);
00048   EXPECT_EQ(ABSL_FLAGS_STRIP_HELP, 1);
00049 #elif defined(__APPLE__)
00050   EXPECT_EQ(ABSL_FLAGS_STRIP_NAMES, 0);
00051   EXPECT_EQ(ABSL_FLAGS_STRIP_HELP, 0);
00052 #elif defined(_WIN32)
00053   EXPECT_EQ(ABSL_FLAGS_STRIP_NAMES, 0);
00054   EXPECT_EQ(ABSL_FLAGS_STRIP_HELP, 0);
00055 #elif defined(__linux__)
00056   EXPECT_EQ(ABSL_FLAGS_STRIP_NAMES, 0);
00057   EXPECT_EQ(ABSL_FLAGS_STRIP_HELP, 0);
00058 #endif
00059 }
00060 
00061 }  // namespace


abseil_cpp
Author(s):
autogenerated on Wed Jun 19 2019 19:42:14