+CommTestTransition::CommTestTransition(aid_t issuer, int times_considered, char* buffer)
+ : Transition(Type::COMM_TEST, issuer, times_considered)
+{
+ std::stringstream stream(buffer);
+ stream >> comm_ >> sender_ >> receiver_ >> mbox_ >> src_buff_ >> dst_buff_ >> size_;
+ XBT_DEBUG("CommTestTransition comm:%p, sender:%ld receiver:%ld mbox:%u sbuff:%p rbuff:%p size:%zu", comm_, sender_,
+ receiver_, mbox_, src_buff_, dst_buff_, size_);
+}
+std::string CommTestTransition::to_string(bool verbose) const
+{
+ auto res = xbt::string_printf("%ld: TestComm(from %ld to %ld, mbox=%u", aid_, sender_, receiver_, mbox_);
+ if (verbose) {
+ res += ", src_buff=" + xbt::string_printf("%p", src_buff_) + ", size=" + std::to_string(size_);
+ res += ", dst_buff=" + xbt::string_printf("%p", dst_buff_);
+ }
+ res += ")";
+ return res;
+}
+bool CommTestTransition::depends(const Transition* other) const
+{
+ if (aid_ == other->aid_)
+ return false;
+
+ if (dynamic_cast<const RandomTransition*>(other) != nullptr)
+ return false; // Test & Random are independent (Random is independent with anything)
+
+ if (auto* recv = dynamic_cast<const CommRecvTransition*>(other))
+ return recv->depends(this); // Recv < Test (alphabetical ordering)
+
+ if (auto* send = dynamic_cast<const CommSendTransition*>(other))
+ return send->depends(this); // Send < Test (alphabetical ordering)
+
+ if (dynamic_cast<const CommTestTransition*>(other) != nullptr)
+ return false; // Test & Test are independent
+
+ if (const auto* wait = dynamic_cast<const CommWaitTransition*>(other)) {
+ if (wait->timeout_)
+ return true; // Timeouts are not considered by the independence theorem, thus assumed dependent
+
+ /* Wait & Test are independent */
+ return false;
+ }
+
+ return true;
+}