| 68 | } |
| 69 | |
| 70 | void CheckConfig::CheckTopicConfig(const int topic_id, const config::TopicConfig *topic_config) { |
| 71 | |
| 72 | auto &&topic = topic_config->GetProto().topic(); |
| 73 | PHX_ASSERT(topic_id, ==, topic.topic_id()); |
| 74 | for (int i{0}; i < topic.handle_ids_size(); ++i) { |
| 75 | auto handle_id = topic.handle_ids(i); |
| 76 | int rank; |
| 77 | PHX_ASSERT(phxqueue::comm::as_integer(comm::RetCode::RET_OK), ==, phxqueue::comm::as_integer(topic_config->GetHandleIDRank(handle_id, rank))); |
| 78 | PHX_ASSERT(rank, ==, i); |
| 79 | } |
| 80 | |
| 81 | // pub |
| 82 | std::vector<std::shared_ptr<const config::proto::Pub>> pubs; |
| 83 | PHX_ASSERT(phxqueue::comm::as_integer(comm::RetCode::RET_OK), ==, phxqueue::comm::as_integer(topic_config->GetAllPub(pubs))); |
| 84 | |
| 85 | std::set<int> pub_ids; |
| 86 | PHX_ASSERT(phxqueue::comm::as_integer(comm::RetCode::RET_OK), ==, phxqueue::comm::as_integer(topic_config->GetAllPubID(pub_ids))); |
| 87 | PHX_ASSERT(pubs.size(), ==, pub_ids.size()); |
| 88 | for (auto &&pub : pubs) { |
| 89 | auto pub_id = pub->pub_id(); |
| 90 | PHX_ASSERT(pub_ids.end() != pub_ids.find(pub_id), ==, true); |
| 91 | PHX_ASSERT(topic_config->IsValidPubID(pub_id), ==, true); |
| 92 | |
| 93 | { |
| 94 | std::shared_ptr<const config::proto::Pub> tmp_pub; |
| 95 | PHX_ASSERT(phxqueue::comm::as_integer(comm::RetCode::RET_OK), ==, phxqueue::comm::as_integer(topic_config->GetPubByPubID(pub_id, tmp_pub))); |
| 96 | PHX_ASSERT(tmp_pub->pub_id(), ==, pub_id); |
| 97 | } |
| 98 | |
| 99 | { |
| 100 | std::set<int> sub_ids; |
| 101 | PHX_ASSERT(phxqueue::comm::as_integer(comm::RetCode::RET_OK), ==, phxqueue::comm::as_integer(topic_config->GetSubIDsByPubID(pub_id, sub_ids))); |
| 102 | PHX_ASSERT(pub->sub_ids_size(), ==, sub_ids.size()); |
| 103 | for (int i{0}; i < pub->sub_ids_size(); ++i) { |
| 104 | auto sub_id = pub->sub_ids(i); |
| 105 | PHX_ASSERT(sub_ids.end() != sub_ids.find(sub_id), ==, true); |
| 106 | } |
| 107 | } |
| 108 | } |
| 109 | |
| 110 | // sub |
| 111 | std::vector<std::shared_ptr<const config::proto::Sub>> subs; |
| 112 | PHX_ASSERT(phxqueue::comm::as_integer(comm::RetCode::RET_OK), ==, phxqueue::comm::as_integer(topic_config->GetAllSub(subs))); |
| 113 | |
| 114 | std::set<int> sub_ids; |
| 115 | PHX_ASSERT(phxqueue::comm::as_integer(comm::RetCode::RET_OK), ==, phxqueue::comm::as_integer(topic_config->GetAllSubID(sub_ids))); |
| 116 | PHX_ASSERT(subs.size(), ==, sub_ids.size()); |
| 117 | for (auto &&sub : subs) { |
| 118 | auto sub_id = sub->sub_id(); |
| 119 | PHX_ASSERT(sub_ids.end() != sub_ids.find(sub_id), ==, true); |
| 120 | PHX_ASSERT(topic_config->IsValidSubID(sub_id), ==, true); |
| 121 | |
| 122 | { |
| 123 | std::shared_ptr<const config::proto::Sub> tmp_sub; |
| 124 | PHX_ASSERT(phxqueue::comm::as_integer(comm::RetCode::RET_OK), ==, phxqueue::comm::as_integer(topic_config->GetSubBySubID(sub_id, tmp_sub))); |
| 125 | PHX_ASSERT(tmp_sub->sub_id(), ==, sub_id); |
| 126 | } |
| 127 | } |
nothing calls this directly
no test coverage detected