Commit c05ba7e6 authored by Geoff Simmons's avatar Geoff Simmons

implement and test formatters for %s

parent ec0c8a2c
......@@ -406,10 +406,10 @@ format_r_##dir(tx_t *tx, char *name, enum VSL_tag_e tag, \
FORMAT_r(client, Req)
FORMAT_r(backend, Bereq)
#if 0
FORMAT(client, s, RespStatus)
FORMAT(backend, s, BerespStatus)
FORMAT(client, s, TxStatus)
FORMAT(backend, s, RxStatus)
#if 0
#define FORMAT_tim(ltr, fmt, extra) \
static void \
......
......@@ -83,3 +83,6 @@ formatter_f format_q_backend;
formatter_f format_r_client;
formatter_f format_r_backend;
formatter_f format_s_client;
formatter_f format_s_backend;
......@@ -766,6 +766,34 @@ static const char
return NULL;
}
static const char
*test_format_s(void)
{
tx_t tx;
logline_t rec;
chunk_t chunk;
char *str;
size_t len;
printf("... testing format_s_*()\n");
init_tx_rec_chunk(&tx, &rec, &chunk);
MAN(chunk.data);
#define STATUS_PAYLOAD "200"
set_record_data(&rec, &chunk, STATUS_PAYLOAD, SLT_RespStatus);
format_s_client(&tx, NULL, SLT__Bogus, &str, &len);
MASSERT(strcmp(str, STATUS_PAYLOAD) == 0);
MASSERT(len == 3);
rec.tag = SLT_BerespStatus;
format_s_backend(&tx, NULL, SLT__Bogus, &str, &len);
MASSERT(strcmp(str, STATUS_PAYLOAD) == 0);
MASSERT(len == 3);
return NULL;
}
static const char
*all_tests(void)
{
......@@ -785,6 +813,7 @@ static const char
mu_run_test(test_format_O);
mu_run_test(test_format_q);
mu_run_test(test_format_r);
mu_run_test(test_format_s);
return NULL;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment