@@ -36,12 +36,14 @@ static int next_bit(s64 x)
3636
3737static bool solve_case (const tal_t * ctx )
3838{
39+ int ret ;
3940 static int c = 0 ;
4041 c ++ ;
4142 tal_t * this_ctx = tal (ctx , tal_t );
4243
4344 int N_nodes , N_arcs ;
44- myscanf ("%d %d\n" , & N_nodes , & N_arcs );
45+ ret = myscanf ("%d %d\n" , & N_nodes , & N_arcs );
46+ CHECK (ret == 2 );
4547 printf ("Testcase %d\n" , c );
4648 printf ("nodes %d arcs %d\n" , N_nodes , N_arcs );
4749 if (N_nodes == 0 && N_arcs == 0 )
@@ -60,9 +62,9 @@ static bool solve_case(const tal_t *ctx)
6062
6163 for (u32 i = 0 ; i < N_arcs ; i ++ ) {
6264 u32 from , to ;
63- myscanf ("%" PRIu32 " %" PRIu32 " %" PRIi64 " %" PRIi64 , & from ,
64- & to , & capacity [i ], & cost [i ]);
65-
65+ ret = myscanf ("%" PRIu32 " %" PRIu32 " %" PRIi64 " %" PRIi64 ,
66+ & from , & to , & capacity [i ], & cost [i ]);
67+ CHECK ( ret == 4 );
6668 struct arc arc = {.idx = i };
6769 graph_add_arc (graph , arc , node_obj (from ), node_obj (to ));
6870
@@ -74,7 +76,8 @@ static bool solve_case(const tal_t *ctx)
7476 struct node dst = {.idx = 1 };
7577
7678 s64 amount , best_cost ;
77- myscanf ("%" PRIi64 " %" PRIi64 , & amount , & best_cost );
79+ ret = myscanf ("%" PRIi64 " %" PRIi64 , & amount , & best_cost );
80+ CHECK (ret == 2 );
7881
7982 bool result = simple_mcf (ctx , graph , src , dst , capacity , amount , cost );
8083 CHECK (result );
@@ -99,7 +102,8 @@ static bool solve_case(const tal_t *ctx)
99102int main (int argc , char * argv [])
100103{
101104 common_setup (argv [0 ]);
102- freopen ("plugins/askrene/test/data/linear_mcf" , "r" , stdin );
105+ FILE * f = freopen ("plugins/askrene/test/data/linear_mcf" , "r" , stdin );
106+ CHECK (f );
103107 tal_t * ctx = tal (NULL , tal_t );
104108 CHECK (ctx );
105109
0 commit comments