unit tests for mc (src/util.c: convert_controls)
Roland Illig
roland.illig at gmx.de
Sun Sep 26 19:04:37 UTC 2004
Hi,
I'm currently creating some unit tests for simple cases (that is:
functions that do not require interaction and that only operate on
simple data structures). One of the first candidates is convert_controls
(src/util.c). I discovered that the function "eats" backslash
characters and '^' characters.
Here is my testdata. The items which are commented out do not work at
the moment. We should discuss if this behaviour is intended or if the
code should be changed.
static const string_pair testdata[] = {
{"/home/user", "/home/user"},
{"^a^b^c", "\001\002\003"},
{"\\Escape", "\033scape"},
{"\\escap\\e", "\033scap\033"},
/* {"back\\\\slash", "back\\\\slash"}, */
/* {"backslash\\", "backslash\\"}, */
{"^^a^^b^^c^d", "^a^b^c\004"},
{"\001\002\003\004\005\006\007",
"\001\002\003\004\005\006\007"},
{"\010\011\012\013\014\015\016\017",
"\010\011\012\013\014\015\016\017"},
{"\020\021\022\023\024\025\026\027",
"\020\021\022\023\024\025\026\027"},
{"\030\031\032\033\034\035\036\037",
"\030\031\032\033\034\035\036\037"},
{" !\"#$%&'()*+,-./0123456789:;<=>?",
" !\"#$%&'()*+,-./0123456789:;<=>?"},
/* {"@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_",
"@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_"}, */
{"`abcdefghijklmnopqrstuvwxyz{|}~\177",
"`abcdefghijklmnopqrstuvwxyz{|}~\177"}
};
Roland
More information about the mc-devel
mailing list