File tree Expand file tree Collapse file tree 2 files changed +4
-3
lines changed Expand file tree Collapse file tree 2 files changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -65,7 +65,7 @@ int main()
6565 assert (result == MJRPC_RET_OK );
6666 // Assert that the response contains "Division by zero is not allowed."
6767 assert (json_response != NULL );
68- assert (strcmp (json_response , "Division by zero is not allowed" ) == 0 );
68+ assert (strstr (json_response , "Division by zero is not allowed" ) != NULL );
6969
7070 // Show the response
7171 printf ("Response: %s\n" , json_response );
Original file line number Diff line number Diff line change 33#include <stdio.h>
44#include <stdlib.h>
55#include <assert.h>
6+ #include <string.h>
67
78// Define a simple JSON-RPC method
89cJSON * hello_world (mjrpc_func_ctx_t * context , cJSON * params , cJSON * id )
@@ -30,7 +31,7 @@ int main()
3031 assert (result == MJRPC_RET_OK );
3132 // Assert that the response contains "Goodbye, World!"
3233 assert (json_response != NULL );
33- assert (strcmp (json_response , "Hello, World!" ) == 0 );
34+ assert (strstr (json_response , "Hello, World!" ) != NULL );
3435
3536 // Show the response
3637 printf ("Response: %s\n" , json_response );
@@ -46,7 +47,7 @@ int main()
4647 // be MJRPC_RET_OK, and the error is in json_response)
4748 assert (result == MJRPC_RET_OK );
4849 assert (json_response != NULL );
49- assert (strcmp (json_response , "Method not found" ) == 0 );
50+ assert (strstr (json_response , "Method not found" ) != NULL );
5051
5152 // Show the response
5253 printf ("Response: %s\n" , json_response );
You can’t perform that action at this time.
0 commit comments