Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code Testing #43

Open
jxu opened this issue Jun 10, 2019 · 8 comments
Open

Code Testing #43

jxu opened this issue Jun 10, 2019 · 8 comments

Comments

@jxu
Copy link
Contributor

jxu commented Jun 10, 2019

Unit tests at the very least to ensure updating the code doesn't break everything

@fnimick
Copy link

fnimick commented Jun 10, 2019

But the best easiest way to test is to push new code and see if anyone complains about it breaking 🤔

@llllllllll
Copy link
Owner

I agree that slider could use some unit tests, and probably integration/regression tests around the PP calculation and replay parsing. I haven't had time to do that, but I would be open to talking to you about setting that up if you are interested.

@blimmo
Copy link
Collaborator

blimmo commented Jun 10, 2019

I've been pretty busy recently but I should have a bunch of free time starting saturday so I can at the very least review code and probably write some too :)

@jxu
Copy link
Contributor Author

jxu commented Jun 11, 2019

I propose to use the default unittest module and test out basic parts of the API.
For example: test simple empty beatmap, common beatmaps, tricky beatmaps (old maps, lots of hitobjects, even 2B maps?).
Same goes for testing replays. Ideally the API works for all gamemodes.

@llllllllll
Copy link
Owner

Given that we won't have much complicated persistent state to manage across tests, it's probably easier to use pytest. We use a mix of nose and pytest at work, and I have a slight preference for it.

@llllllllll
Copy link
Owner

NOTE: an old map that has a linear type slider that we once failed to handle correctly, instead treating it like bezier: https://osu.ppy.sh/beatmapsets/19789#osu/69405

@jxu
Copy link
Contributor Author

jxu commented Jun 12, 2019

While we're at it why not test this QA gem from Zallius: "安心感"
https://osu.ppy.sh/beatmapsets/106#osu/232

Another one: https://osu.ppy.sh/beatmapsets/104#osu/228

Minor plug: I've collected a table of pretty much every map loved/ranked up to August 2018 https://github.com/jxu/osu-stats/releases
IIRC some map had a literal tab character in the tags which of course messed up my TSV writing. And it was a modern map too

@jxu
Copy link
Contributor Author

jxu commented Jun 15, 2019

So I am not familiar with pytest or really "good practice" for testing (most testing I write is informal)

I imagine the tests to be something like this:

import slider

def test_beatmap1():
    # really long string
    beatmap = slider.Beatmap.from_path("data/AKINO from bless4 & CHiCO with HoneyWorks - MIIRO vs. Ai no Scenario (monstrata) [Tatoe].osu")
    assert beatmap.circle_size == 4.0
    assert beatmap.artist_unicode == "AKINO from bless4 & CHiCO with HoneyWorks"
    ...
    

For now I'm not sure if it needs to be more complicated than this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants