Skip to content

Commit

Permalink
Fixes #204
Browse files Browse the repository at this point in the history
Fix: Takes another variable expected_result and sprintf the same format and the variable in it and check it with the onion_response_printf. Since both will follow the same implementation will give the same result if the test case works.
  • Loading branch information
anuragagarwal561994 committed Aug 18, 2016
1 parent 2aa3e76 commit 2693ba2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tests/01-internal/03-response.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ void t05_printf(){
onion_add_listen_point(server,NULL,NULL,onion_buffer_listen_point_new());
onion_request *request;
char buffer[4096];
char expected_result[4096];
memset(buffer,0,sizeof(buffer));

request=onion_request_new(server->listen_points[0]);
Expand All @@ -196,7 +197,8 @@ void t05_printf(){
onion_request_free(request);
onion_free(server);

FAIL_IF_NOT_STRSTR(buffer, "Hello world 123 (nil)");
sprintf(expected_result, "%s %d %p", "Hello world", 123, NULL);
FAIL_IF_NOT_STRSTR(buffer, expected_result);

END_LOCAL();
}
Expand Down

0 comments on commit 2693ba2

Please sign in to comment.