ndnpoke: add unit testing
Add unit testing for
Refactor this programs as necessary.
Updated by Junxiao Shi almost 4 years ago
I suggest having at least these test cases:
- prepare Data, sign as default, reply to Interest
- prepare Data with
FinalBlockId, sign as default, reply to Interest
- prepare Data with FreshnessPeriod set to a positive value, sign as default, reply to Interest
- prepare Data with FreshnessPeriod set to zero, sign as default, reply to Interest
- prepare Data, sign with
DigestSha256, reply to Interest
- prepare Data, sign with specified identity, reply to Interest
- prepare Data, sign as default, wait for specified timeout, Interest doesn't arrive
- prepare Data, send Data without waiting for Interest
- Data size exceeds
Updated by Davide Pesavento almost 4 years ago
I agree with note-2, except that I don't think we need to distinguish between
FreshnessPeriod > 0 and
FreshnessPeriod == 0. There's no conditional in ndnpoke that would be affected by that. Just do one test with a specified FreshnessPeriod (i.e.
Updated by Davide Pesavento over 2 years ago
Have you looked at the (now abandoned) change mentioned above? You should probably resume from there rather than start from scratch.
How would I provide input to ndnpoke for the data packet content?
NdnPoke class needs to accept a parameter of type
std::istream& through which the packet payload can be read.
main() will pass
std::cin, while in the unit tests you can pass whatever, e.g. an instance of
std::stringstream containing the test data.