SAPTest

CI codecov

Database and testing framework for Super Auto Pets.

Game information is queried from the Super Auto Pets Fandom wiki page and stored in a SQLite database.


Usage

```rust use saptest::{Pet, PetName, PetCombat, Food, FoodName, Team, Position};

// Create pets. let pet = Pet::tryfrom(PetName::Ant).unwrap(); let enemypet = Pet::try_from(PetName::Ant).unwrap();

// Create a team. let mut team = Team::new(&vec![pet; 5], 5).unwrap(); let mut enemyteam = Team::new(&vec![enemypet; 5], 5).unwrap();

// Give food to pets. team.setitem(Position::First, Food::tryfrom(FoodName::Garlic).ok()); enemyteam.setitem(Position::First, Food::try_from(FoodName::Garlic).ok());

// And fight as a team. team.fight(&mut enemy_team); ```


Benchmarks

Benchmarks for saptest are located in benches/battle_benchmarks.rs and run using the criterion crate. * Compared against sapai, a Super Auto Pets testing framework written in Python. * Both tests were run on an AMD Ryzen 5 5600 6-Core Processor @ 3.50 GHz.

```bash

saptest

cargo bench && open target/criterion/sapai_example/report/index.html ```

```bash

sapai

cd benches/ git clone https://github.com/manny405/sapai.git && cd sapai python setup.py install

Then run battle_benchmarks_sapai.ipynb.

```

saptest

sapai


Troubleshooting

To enable verbose logging to troubleshoot issues, enable log4rs and use the main log config file. ```rust

fn main() { log4rs::initfile("config/logconfig.yaml", Default::default()).unwrap();

// Code here. ... } ```


TODO:


Sources