parent
84c7862d4b
commit
bffc19813a
@ -1,33 +0,0 @@
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include "gflags/gflags.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
DEFINE_bool(verbose, false, "Display program name before message");
|
||||
DEFINE_string(message, "Hello world!", "Message to print");
|
||||
|
||||
static bool IsNonEmptyMessage(const char *flagname, const std::string &value) {
|
||||
return value[0] != '\0';
|
||||
}
|
||||
DEFINE_validator(message, &IsNonEmptyMessage);
|
||||
|
||||
namespace third_party {
|
||||
namespace gflags_test {
|
||||
|
||||
TEST(GflagsTest, ParseAndPrint) {
|
||||
gflags::SetUsageMessage("some usage message");
|
||||
gflags::SetVersionString("1.0.0");
|
||||
int argc = 1;
|
||||
char program_name[] = "gflags_test";
|
||||
char **argv = new char *[2];
|
||||
argv[0] = program_name;
|
||||
argv[1] = NULL;
|
||||
gflags::ParseCommandLineFlags(&argc, reinterpret_cast<char ***>(&argv), true);
|
||||
EXPECT_EQ("gflags_test", std::string(gflags::ProgramInvocationShortName()));
|
||||
EXPECT_EQ("Hello world!", FLAGS_message);
|
||||
gflags::ShutDownCommandLineFlags();
|
||||
}
|
||||
|
||||
} // namespace gflags_test
|
||||
} // namespace third_party
|
@ -1,7 +0,0 @@
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include "glog/logging.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
TEST(GlogTest, Logging) { LOG(INFO) << "Hello world"; }
|
@ -1,7 +0,0 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package third_party.protobuf_test;
|
||||
|
||||
message Greeting {
|
||||
string name = 1;
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
#include "third_party/protobuf_test/example_lib.h"
|
||||
|
||||
namespace third_party {
|
||||
namespace protobuf_test {
|
||||
|
||||
std::string get_greet(const Greeting& who) { return "Hello " + who.name(); }
|
||||
|
||||
} // namespace protobuf_test
|
||||
} // namespace thrid_party
|
@ -1,13 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "third_party/protobuf_test/example.pb.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace third_party {
|
||||
namespace protobuf_test {
|
||||
|
||||
std::string get_greet(const Greeting &who);
|
||||
|
||||
} // namespace protobuf_test
|
||||
} // namespace third_party
|
@ -1,15 +0,0 @@
|
||||
#include "third_party/protobuf_test/example_lib.h"
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
namespace third_party {
|
||||
namespace protobuf_test {
|
||||
|
||||
TEST(ProtobufTest, GetGreet) {
|
||||
Greeting g;
|
||||
g.set_name("Paddle");
|
||||
EXPECT_EQ("Hello Paddle", get_greet(g));
|
||||
}
|
||||
|
||||
} // namespace protobuf_test
|
||||
} // namespace third_party
|
Loading…
Reference in new issue