mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
add comments of message array, add utest.
This commit is contained in:
parent
6a4b177475
commit
09afaa250a
2 changed files with 17 additions and 0 deletions
|
@ -50,7 +50,13 @@ public:
|
||||||
SrsSharedPtrMessage** msgs;
|
SrsSharedPtrMessage** msgs;
|
||||||
int size;
|
int size;
|
||||||
public:
|
public:
|
||||||
|
/**
|
||||||
|
* create msg array, initialize array to NULL ptrs.
|
||||||
|
*/
|
||||||
SrsSharedPtrMessageArray(int _size);
|
SrsSharedPtrMessageArray(int _size);
|
||||||
|
/**
|
||||||
|
* free the msgs not sent out(not NULL).
|
||||||
|
*/
|
||||||
virtual ~SrsSharedPtrMessageArray();
|
virtual ~SrsSharedPtrMessageArray();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -413,5 +413,16 @@ VOID TEST(ProtocolMsgArrayTest, MessageArray)
|
||||||
EXPECT_EQ(3, msg.count());
|
EXPECT_EQ(3, msg.count());
|
||||||
}
|
}
|
||||||
EXPECT_EQ(0, msg.count());
|
EXPECT_EQ(0, msg.count());
|
||||||
|
|
||||||
|
if (true) {
|
||||||
|
SrsSharedPtrMessageArray arr(3);
|
||||||
|
|
||||||
|
arr.msgs[0] = msg.copy();
|
||||||
|
EXPECT_EQ(1, msg.count());
|
||||||
|
|
||||||
|
arr.msgs[2] = msg.copy();
|
||||||
|
EXPECT_EQ(2, msg.count());
|
||||||
|
}
|
||||||
|
EXPECT_EQ(0, msg.count());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue