@@ -324,7 +324,7 @@ static void test_init_fetch_games_list_request() {
324324
325325 ASSERT_NUM_EQUALS (rc_api_init_fetch_games_list_request (& request , & fetch_games_list_request ), RC_OK );
326326 ASSERT_STR_EQUALS (request .url , DOREQUEST_URL );
327- ASSERT_STR_EQUALS (request .post_data , "r=gameslist&c =12" );
327+ ASSERT_STR_EQUALS (request .post_data , "r=systemgames&s =12" );
328328 ASSERT_STR_EQUALS (request .content_type , RC_CONTENT_TYPE_URLENCODED );
329329
330330 rc_api_destroy_request (& request );
@@ -333,40 +333,65 @@ static void test_init_fetch_games_list_request() {
333333static void test_process_fetch_games_list_response () {
334334 rc_api_fetch_games_list_response_t fetch_games_list_response ;
335335 rc_api_game_list_entry_t * entry ;
336- const char * server_response = "{\"Success\":true,\"Response\":{"
337- "\"1234\":\"Game Name 1\","
338- "\"17\":\"Game Name 2\","
339- "\"9923\":\"Game Name 3\","
340- "\"12303\":\"Game Name 4\","
341- "\"4338\":\"Game Name 5\","
342- "\"5437\":\"Game Name 6\""
343- "}}" ;
336+ const char * server_response = "{\"Success\":true,\"Response\":["
337+ "{\"ID\":111,\"Title\":\"Game Name 1\",\"NumAchievements\":6,\"NumLeaderboards\":0,\"Points\":40,"
338+ "\"ImageIcon\":\"/Images/001110.png\",\"ImageUrl\":\"http://host/Images/001110.png\","
339+ "\"SupportedHashes\":[\"0123456789abcdeffedcba9876543210\"]},"
340+ "{\"ID\":222,\"Title\":\"Game Name 2\",\"NumAchievements\":0,\"NumLeaderboards\":0,\"Points\":0,"
341+ "\"ImageIcon\":\"/Images/002220.png\",\"ImageUrl\":\"http://host/Images/002220.png\","
342+ "\"SupportedHashes\":[]},"
343+ "{\"ID\":333,\"Title\":\"Game Name 3\",\"NumAchievements\":14,\"NumLeaderboards\":3,\"Points\":200,"
344+ "\"ImageIcon\":\"/Images/003330.png\",\"ImageUrl\":\"http://host/Images/003330.png\","
345+ "\"SupportedHashes\":[\"deadbeefdeadbeefdeadbeefdeadbeef\",\"00112233445566778899aabbccddeeff\"],"
346+ "\"UnsupportedHashes\":[\"abababababababababababababababab\"]}"
347+ "]}" ;
344348
345349 memset (& fetch_games_list_response , 0 , sizeof (fetch_games_list_response ));
346350
347351 ASSERT_NUM_EQUALS (rc_api_process_fetch_games_list_response (& fetch_games_list_response , server_response ), RC_OK );
348352 ASSERT_NUM_EQUALS (fetch_games_list_response .response .succeeded , 1 );
349353 ASSERT_PTR_NULL (fetch_games_list_response .response .error_message );
350- ASSERT_NUM_EQUALS (fetch_games_list_response .num_entries , 6 );
354+ ASSERT_NUM_EQUALS (fetch_games_list_response .num_entries , 3 );
351355
352356 entry = & fetch_games_list_response .entries [0 ];
353- ASSERT_NUM_EQUALS (entry -> id , 1234 );
357+ ASSERT_NUM_EQUALS (entry -> id , 111 );
354358 ASSERT_STR_EQUALS (entry -> name , "Game Name 1" );
359+ ASSERT_NUM_EQUALS (entry -> num_achievements , 6 );
360+ ASSERT_NUM_EQUALS (entry -> num_leaderboards , 0 );
361+ ASSERT_NUM_EQUALS (entry -> points , 40 );
362+ ASSERT_STR_EQUALS (entry -> image_name , "001110" );
363+ ASSERT_STR_EQUALS (entry -> image_url , "http://host/Images/001110.png" );
364+ ASSERT_NUM_EQUALS (entry -> num_supported_hashes , 1 );
365+ ASSERT_STR_EQUALS (entry -> supported_hashes [0 ], "0123456789abcdeffedcba9876543210" );
366+ ASSERT_NUM_EQUALS (entry -> num_unsupported_hashes , 0 );
367+ ASSERT_PTR_NULL (entry -> unsupported_hashes );
368+
355369 entry = & fetch_games_list_response .entries [1 ];
356- ASSERT_NUM_EQUALS (entry -> id , 17 );
370+ ASSERT_NUM_EQUALS (entry -> id , 222 );
357371 ASSERT_STR_EQUALS (entry -> name , "Game Name 2" );
372+ ASSERT_NUM_EQUALS (entry -> num_achievements , 0 );
373+ ASSERT_NUM_EQUALS (entry -> num_leaderboards , 0 );
374+ ASSERT_NUM_EQUALS (entry -> points , 0 );
375+ ASSERT_STR_EQUALS (entry -> image_name , "002220" );
376+ ASSERT_STR_EQUALS (entry -> image_url , "http://host/Images/002220.png" );
377+ ASSERT_NUM_EQUALS (entry -> num_supported_hashes , 0 );
378+ ASSERT_PTR_NULL (entry -> supported_hashes );
379+ ASSERT_NUM_EQUALS (entry -> num_unsupported_hashes , 0 );
380+ ASSERT_PTR_NULL (entry -> unsupported_hashes );
381+
358382 entry = & fetch_games_list_response .entries [2 ];
359- ASSERT_NUM_EQUALS (entry -> id , 9923 );
383+ ASSERT_NUM_EQUALS (entry -> id , 333 );
360384 ASSERT_STR_EQUALS (entry -> name , "Game Name 3" );
361- entry = & fetch_games_list_response .entries [3 ];
362- ASSERT_NUM_EQUALS (entry -> id , 12303 );
363- ASSERT_STR_EQUALS (entry -> name , "Game Name 4" );
364- entry = & fetch_games_list_response .entries [4 ];
365- ASSERT_NUM_EQUALS (entry -> id , 4338 );
366- ASSERT_STR_EQUALS (entry -> name , "Game Name 5" );
367- entry = & fetch_games_list_response .entries [5 ];
368- ASSERT_NUM_EQUALS (entry -> id , 5437 );
369- ASSERT_STR_EQUALS (entry -> name , "Game Name 6" );
385+ ASSERT_NUM_EQUALS (entry -> num_achievements , 14 );
386+ ASSERT_NUM_EQUALS (entry -> num_leaderboards , 3 );
387+ ASSERT_NUM_EQUALS (entry -> points , 200 );
388+ ASSERT_STR_EQUALS (entry -> image_name , "003330" );
389+ ASSERT_STR_EQUALS (entry -> image_url , "http://host/Images/003330.png" );
390+ ASSERT_NUM_EQUALS (entry -> num_supported_hashes , 2 );
391+ ASSERT_STR_EQUALS (entry -> supported_hashes [0 ], "deadbeefdeadbeefdeadbeefdeadbeef" );
392+ ASSERT_STR_EQUALS (entry -> supported_hashes [1 ], "00112233445566778899aabbccddeeff" );
393+ ASSERT_NUM_EQUALS (entry -> num_unsupported_hashes , 1 );
394+ ASSERT_STR_EQUALS (entry -> unsupported_hashes [0 ], "abababababababababababababababab" );
370395
371396 rc_api_destroy_fetch_games_list_response (& fetch_games_list_response );
372397}
0 commit comments