-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
29 changed files
with
107 additions
and
30 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 @@ | ||
BISECT-COVERAGE-4 41 36 lib/api/community/community_event.ml 9 175 236 250 265 383 296 412 276 46 9 1 1 1 1 1 1 0 1 1 28 lib/models/stub/clan_info.ml 30 594 775 315 912 917 955 963 1009 1017 1069 1077 1115 1123 1161 1169 1221 1226 1320 1325 1265 1373 1381 1441 1449 1503 1508 1579 1590 1597 850 30 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 32 lib/models/stub/advertisement.ml 46 1101 538 1541 1546 1620 1625 1713 1718 1794 1802 1882 1887 1947 1952 2024 2032 2096 2101 2165 2173 2237 2245 2329 2334 2404 2409 2483 2488 2562 2573 2580 2675 2680 2752 2757 2831 2836 2912 2917 3005 3010 3082 3087 3173 3181 1492 46 0 0 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 46 lib/models/response/community/advertisement.ml 13 177 219 283 134 426 448 492 503 510 583 594 601 356 13 0 0 0 0 1 1 1 1 1 1 1 1 1 25 lib/api/community/clan.ml 28 35 48 70 84 97 213 290 356 421 409 497 534 557 572 679 603 708 583 123 871 932 960 975 1087 1006 1116 986 770 28 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 0 1 1 37 lib/models/stub/leaderboard_region.ml 8 83 255 260 298 306 358 363 193 8 0 8 8 8 8 8 8 8 23 lib/models/stub/news.ml 24 296 857 862 924 929 1003 1011 1103 1108 1206 1211 1301 1306 1374 1382 1448 1456 1522 1530 1602 1607 1677 1682 808 24 0 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 44 lib/models/response/community/achievement.ml 9 151 201 108 351 373 434 445 452 281 9 0 0 0 1 1 1 1 1 1 29 lib/models/stub/stat_group.ml 12 223 107 346 351 389 397 436 441 485 496 503 284 12 0 0 24 24 24 24 24 24 24 24 24 24 37 lib/models/response/community/news.ml 9 128 162 89 289 311 349 360 367 219 9 0 0 0 1 1 2 1 1 2 27 lib/models/stub/response.ml 6 66 204 209 273 281 151 6 0 12 12 12 12 12 25 lib/api/community/news.ml 9 139 200 214 229 308 260 441 240 46 9 2 2 2 2 2 2 0 2 2 34 lib/api/community/advertisement.ml 13 35 48 187 264 293 323 340 355 471 386 500 366 74 13 1 1 1 1 1 1 1 1 1 1 0 1 1 17 lib/data/query.ml 12 70 55 41 23 171 156 142 124 274 259 245 227 12 8 6 6 6 3 1 1 1 6 2 2 2 16 lib/data/game.ml 4 68 85 102 119 4 0 14 0 0 13 lib/client.ml 21 99 191 248 276 338 400 352 576 678 619 603 708 430 302 202 148 812 826 867 917 768 21 12 3 3 3 2 2 2 1 1 1 1 1 1 2 3 3 11 3 14 14 14 31 lib/models/stub/match_member.ml 14 148 457 462 532 537 601 606 680 685 749 754 816 821 396 14 0 2 2 2 2 2 2 2 2 2 2 2 2 2 34 lib/models/stub/community_event.ml 26 365 944 949 987 995 1035 1040 1077 1082 1132 1137 1203 1208 1270 1275 1343 1348 1408 1413 1463 1471 1521 1526 1583 1591 882 26 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 11 lib/json.ml 9 286 323 404 361 416 222 332 208 188 9 0 1 0 0 0 1 0 1 2 38 lib/models/stub/leaderboard_sorting.ml 7 144 76 98 116 59 209 229 7 0 0 0 0 0 0 2 30 lib/models/stub/leaderboard.ml 14 235 228 276 127 415 420 458 466 512 517 580 591 598 353 14 0 0 0 0 13 13 13 13 13 13 13 13 13 13 23 lib/models/stub/race.ml 10 106 318 323 361 369 419 424 476 481 256 10 0 45 45 45 45 45 45 45 45 45 44 lib/models/response/community/leaderboard.ml 21 405 452 529 599 670 362 817 839 919 930 937 1035 1046 1053 1139 1150 1157 1279 1290 1297 760 21 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 55 lib/models/response/community/achievement_attainment.ml 15 263 231 355 394 140 581 603 691 706 895 821 969 775 998 490 15 0 0 0 0 0 2 2 2 2 2 2 0 2 2 2 34 lib/models/stub/leaderboard_map.ml 8 98 322 327 385 390 434 439 240 8 0 25 25 25 25 25 25 25 32 lib/api/community/achievement.ml 22 173 234 248 263 377 294 406 274 56 458 691 758 802 829 844 981 881 1013 857 510 569 483 22 1 1 1 1 1 1 0 1 1 0 3 3 3 3 3 2 2 1 3 0 3 3 44 lib/models/response/community/avatar_stat.ml 9 159 215 116 392 414 496 507 514 303 9 0 0 0 1 1 1 1 1 1 35 lib/models/stub/clan_permissions.ml 40 316 309 367 360 416 409 465 458 514 507 565 558 618 611 683 676 241 854 859 897 902 951 956 1003 1008 1055 1060 1107 1112 1161 1166 1217 1222 1285 1290 1333 1341 1393 1398 788 40 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 30 lib/models/stub/avatar_stat.ml 10 115 383 388 444 449 489 494 546 551 305 10 0 1 1 1 1 1 1 1 1 1 41 lib/models/stub/achievement_attainment.ml 6 78 263 268 342 347 190 6 0 85 85 85 85 85 45 lib/models/response/community/leaderboard2.ml 15 219 264 345 176 538 560 611 622 629 718 729 736 817 822 468 15 0 0 0 0 2 2 2 2 2 2 2 2 2 2 2 35 lib/models/stub/leaderboard_stat.ml 36 381 1148 1153 1211 1216 1254 1259 1301 1306 1348 1353 1399 1404 1444 1449 1487 1492 1540 1545 1593 1598 1640 1645 1695 1700 1760 1765 1821 1826 1878 1883 1945 1950 2006 2011 1066 36 0 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 48 lib/models/response/community/community_event.ml 9 154 204 111 357 379 439 450 457 287 9 0 0 0 1 1 1 1 1 1 30 lib/models/stub/join_policy.ml 9 247 169 183 203 219 152 312 324 342 9 0 2 1 0 0 3 1 0 0 30 lib/models/stub/achievement.ml 18 207 608 613 671 679 761 766 862 867 925 933 1007 1012 1076 1081 1157 1162 559 18 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 32 lib/api/community/leaderboard.ml 41 163 224 238 253 367 284 396 264 46 455 696 763 808 835 850 976 887 1008 863 507 566 480 1072 1129 1162 1177 1192 1334 1411 1490 1448 1566 1612 1649 1672 1687 1802 1718 1831 1698 1226 41 1 1 1 1 1 1 0 1 1 0 1 1 1 1 1 1 1 0 1 0 1 1 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 0 2 2 25 lib/models/stub/avatar.ml 18 203 609 614 672 680 740 748 840 845 899 904 964 969 1059 1064 1128 1136 544 18 0 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 29 lib/models/stub/match_type.ml 8 83 255 260 298 306 358 363 193 8 0 25 25 25 25 25 25 25 23 lib/models/stub/clan.ml 26 730 451 958 963 1021 1029 1095 1103 1175 1183 1241 1249 1307 1315 1387 1392 1487 1492 1432 1559 1567 1647 1655 1729 1734 909 26 0 0 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 37 lib/models/response/community/clan.ml 9 129 164 90 292 314 354 365 372 222 9 0 0 0 1 1 1 1 1 1 42 lib/models/response/community/clan_info.ml 8 126 167 87 272 294 332 355 202 8 0 0 0 1 1 1 1 1 |
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
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
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 @@ | ||
val get : Data.Game.t -> string -> Data.Requester.Json.t -> Models.Response.Community.Community_event.t option Lwt.t |
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
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
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 |
---|---|---|
@@ -1,14 +1,3 @@ | ||
let encode_lst_i lst = | ||
let json_string = "[" ^ String.concat "," (List.map (fun item -> string_of_int item) lst) ^ "]" in | ||
Uri.pct_encode json_string | ||
;; | ||
|
||
let encode_lst_f lst = | ||
let json_string = "[" ^ String.concat "," (List.map (fun item -> string_of_float item) lst) ^ "]" in | ||
Uri.pct_encode json_string | ||
;; | ||
|
||
let encode_lst_s lst = | ||
let json_string = "[" ^ String.concat "," (List.map (fun item -> "\"" ^ item ^ "\"") lst) ^ "]" in | ||
Uri.pct_encode json_string | ||
;; | ||
let encode_lst_i lst = "[" ^ String.concat "," (List.map (fun item -> string_of_int item) lst) ^ "]" | ||
let encode_lst_f lst = "[" ^ String.concat "," (List.map (fun item -> string_of_float item) lst) ^ "]" | ||
let encode_lst_s lst = "[" ^ String.concat "," (List.map (fun item -> "\"" ^ item ^ "\"") lst) ^ "]" |
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 |
---|---|---|
@@ -1,6 +1,15 @@ | ||
.PHONY: test | ||
.PHONY: unit-test | ||
unit-test: | ||
dune runtest tests/unit --root $$(pwd) --instrument-with bisect_ppx --force | ||
|
||
.PHONY: integration-test | ||
integration-test: | ||
dune runtest tests/integration --root $$(pwd) --instrument-with bisect_ppx --force | ||
|
||
test: | ||
find . -name '*.coverage' | xargs rm -f | ||
dune runtest --root $$(pwd) --instrument-with bisect_ppx --force | ||
bisect-ppx-report html | ||
bisect-ppx-report summary | ||
make integration-test || exit 1 | ||
make unit-test || exit 1 | ||
bisect-ppx-report merge combined.coverage _build/default/tests/**/*.coverage | ||
bisect-ppx-report html combined.coverage | ||
bisect-ppx-report summary combined.coverage |
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,6 @@ | ||
(include_subdirs qualified) | ||
|
||
(test | ||
(name test) | ||
(package relic-sdk) | ||
(libraries alcotest alcotest-lwt relic-sdk)) |
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,39 @@ | ||
open Relic_sdk | ||
open Alcotest_lwt | ||
open Lwt.Syntax | ||
|
||
let setup_community () = | ||
let open Test_state.Community in | ||
let domain = "aoe-api.worldsedgelink.com" in | ||
let game = Data.Game.Age2 in | ||
let client = Client.create domain game in | ||
let endpoint = Api.Community.Leaderboard.get_leaderboard_2 ~count:1 in | ||
let* leaderboards_response = Client.get endpoint client in | ||
match leaderboards_response with | ||
| None -> Lwt.fail_with "No leaderboards response" | ||
| Some { stat_groups = []; _ } -> Lwt.fail_with "No stat groups" | ||
| Some { stat_groups = stat_group :: _; _ } -> | ||
(match stat_group.members with | ||
| [] -> Lwt.fail_with "No members" | ||
| test_member :: _ -> Lwt.return { client; test_member }) | ||
;; | ||
|
||
let () = | ||
Lwt_main.run | ||
@@ | ||
let* setup_data = setup_community () in | ||
let suite = | ||
[ ( "Community" | ||
, [ test_case | ||
"User achievement attainment" | ||
`Slow | ||
(Test_case.Community.Achievements.test_get_user_achievements setup_data) | ||
; test_case | ||
"Non-user achievement attainment" | ||
`Slow | ||
(Test_case.Community.Achievements.test_get_user_achievements_no_user setup_data) | ||
] ) | ||
] | ||
in | ||
Alcotest_lwt.run "Relic SDK" suite | ||
;; |
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,24 @@ | ||
open Relic_sdk | ||
open Test_state.Community | ||
|
||
let test_get_user_achievements test_state _ () = | ||
let open Lwt.Syntax in | ||
let endpoint = Api.Community.Achievement.get ~profile_ids:[ test_state.test_member.profile_id ] in | ||
let* attainment_opt = Client.get endpoint test_state.client in | ||
match attainment_opt with | ||
| Some attainment when not ([] == attainment.user_achievements_map) -> | ||
Lwt.return | ||
(Alcotest.check Alcotest.bool "Non-empty achievements map" true (not ([] == attainment.user_achievements_map))) | ||
| Some _ -> Lwt.fail_with "Achievement attainment response is empty" | ||
| None -> Lwt.fail_with "No achievement attainment response" | ||
;; | ||
|
||
let test_get_user_achievements_no_user test_state _ () = | ||
let open Lwt.Syntax in | ||
let endpoint = Api.Community.Achievement.get ~profile_ids:[ -2 ] in | ||
(* -1 is allowed in the API but -2 isn't *) | ||
let* attainment_opt = Client.get endpoint test_state.client in | ||
match attainment_opt with | ||
| Some _ -> Lwt.fail_with "Achievement attainment response exists (expected complete failure)" | ||
| None -> Lwt.return_unit | ||
;; |
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,6 @@ | ||
open Relic_sdk | ||
|
||
type t = | ||
{ client : Client.t | ||
; test_member : Models.Stub.Avatar.t | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
File renamed without changes.