diff --git a/fish_tests.c b/fish_tests.c index e7c180183..5a1acfd17 100644 --- a/fish_tests.c +++ b/fish_tests.c @@ -26,6 +26,7 @@ #include #include +#include #include "fallback.h" #include "util.h" @@ -48,6 +49,19 @@ #include "halloc.h" #include "halloc_util.h" +/** + The number of tests to run + */ +#define ESCAPE_TEST_COUNT 1000000 +/** + The average length of strings to unescape + */ +#define ESCAPE_TEST_LENGTH 100 +/** + The higest character number of character to try and escape + */ +#define ESCAPE_TEST_CHAR 4000 + /** Number of laps to run performance testing loop */ @@ -402,6 +416,140 @@ static void test_util() } +/** + Test the escaping/unescaping code by escaping/unescaping random + strings and verifying that the original string comes back. +*/ +static void test_escape() +{ + int i; + string_buffer_t sb; + + say( L"Testing escaping and unescaping" ); + + sb_init( &sb ); + + for( i=0; i