-
Notifications
You must be signed in to change notification settings - Fork 121
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed json extension conversion to ds map and improved naming of some…
… files (#2355) Signed-off-by: Saif Kandil <74428638+k0T0z@users.noreply.github.com>
- Loading branch information
Showing
3 changed files
with
18 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
var json = '{"entries":{"entries":[{"name":"AlEw","score":196198,"rank":1,"userID":"1234"},{"name":"El Pice","score":58158,"rank":2,"userID":"12345"},{"name":"saif","score":505,"rank":3,"userID":"12346"},{"name":"Bucciarati (Couter55)","score":336,"rank":4,"userID":"12347"},{"name":"Haiyatin","score":236,"rank":5,"userID":"12348"},{"name":"Kaito","score":137,"rank":6,"userID":"12349"},{"name":"gamesadasteam","score":96,"rank":7,"userID":"123410"},{"name":"Bashkash2013","score":7,"rank":8,"userID":"123411"},{"name":"silveradagio","score":0,"rank":9,"userID":"123412"},{"name":"HappyStarXiXi","score":0,"rank":10,"userID":"123413"}]},"event_type":"leaderboard_download","id":0,"lb_name":"","num_entries":10,"status":0}'; | ||
|
||
var json_decoded = json_decode(json); | ||
|
||
gtest_assert_eq(ds_map_size(json_decoded), 6); | ||
|
||
gtest_assert_eq(ds_map_exists(json_decoded, "entries"), true); | ||
gtest_assert_eq(ds_map_exists(json_decoded, "lb_name"), true); | ||
gtest_assert_eq(ds_map_exists(json_decoded, "event_type"), true); | ||
gtest_assert_eq(ds_map_exists(json_decoded, "id"), true); | ||
gtest_assert_eq(ds_map_exists(json_decoded, "num_entries"), true); | ||
gtest_assert_eq(ds_map_exists(json_decoded, "status"), true); | ||
|
||
var entries = ds_map_find_value(json_decoded, "entries"); | ||
var list = ds_map_find_value(entries, "entries"); | ||
|
||
gtest_assert_eq(ds_list_size(list), 10); |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters