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

Unit tests and OpenVIII #160

Open
FlameHorizon opened this issue Mar 25, 2020 · 12 comments
Open

Unit tests and OpenVIII #160

FlameHorizon opened this issue Mar 25, 2020 · 12 comments

Comments

@FlameHorizon
Copy link
Contributor

FlameHorizon commented Mar 25, 2020

Is there any reason why this project does not have unit tests?

I was looking at Core/Saves/ATBTimer.cs and thought - I might start my help here by adding unit tests to this class and continue refactoring.

Are there any red flags regarding unit tests in this project which I'm not aware of?

Ps. I'm aware about this Testing suite but I can't get it to work.

@jonasrk
Copy link

jonasrk commented Mar 25, 2020

If I see some examples for unit tests, maybe I can also help with adding a few. :) Having some unexpected freetime. ;)

@Sebanisu
Copy link
Collaborator

Someone tried to add unit tests. Though I donno how to use them.

@FlameHorizon
Copy link
Contributor Author

FlameHorizon commented Mar 26, 2020

Today’s update (mostly to clear my head) - I started working on test cases for Core/Saves/Damageable.cs and Core/Battle/Enemies/Enemy.cs which inheritances from Damageable. And oh boy, the dependencies are really. Although I’ve managed to write a few test cases for public bool Damageable.ChangeHP(int dmg). I hope either tomorrow or on Saturday Sunday I will have some to show.

@FlameHorizon
Copy link
Contributor Author

Today I’ve slowly started making some non-breaking changes in #163 . This will help me to understand project and people who are working on it better.

To the owners - can I help you in any ways implement a coding convention for this project?

@Sebanisu
Copy link
Collaborator

I had been using reshaper and codemaid to try to clean up some code the last few weeks. I haven't committed to master yet. I'm not sure if there is a way to define the conventions. Though reshaper has some default ones I was using. I like reshaper because I load a file and everything is highlighted like spelling errors and things that don't follow the naming convention. So then I just need to go through the file and make it happy. So then I get a green checkmark. Codemaid just sorts everything and groups the methods, fields, properties, etc. I'm kinda a noob. I know like c++ has a clang tidy file. I don't know if something like that exists for c#.

@FlameHorizon
Copy link
Contributor Author

FlameHorizon commented Mar 29, 2020

I've moved discussion about coding style to a separate issue #165

@FlameHorizon
Copy link
Contributor Author

Great effort! I will start writing today.

@FlameHorizon
Copy link
Contributor Author

Update. Now, with this recent PR, it is even harder...

@Sebanisu
Copy link
Collaborator

Sebanisu commented Apr 2, 2020

harder to test?

@FlameHorizon
Copy link
Contributor Author

FlameHorizon commented Apr 2, 2020

Is there a reason why do you have a static CreateInstance methods with private or protected constructors?

A lot of classes (like Saves.CharacterData) are contected with global static class Memory .

Class Saves.CharacterData contains information about character's data as well as operations on binary data. Probably there are just too many things which are happening in one place.

@Sebanisu
Copy link
Collaborator

Sebanisu commented Apr 2, 2020

I am told new keywords should be hidden behind a factory method. https://refactoring.guru/design-patterns/factory-method/csharp/example

Though maybe I just did a poor job at implementation.

@Sebanisu
Copy link
Collaborator

Sebanisu commented Apr 2, 2020

Only should be two ways to make a character data instance. Loading a save or reading init.out. Enemy data stored in enemy dat files so they're loaded at the start of battle. You could have the test run after loading init.out or just feed the code random binary data and it will break and throw errors. Maybe we could break the monolith class into smaller sub classes. I was wondering if we should get rid of the damageable abstract class. It's job could be handled by an interface. I wanted to have atb and hp functions universal between the entities.

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

3 participants