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

Tests #70

Open
MaanooAk opened this issue Oct 5, 2019 · 3 comments
Open

Tests #70

MaanooAk opened this issue Oct 5, 2019 · 3 comments
Labels
c++ involves C++ code nice new thing ☺ adds new functionality

Comments

@MaanooAk
Copy link
Contributor

MaanooAk commented Oct 5, 2019

A suggestion for testing (what I am using in jnyan):

tests
├── 001
│   ├── main.nyan
│   └── sim
│       ├── 001.txt
│       └── 002.txt
└── 002
     ├── engine.nyan
     ├── main.nyan
     └── sim
         ├── 001.txt
         └── 002.txt

Where the root folders are test cases with loaded file being the main.nyan (which may include import statements) and in the sim (= simulation) folders there are files with commands in order to simulate a scenario. Every line is command, mainly assert like commands but also execution of patches.

// optionally set a namespace
namespace main

// asserts
Barracks creates	== [main.Jedi, main.Clone]
Barracks hp 		== 4000
Barracks model 		== ./models/m1.dat

// assert number of members
Unit     # 3
Infantry # 3

Jedi   hp  == 300
Master hp  == 480

// apply a patch
patch ArmorUpgrade

Jedi   hp  == 310
Master hp  == 490

Source: jnyan/src/test/resources/tests/000

@TheJJ TheJJ added c++ involves C++ code nice new thing ☺ adds new functionality labels Oct 5, 2019
@TheJJ
Copy link
Member

TheJJ commented Oct 5, 2019

Very good idea!
We should do the same here :)

I'd adapt the syntax a slight little bit though: instead of Barracks creates I'd use Barracks.creates or Barracks:creates. That should also simplify parsing a bit, because space # then is always # and member access is uniquely formatted.

@TheJJ
Copy link
Member

TheJJ commented Oct 6, 2019

We should also add a syntax to refer to points in time, and to create transactions with >1 patches.

@heinezen
Copy link
Member

heinezen commented Oct 6, 2019

Good idea!

This could be extended with API-specific tests that can assert whether our state transitions for game entities are correct and whether AvalabilityRequirement and Condition work like they should.

@TheJJ TheJJ pinned this issue Dec 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ involves C++ code nice new thing ☺ adds new functionality
Projects
None yet
Development

No branches or pull requests

3 participants