MCPcopy Create free account
hub / github.com/Tencent/phxqueue / TestTopicConfig

Method TestTopicConfig

phxqueue/test/test_config.cpp:50–253  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48}
49
50void TestConfig::TestTopicConfig(const config::TopicConfig *topic_config) {
51 // 1->1, 2
52 // 2->2
53 const vector<int> expected_pub_ids = {1, 2};
54 const vector<int> expected_sub_ids = {1, 2};
55
56 /*************************** pub ****************************/
57 // GetAllPub
58 {
59 vector<shared_ptr<const config::proto::Pub> > pubs;
60 assert(comm::RetCode::RET_OK == topic_config->GetAllPub(pubs));
61 assert(expected_pub_ids.size() == pubs.size());
62 }
63
64 // GetAllPubID
65 {
66 set<int> pub_ids;
67 assert(comm::RetCode::RET_OK == topic_config->GetAllPubID(pub_ids));
68 assert(expected_pub_ids.size() == pub_ids.size());
69 }
70
71
72 // IsValidPubID
73 {
74 for (auto &&pub_id : expected_pub_ids) {
75 assert(topic_config->IsValidPubID(pub_id));
76 }
77 }
78
79 // GetPubByPubID
80 {
81 shared_ptr<const config::proto::Pub> pub;
82 assert(comm::RetCode::RET_OK == topic_config->GetPubByPubID(expected_pub_ids[0], pub));
83 assert(pub);
84 assert(expected_pub_ids[0] == pub->pub_id());
85 }
86
87 // GetSubIDsByPubID
88 {
89 set<int> sub_ids;
90 assert(comm::RetCode::RET_OK ==
91 topic_config->GetSubIDsByPubID(expected_pub_ids[0], sub_ids)); // 1->1,2
92 assert(expected_sub_ids.size() == sub_ids.size());
93 }
94
95 /*************************** sub ****************************/
96
97 // GetAllSub
98 {
99 vector<shared_ptr<const config::proto::Sub> > subs;
100 assert(comm::RetCode::RET_OK == topic_config->GetAllSub(subs));
101 assert(expected_sub_ids.size() == subs.size());
102 }
103
104 // GetAllSubID
105 {
106 set<int> sub_ids;
107 assert(comm::RetCode::RET_OK == topic_config->GetAllSubID(sub_ids));

Callers

nothing calls this directly

Calls 15

GetAllPubMethod · 0.80
GetAllPubIDMethod · 0.80
IsValidPubIDMethod · 0.80
GetPubByPubIDMethod · 0.80
GetSubIDsByPubIDMethod · 0.80
GetAllSubMethod · 0.80
GetAllSubIDMethod · 0.80
IsValidSubIDMethod · 0.80
GetSubBySubIDMethod · 0.80
IsValidQueueMethod · 0.80

Tested by

no test coverage detected