🧪 test(mq publish at once): add test case
This commit is contained in:
@@ -339,9 +339,10 @@ static void test_pub_on_msg_free(void *msg, void *msg_free_arg)
|
||||
{
|
||||
struct test_pub_on_free_env *env = (struct test_pub_on_free_env *)msg_free_arg;
|
||||
env->on_msg_free_called+=1;
|
||||
if(env->current_round==env->N_round-1 && (long)msg!=env->N_round)
|
||||
if((long)msg!=env->N_round && (int)(long)msg==env->N_round-1)
|
||||
{
|
||||
EXPECT_EQ(mq_runtime_publish_message(env->rt, env->topic_id, (void *)(long)(env->N_round)), -1);//on message free, publish always failed
|
||||
EXPECT_EQ(mq_runtime_publish_message_at_once(env->rt, env->topic_id, (void *)(long)(env->N_round)), 0);//on message free, publish at once success
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -379,8 +380,8 @@ TEST(mq_runtime, pub_on_msg_free)
|
||||
mq_runtime_free(env.rt);
|
||||
mq_schema_free(env.s);
|
||||
|
||||
EXPECT_EQ(env.on_msg_free_called, env.N_round);
|
||||
EXPECT_EQ(env.on_msg_called, env.N_round);
|
||||
EXPECT_EQ(env.on_msg_free_called, env.N_round+1);
|
||||
EXPECT_EQ(env.on_msg_called, env.N_round+1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user