Caffe2 - C++ API
A deep learning, cross platform ML framework
flags_test.cpp
1 #include <gtest/gtest.h>
2 
3 #include <iostream>
4 
5 #include <c10/util/Flags.h>
6 
7 C10_DEFINE_bool(c10_flags_test_only_flag, true, "Only used in test.");
8 
9 namespace c10_test {
10 
11 TEST(FlagsTest, TestGflagsCorrectness) {
12 #ifdef C10_USE_GFLAGS
13  EXPECT_EQ(FLAGS_c10_flags_test_only_flag, true);
14  FLAGS_c10_flags_test_only_flag = false;
15  FLAGS_c10_flags_test_only_flag = true;
16  EXPECT_EQ(FLAGS_c10_flags_test_only_flag, true);
17 #else // C10_USE_GFLAGS
18  std::cout << "Caffe2 is not built with gflags. Nothing to test here."
19  << std::endl;
20 #endif
21 }
22 
23 } // namespace c10_test