Skip to content

Commit

Permalink
change test suite to only include top10 plays until everything is rec…
Browse files Browse the repository at this point in the history
…alced
  • Loading branch information
Francesco149 committed Feb 3, 2021
1 parent d277dab commit 71b8120
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 32 deletions.
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -369,18 +369,16 @@ to the build script to disable features:

```sh
cd test
mkdir test_suite
OSU_API_KEY=... ./gentest.py
OSU_API_KEY=... ./gentest.py > test_suite.c
```

if it fails to open maps do this:
download all the maps

```sh
mkdir test_suite
cd test_suite
../download_suite.py ../test_suite.json
cd ..

OSU_API_KEY=... ./gentest.py -input-file test_suite.json > test_suite.c
```

the json file can be reused to avoid hitting the osu API again. keep using it unless a pp recalc
Expand Down
53 changes: 26 additions & 27 deletions test/gentest.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,52 +158,51 @@ def gen_modstr(bitmask):

scores = []

#top_players = [
# [ 124493, 4787150, 2558286, 1777162, 2831793, 50265 ],
# [ 3174184, 8276884, 5991961, 2774767 ]
#]

top_players = [
[ 124493, 4787150, 2558286, 1777162, 2831793, 50265 ],
[ 3174184, 8276884, 5991961, 2774767 ]
[ 4504101, 7562902, 6447454, 4787150, 11367222, 5339515, 8179335, 4196808, 4650315 ]
]

if args.input_file == None:
# fetch a fresh test suite from osu api
osu = httplib.HTTPSConnection('osu.ppy.sh')

for m in [0, 1]:
for u in top_players[m]:
for m, ids in enumerate(top_players):
for u in ids:
params = { 'u': u, 'limit': 100, 'type': 'id', 'm': m }
batch = osu_get(osu, 'get_user_best', params)
for s in batch:
s['mode'] = m
scores += batch

# temporarily removed, not all std scores are recalc'd
#params = { 'm': 0, 'since': '2015-11-26' }
# TODO: uncomment when all scores are properly recalced
#params = { 'm': 0, 'since': '2019-01-01' }
#maps = osu_get(osu, 'get_beatmaps', params)

# no taiko converts here because as explained below, tiny float
# errors can lead to completely broken conversions
for mode in [1]:
params = { 'm': mode, 'since': '2015-11-26' }
maps = osu_get(osu, 'get_beatmaps', params)

for m in maps:
params = { 'b': m['beatmap_id'], 'm': mode }
map_scores = osu_get(osu, 'get_scores', params)
#for m in maps:
# mode = 0
# params = { 'b': m['beatmap_id'], 'm': mode }
# map_scores = osu_get(osu, 'get_scores', params)

if len(map_scores) == 0:
sys.stderr.write('W: map has no scores???\n')
continue
# if len(map_scores) == 0:
# sys.stderr.write('W: map has no scores???\n')
# continue

# note: api also returns qualified and loved, so ignore
# maps that don't have pp in rankings
if not 'pp' in map_scores[0] or map_scores[0]['pp'] is None:
sys.stderr.write('W: ignoring loved/qualified map\n')
continue
# # note: api also returns qualified and loved, so ignore
# # maps that don't have pp in rankings
# if not 'pp' in map_scores[0] or map_scores[0]['pp'] is None:
# sys.stderr.write('W: ignoring loved/qualified map\n')
# continue

for s in map_scores:
s['beatmap_id'] = m['beatmap_id']
s['mode'] = mode
# for s in map_scores:
# s['beatmap_id'] = m['beatmap_id']
# s['mode'] = mode

scores += map_scores
# scores += map_scores


with open(args.output_file, 'w+') as f:
Expand Down

0 comments on commit 71b8120

Please sign in to comment.