[Oisf-devel] Coding style improvement proposal

Eric Leblond eric at regit.org
Tue May 12 15:05:42 UTC 2015


As some of you know, I don't like unittests. And when I see things like:

int SMTPProcessDataChunkTest02(void){
    char mimemsg[] = {0x4D, 0x49, 0x4D, 0x45, 0x2D, 0x56, 0x65, 0x72,
            0x73, 0x69, 0x6F, 0x6E, 0x3A, 0x20, 0x31, 0x2E,

I start to think I'm right. The raw data are completely unreadable by
normal human being o you can't guess what is done when you need to fix
the unittests^W code after some changes.

IMHO, we should have on top of these raw data a textual representation
of the byte fields in comment. Like this is done somewhere else in the
app-layer-smtp.c file:

int SMTPParserTest14(void)
   /* 220 mx.google.com ESMTP d15sm986283wfl.6<CR><LF> */
    static uint8_t welcome_reply[] = {

What do you think ?

Eric Leblond <eric at regit.org>
Blog: https://home.regit.org/

More information about the Oisf-devel mailing list