1 #include <r_util.h>
2 #include <r_socket.h>
3 #include "minunit.h"
4 
test_r2pipe(void)5 static bool test_r2pipe(void) {
6 	R2Pipe *r = r2pipe_open ("radare2 -q0 -");
7 	mu_assert ("r2pipe can spawn", r);
8 	char *hello = r2pipe_cmd (r, "?e hello world");
9 	mu_assert_streq (hello, "hello world\n", "r2pipe hello world");
10 	free (hello);
11 	r2pipe_close (r);
12 	mu_end;
13 }
14 
test_r2pipe_404(void)15 static bool test_r2pipe_404(void) {
16 	R2Pipe *r = r2pipe_open ("rodoro2 -q0 -");
17 	mu_assert ("r2pipe can spawn", !r);
18 	mu_end;
19 }
20 
all_tests()21 static int all_tests() {
22 	mu_run_test (test_r2pipe);
23 	mu_run_test (test_r2pipe_404);
24 	return tests_passed != tests_run;
25 }
26 
main(int argc,char ** argv)27 int main(int argc, char **argv) {
28 	return all_tests ();
29 }
30